fmod.3m (2010 09)

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);
HP Integrity Server 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.
Integrity Server 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 Integrity servers)
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].
Integrity Server
HP-UX
libm functions on Integrity servers do not set errno by default. For errno setting, compile
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 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (2 pages)