fmod(3M)
NAME
fmod(), fmodf() − remainder functions
SYNOPSIS
#include <math.h>
double fmod(double x, double y);
float fmodf(float x, float y);
DESCRIPTION
The fmod() function returns the floating-point remainder (f) of the division of x by y, where f has the same sign as x, such that x=iy+f for some integer i, and |f| < |y|.
fmodf() is a float version of fmod(); it takes float arguments and returns a float result. To use this function, compile either with the −Ae option or with the −Aa and −D_HPUX_SOURCE options. Otherwise, the compiler promotes the float arguments to double, and the function returns incorrect results.
fmodf() is not specified by any standard, but it is named in accordance with the conventions specified in the "Future Library Directions" section of the ANSI C standard.
To use these functions, link in the math library by specifying −lm on the compiler or linker command line.
RETURN VALUE
If y is ±INFINITY and x is not ±INFINITY, fmod() returns x.
If x is ±zero and y is nonzero, fmod() returns x.
If x or y is NaN, fmod() returns NaN.
If the correct value after rounding would be smaller in magnitude than MINDOUBLE, fmod() returns zero.
If y is zero, fmod() returns NaN and sets errno to [EDOM].
If x is ±INFINITY, fmod() returns NaN and sets errno to [EDOM].
ERRORS
If fmod() fails, errno is set to one of the following values.
[EDOM] y is zero.
[EDOM] x is ±INFINITY.
SEE ALSO
ceil(3M), fabs(3M), floor(3M), isinf(3M), isnan(3M), remainder(3M), rint(3M), values(5).
STANDARDS CONFORMANCE
fmod(): SVID3, XPG4.2, ANSI C
Hewlett-Packard Company — HP-UX Release 10.20: July 1996