Next: infinity, Previous: hypot, Up: Math

### 1.22 `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 `- INT_MAX` (`INT_MAX` is defined in limits.h). If val is infinite, or NaN, they return `INT_MAX`.

Portability
Neither `ilogb` nor `ilogbf` is required by ANSI C or by the System V Interface Definition (Issue 2).