HP-UX Reference (11i v2 03/08) - 3 Library Functions A-M (vol 6)
m
modf(3M) modf(3M)
NAME
modf( ), modff( ), modfl( ), modfw( ), modfq( ) - decompose floating-point number
SYNOPSIS
#include <math.h>
double modf(double x, double *iptr);
Itanium(R)-based System Only
float modff(float x, float *iptr);
long double modfl(long double x, long double *iptr);
extended modfw(extended x, extended *iptr);
quad modfq(quad x, quad *iptr);
DESCRIPTION
The modf() function breaks the argument x into integral and fractional parts, each of which has the
same sign as the argument. It stores the integral part as a
double in the object pointed to by iptr .
Itanium-based System Only
modff() is a float version of modf(); it takes float and float * arguments and returns a
float result.
modfl() is a long double version of modf(); it takes long double and long double *
arguments and returns a long double result.
modfw() is an extended version of modf(); it takes extended and extended * arguments and
returns an extended result.
modfq() is equivalent to modfl() on HP-UX systems.
USAGE
To use (for Itanium-based systems)
modff(), compile either with the default -Ae option or with the -Aa
option.
To use (for Itanium-based systems)
modfl(), modfw(),ormodfq(), compile either with the default
-Ae option or with the -Aa and -D_HPUX_SOURCE
options.
To use (for Itanium-based systems)
modfw() or modfq(), compile also with the -fpwidetypes
option.
To use these functions, make sure your program includes
<math.h>, and link in the math library by
specifying -lm on the compiler or linker command line.
For more information, see the HP-UX Floating-Point Guide.
RETURN VALUE
modf(±x,iptr) returns a result with the same sign as x.
modf(±Inf,iptr) returns ±0 and stores ±Inf in the object pointed to by iptr.
modf(NaN,iptr) stores a NaN in the object pointed to by iptr and returns a NaN.
ERRORS
No errors are defined.
SEE ALSO
frexp(3M), ldexp(3M), rint(3M), trunc(3M), scalb(3M), scalbln(3M), scalbn(3M), math(5).
STANDARDS CONFORMANCE
modf() : SVID3, XPG4.2, ANSI C, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arith-
metic’’)
modff(), modfl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)
HP-UX 11i Version 2: August 2003 − 1 − Hewlett-Packard Company Section 3−−615