modf(), modff()

extract integral and fractional parts from floating point value 

Function


SYNOPSIS

#include <math.h>

double modf(double value, double *iptr);

float modf(float value, float *iptr);


DESCRIPTION

The modf() function decomposes the parameter value into integral and fractional parts. Each part has the same sign as the parameter. It stores the integral part as a double in iptr and returns the fractional part.

To check for error situations, set errno to 0 before calling modf(). If errno is non-zero on return, or the return value is NaN, an error has occurred.

modff() function is a single-precision version of modf().


PARAMETERS

value 

Is the floating point value to be broken down.

iptr 

Is the return pointer to integral portion of value.


RETURN VALUES

The modf() function returns the signed fractional portion of value.

If value is NaN, NaN is returned, errno is set to EDOM and *iptr is set to NaN. If the return value would underflow, 0 is returned and errno is set to ERANGE.


CONFORMANCE

modf(): ANSI/ISO 9899-1990

modff(): PTC MKS Toolkit UNIX APIs extension


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
ceil(), floor(), fmod(), frexp()


PTC MKS Toolkit 10.5 Documentation Build 40.