int ilogb (double x);int ilogbf (float x);int ilogbl (long double x);
int ilogb (double x);int ilogb (float x);int ilogb (long double x);int ilogb (T x); // additional overloads for integral types
1.0 and FLT_RADIX , so that, for a positive x:2, and the value returned by this function is one less than the exponent obtained with frexp (because of the different significand normalization as [1.0,2.0) instead of [0.5,1.0)).<cmath> ) for the integral types: These overloads effectively cast x to a double before calculations (defined for T being any integral type ).| macro | description |
|---|---|
| FP_ILOGB0 | x is zero |
| FP_ILOGBNAN | x is NaN |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* ilogb example */
#include <stdio.h> /* printf */
#include <math.h> /* ilogb */
int main ()
{
double param;
int result;
param = 10.0;
result = ilogb (param);
printf ("ilogb(%f) = %d\n", param, result);
return 0;
}
ilogb(10.000000) = 3