The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


modf - decompose a floating-point number


#include <math.h>

double modf(double x, double *iptr);


The modf() function breaks the argument x into integral and fractional parts, each of which has the same sign as the argument. It stores the integral part as a double in the object pointed to by iptr.

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


Upon successful completion, modf() returns the signed fractional part of x.

If x is NaN, NaN is returned, errno may be set to [EDOM] and *iptr is set to NaN.

If the correct value would cause underflow, 0 is returned and errno may be set to [ERANGE].


The modf() function may fail if:
The value of x is NaN.
The result underflows.

No other errors will occur.






frexp(), isnan(), ldexp(), <math.h>.


Derived from Issue 1 of the SVID.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]