Name

ilogb, ilogbf, ilogbl
- extract exponent

Library

libm.lib

Synopsis

  #include <math.h>
  int ilogb (double x);
  int ilogbf (float x);
  int ilogbl (long double x);

Detailed description

The functions ilogb, ilogbf, and ilogbl return x ’s exponent, in integer format. ilogb (±oo);
returns INT_MAX, ilogb (±NaN);
returns FP_ILOGBNAN and ilogb (0);
returns FP_ILOGB0.

Examples

#include <math.h>
int main( )
{
   double e = 1024;
   /*iLogb(), ilogbf() and ilogbl() */
   y = ilogb( e );
   printf( "ilogb( %f) = %f\n", e, y );
   y = ilogbf( e );
   printf( "ilogbf( %f) = %f\n", e, y );
   y = ilogbl( e );
   printf( "ilogbl( %f) = %f\n\n", e, y );
}

         

Output

ilogb (1024) = 10.000000
ilogbf(1024) = 10.000000
ilogbl(1024) = 10.000000

         


See also

frexp, ieee, math, scalbn
The ilogb, ilogbf, and ilogbl routines conform to -isoC-99. They provide functionality similar to the logb function recommended by -ieee754.
The ilogb and ilogbf functions appeared in BSD 4.3 and 2.0 , respectively.

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top