Copyright © 1997 The Open Group

fmod - floating-point remainder value function

`#include <math.h> double fmod(double`

x, doubley);

Thefmod()function returns the floating-point remainder of the division ofxbyy.An application wishing to check for error situations should set

errnoto 0 before callingfmod(). Iferrnois non-zero on return, or the return value is NaN, an error has occurred.

Thefmod()function returns the valuex - i * yfor some integerisuch that, ifyis non-zero, the result has the same sign asxand magnitude less than the magnitude ofy.If

xoryis NaN, NaN is returned anderrnomay be set to [EDOM].If

yis 0, NaN is returned anderrnois set to [EDOM], or 0 is returned anderrnomay be set to [EDOM].If

xis ±Inf, either 0 is returned anderrnois set to [EDOM], or NaN is returned anderrnomay be set to [EDOM].If

yis non-zero,fmod(±0,y) returns the value ofx. Ifxis not ±Inf,fmod(x,±Inf) returns the value ofx.If the result underflows, 0 is returned and

errnomay be set to [ERANGE].

Thefmod()function may fail if:

- [EDOM]
- One or both of the arguments is NaN, or
yis 0, orxis ±Inf.- [ERANGE]
- The result underflows.
No other errors will occur.

None.

Portable applications should not callfmod()withyequal to 0, because the result is implementation-dependent. The application should verifyyis non-zero before callingfmod().

None.

isnan(),<math.h>.

Derived from Issue 1 of the SVID.

Copyright © 1997 The Open Group

[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]