C examples for math.h:ilogb
function
<cmath> <ctgmath> <math.h>
Returns the integral part of the logarithm of |x|, using FLT_RADIX as base for the logarithm.
Two specific macro constants may be returned by this function to indicate the following special cases:
macro | description |
---|---|
FP_ILOGB0 | x is zero |
FP_ILOGBNAN | x is NaN |
int ilogb (double x); int ilogbf (float x); int ilogbl (long double x); int ilogb (float x); int ilogb (long double x); int ilogb (T x);
Parameter | Description |
---|---|
x | Value whose ilogb is returned. |
#include <stdio.h> #include <math.h> /* ilogb */ int main ()/*from w w w .ja v a2 s . c o m*/ { double param = 10.0; int result = ilogb (param); printf ("ilogb(%f) = %d\n", param, result); return 0; }