HP-UX Reference (11i v2 04/09) - 3 Library Functions A-M (vol 6)
i
ilogb(3M) ilogb(3M)
NAME
ilogb( ), ilogbf( ), ilogbl( ), ilogbw( ), ilogbq( ) - radix-independent exponent functions
SYNOPSIS
#include <math.h>
int ilogb(double x);
Itanium(R)-based System Only
int ilogbf(float x);
int ilogbl(long double x);
int ilogbw(extended x);
int ilogbq(quad x);
DESCRIPTION
The ilogb() function computes the exponent of the floating point value x. Formally, the return value is
the integral part of log base r of |x| as a signed integral value, for nonzero x, where r is the radix of the
machine’s floating-point arithmetic. The radix r is 2 on HP-UX systems.
If x is denormal it is treated as though it were normalized before the exponent is determined.
Note:
ilogb(x) is equivalent to (int)logb(x) for all values of x except NaN, ±INFINITY, and zero.
Itanium-based System Only
ilogbf() is a float version of ilogb(); it takes a float argument.
ilogbl() is a long double version of ilogb(); it takes a long double argument.
ilogbw() is an extended version of ilogb(); it takes an extended argument.
ilogbq() is equivalent to ilogbl() 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)
ilogbw() or ilogbq(), compile also with the -fpwidetypes
option.
Make sure your program includes
<math.h>. Link in the math library by specifying -lm
on the com-
piler or linker command line.
For more information, see the HP-UX Floating-Point Guide.
RETURN VALUE
If x is NaN,
ilogb() returns FP_ILOGBNAN.
If x is ±INFINITY,
ilogb() returns INT_MAX.
If x is zero,
ilogb() returns FP_ILOGB0.
The macros
FP_ILOGBNAN and FP_ILOGB0 are defined in <math.h>.
ERRORS
No errors are defined.
SEE ALSO
frexp(3M), logb(3M), scalb(3M), scalbn(3M), scalbln(3M), math(5).
STANDARDS CONFORMANCE
ilogb() : XPG4.2, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)
ilogbf(), ilogbl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)
HP-UX 11i Version 2: September 2004 − 1 − Hewlett-Packard Company Section 3−−531