Next: infinity, Previous: hypot, Up: Math

### 1.29 `ilogb`, `ilogbf`—get exponent of floating-point number

Synopsis

         #include <math.h>
         int ilogb(double val);
         int ilogbf(float val);

Description

All nonzero, normal numbers can be described as m * 2**p. `ilogb` and `ilogbf` examine the argument val, and return p. The functions `frexp` and `frexpf` are similar to `ilogb` and `ilogbf`, but also return m.

Returns

`ilogb` and `ilogbf` return the power of two used to form the floating-point argument. If val is `0`, they return `FP_ILOGB0`. If val is infinite, they return `INT_MAX`. If val is NaN, they return `FP_ILOGBNAN`. (`FP_ILOGB0` and `FP_ILOGBNAN` are defined in math.h, but in turn are defined as INT_MIN or INT_MAX from limits.h. The value of FP_ILOGB0 may be either INT_MIN or -INT_MAX. The value of FP_ILOGBNAN may be either INT_MAX or INT_MIN.)

Portability
C99, POSIX