modf, modff, modfl, modfd32, modfd64, and modfd128 Subroutines

Purpose

Decomposes a floating-point number.

Syntax

#include <math.h>

float modff (x, iptr)
float x;
float *iptr;

double modf (x, iptr)
double x, *iptr;

long double modfl (x, iptr)
long double x, *iptr;

_Decimal32 modfd32 (x, iptr)
_Decimal32 x, *iptr;

_Decimal64 modfd64 (x, iptr)
_Decimal64 x, *iptr;

_Decimal128 modf128 (x, iptr)
_Decimal128 x, *iptr;

Description

The modff, modf, modfl, modfd32, modfd64, and modfd128 subroutines divide the x parameter into integral and fractional parts, each of which has the same sign as the arguments. These subroutines store the integral part as a floating-point value in the object pointed to by the iptr parameter.

Parameters

Item Description
x Specifies the value to be computed.
iptr Points to the object where the integral part is stored.

Return Values

Upon successful completion, the modff, modf, modfl, modfd32, modfd64, and modfd128 subroutines return the signed fractional part of x.

If x is NaN, a NaN is returned, and *iptr is set to a NaN.

If x is ±Inf, ±0 is returned, and *iptr is set to ±Inf.