|
Standard C Library Functions | modf(3C) |
| modf, modff - decompose floating-point number |
SYNOPSIS
|
#include <math.h> double modf(double x, double *iptr); |
| float modff(float x, float *iptr); |
|
The modf() and modff() functions break the argument x into integral and fractional parts, each of which has the same sign as the argument.
The modf() function stores the integral part as a double in the object pointed to by iptr. The modff() function stores the
integral part as a float in the object pointed to by iptr.
|
|
Upon successful completion, modf() and modff() return the signed fractional part of x.
If x is NaN, NaN is returned and *iptr is set to NaN.
If the correct value would cause underflow to 0.0, modf() returns 0 and errno may be set to ERANGE.
|
|
The modf() function may fail if:
-
ERANGE
- The result underflows.
|
|
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.
|
|
See attributes(5) for descriptions of the following
attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
MT-Level | MT-Safe |
|
| |