LOGB(3) NEWLIB LOGB(3)NAME
1.37 `logb', `logbf'-get exponent of floating-point number
SYNOPSIS
#include <math.h>
double logb(double X);
float logbf(float X);
DESCRIPTION
The `logb' functions extract the exponent of X, as a signed integer
value in floating-point format. If X is subnormal it is treated as
though it were normalized; thus, for positive finite X, 1 <= (X *
FLT_RADIX to the power (-logb(X))) < FLT_RADIX. A domain error may
occur if the argument is zero. In this floating-point implementation,
FLT_RADIX is 2. Which also means that for finite X, `logb'(X) =
`floor'(`log2'(`fabs'(X))).
All nonzero, normal numbers can be described as M * 2**P, where 1.0
<= M < 2.0. The `logb' functions examine the argument X, and return P.
The `frexp' functions are similar to the `logb' functions, but return‐
ing M adjusted to the interval [.5, 1) or 0, and P+1.
RETURNS
When X is: +inf or -inf, +inf is returned; NaN, NaN is returned; 0,
-inf is returned, and the divide-by-zero exception is raised; other‐
wise, the `logb' functions return the signed exponent of X.
PORTABILITY
ANSI C, POSIX
*See Also*
frexp, ilogb
SEE ALSO
logb is part of the library. The full documentation for is maintained
as a Texinfo manual. If info and are properly installed at your site,
the command
info
will give you access to the complete manual.
NEWLIB April 2010 LOGB(3)