HP-UX Reference (11i v2 07/12) - 3 Library Functions A-M (vol 6)
f
fmod(3M) fmod(3M)
NAME
fmod( ), fmodf( ), fmodl( ), fmodw(), fmodq( ) - remainder functions
SYNOPSIS
#include <math.h>
double fmod(double x, double y);
float fmodf(float x, float y);
Itanium(R)-based System Only
long double fmodl(long double x, long double y);
extended fmodw(extended x, extended y);
quad fmodq(quad x, quad 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.
Itanium-based System Only
fmodl() is a long double version of fmod(); it takes long double arguments and returns a
long double result.
fmodw() is an extended version of fmod(); it takes extended arguments and returns an
extended result.
fmodq() is equivalent to fmodl() on HP-UX systems.
USAGE
To use these functions compile either with the default -Ae option or with the
-Aa and
-D_HPUX_SOURCE options.
To use (for Itanium-based systems)
fmodw() or fmodq(), compile also with the -fpwidetypes
option.
To use any of these functions, make sure your program includes
<math.h>. 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 a nonzero number,
fmod() returns x.
If x or y is NaN, fmod() returns NaN.
If x is ±INFINITY or y is zero, fmod() returns NaN and raises the invalid exception.
ERRORS
If y is zero or x is infinite, fmod() sets errno to [EDOM].
Itanium-based System
HP-UX libm functions on Itanium-based systems do not set errno by default. For errno setting, com-
pile with the
+Olibmerrno option.
SEE ALSO
ceil(3M), fabs(3M), floor(3M), remainder(3M), remquo(3M), rint(3M), math(5).
STANDARDS CONFORMANCE
fmod() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-
metic’’)
fmodf(), fmodl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)
HP-UX 11i Version 2: December 2007 Update − 1 − Hewlett-Packard Company 435