HP-UX Reference (11i v1 05/09) - 3 Library Functions A-M (vol 6)
f
fmod(3M) 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 default
-Ae option or with the -Aa and -D_HPUX_SOURCE
options.
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, make sure your program includes <math.h>, and link in the math library by speci-
fying -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 a nonzero number,
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), remainder(3M), rint(3M), math(5), values(5).
STANDARDS CONFORMANCE
fmod(): SVID3, XPG4.2, ANSI C
Section 3−−272 Hewlett-Packard Company − 1 − HP-UX 11i Version 1: September 2005