NAME
logb() — radix-independent exponent
SYNOPSIS
#include <math.h>
double logb(double x);
DESCRIPTION
The
logb()
function computes the exponent of
x.
Formally, the return value is the integral part of
log base
r
of
|x|
as a signed floating point value, for nonzero
x,
where
r
is the radix of the machine's floating-point arithmetic.
The
logb()
function is recommended by the IEEE-754 standard for
floating-point arithmetic. The ISO/ANSI C committee has approved the
logb()
function for inclusion in the C9X draft standard.
To use this function, compile either with the default
-Ae
option or with the
-Aa
and
-D_HPUX_SOURCE
options. Make sure your program includes
<math.h>.
Link in the math library by specifying
-lm
on the compiler or linker command line.
RETURN VALUE
Upon successful completion,
logb()
returns the exponent of
x.
If
x
is NaN,
logb()
returns NaN.
If
x
is ±INFINITY,
logb()
returns +INFINITY.
If
x
is zero,
logb()
returns
-HUGE_VAL
and sets
errno
to [EDOM].
ERRORS
If
logb()
fails,
errno
is set to the following value.
STANDARDS CONFORMANCE
logb(): SVID3, XPG4.2