Back to index

glibc  2.9
Functions
s_ilogbf.c File Reference
#include <limits.h>
#include "math.h"
#include "math_private.h"

Go to the source code of this file.

Functions

int __ilogbf (float x)

Function Documentation

int __ilogbf ( float  x)

Definition at line 27 of file s_ilogbf.c.

{
       int32_t hx,ix;

       GET_FLOAT_WORD(hx,x);
       hx &= 0x7fffffff;
       if(hx<0x00800000) {
           if(hx==0)
              return FP_ILOGB0;    /* ilogb(0) = FP_ILOGB0 */
           else                    /* subnormal x */
               for (ix = -126,hx<<=8; hx>0; hx<<=1) ix -=1;
           return ix;
       }
       else if (hx<0x7f800000) return (hx>>23)-127;
       else if (FP_ILOGBNAN != INT_MAX) {
           /* ISO C99 requires ilogbf(+-Inf) == INT_MAX.  */
           if (hx==0x7f800000)
              return INT_MAX;
       }
       return FP_ILOGBNAN;
}

Here is the caller graph for this function: