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

 NAME

modf - decompose a floating-point number

 SYNOPSIS



#include <math.h>

double modf(double x, double *iptr);

 DESCRIPTION

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.

 RETURN VALUE

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].

 ERRORS

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

No other errors will occur.

 EXAMPLES

None.

 APPLICATION USAGE

None.

 SEE ALSO

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

DERIVATION

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 ]