Important: The information in this document is obsolete and should not be used for new development.
logb
You can use thelogb
function to determine the value in the exponent field of a floating-point number.
double_t logb (double_t x);
x
- Any floating-point number.
DESCRIPTION
Thelogb
function returns the signed exponent of its argument x as a signed integer value.such that
When the argument is a denormalized number, the exponent is determined as if the input argument had first been normalized.
Note that for a nonzero finite x, .
That is, for a nonzero finite x, the magnitude of x taken to the power of its inverse exponent is between 1 and 2.
This function conforms to IEEE Standard 854, which differs from IEEE Standard 754 on the treatment of a denormalized argument x.
EXCEPTIONS
If x is finite and nonzero, the result of is exact.SPECIAL CASES
Table 10-18 shows the results when the argument to thelogb
function is a zero, a NaN, or an Infinity.
Special cases for the logb
functionOperation Result Exceptions raised - Divide-by-zero - Divide-by-zero NaN None[39] + None + None EXAMPLES
z = logb(789.9); /* z = 9.0 because 789.9 1.54 29 */ z = logb(21456789);/* z = 24.0 because 21456789 1.28 224 */
[39] If the NaN is a signaling NaN, the invalid exception is raised.