logb(3C)logb(3C)NAME
logb, ilogb, logbf, ilogbf, logbl, ilogbl - floating point exponent (libc
routines)
SYNOPSIS
#include <math.h>
double logb (double value);
int ilogb (double value);
float logbf (float value);
int ilogbf (float value);
long double logbl (long double value);
int ilogbl (long double value);
DESCRIPTION
Note that the long double routines are only valid for the MIPSpro
compilers.
Long double functions have been renamed to be compliant with the ANSI-C
standard, however to be backward compatible, they may still be called
with the double precision function name prefixed with a q. (for example,
qlogb.)
Every non-zero number can be written uniquely as x*2**n, where the
mantissa x is in the range 1.0 < |x| < 2.0, and the exponent n is an
integer. logb returns the value n (also called the unbiased exponent of
its argument), as a double precision value. Similarly for logbf and
logbl.
ilogb returns the unbiased exponent of its argument as an integer value.
Similarly for ilogbf and ilogbl.
RETURNS
logb(_0.0) returns -infinity and sets errno to EDOM.
logb(_infinity) returns +infinity.
logb(NaN) returns a quiet NaN.
Similarly for logbf and logbl.
If value is zero, the ilogb function returns the result FP_ILOGB0. If
value is infinite, it returns the result INT_MAX; if value is a NaN it
returns the result FP_ILOGBNAN; otherwise, ilogb is equivalent to calling
the logb function and casting the returned value to type int.
Similarly for ilogbf and ilogbl.
The values of FP_ILOGB0, INT_MAX, and FP_ILOGBNAN are defined in math.h.
Page 1
logb(3C)logb(3C)NOTES
Long double operations on this system are only supported in round to
nearest rounding mode (the default). The system must be in round to
nearest rounding mode when calling any of the long double functions, or
incorrect answers will result.
Users concerned with portability to other computer systems should note
that the long double and float versions of these functions were optional
according to the ANSI C Programming Language Specification ISO/IEC 9899 :
1990 (E) and are no longer optional according to ISO/IEC 9899:1999(E).
SEE ALSOcc(1), errno(3C), frexp(3C), intro(3M).
Page 2