Back to index

glibc  2.9
Functions | Variables
s_scalbnf.c File Reference
#include "math.h"
#include "math_private.h"

Go to the source code of this file.

Functions

float __scalbnf (float x, int n)

Variables

static float two25 = 3.355443200e+07
static float twom25 = 2.9802322388e-08
static float huge = 1.0e+30
static float tiny = 1.0e-30

Function Documentation

float __scalbnf ( float  x,
int  n 
)

Definition at line 36 of file s_scalbnf.c.

{
       int32_t k,ix;
       GET_FLOAT_WORD(ix,x);
        k = (ix&0x7f800000)>>23;          /* extract exponent */
        if (k==0) {                       /* 0 or subnormal x */
            if ((ix&0x7fffffff)==0) return x; /* +-0 */
           x *= two25;
           GET_FLOAT_WORD(ix,x);
           k = ((ix&0x7f800000)>>23) - 25;
           }
        if (k==0xff) return x+x;          /* NaN or Inf */
        k = k+n;
        if (n> 50000 || k >  0xfe)
         return huge*__copysignf(huge,x); /* overflow  */
       if (n< -50000)
         return tiny*__copysignf(tiny,x); /*underflow*/
        if (k > 0)                        /* normal result */
           {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;}
        if (k <= -25)
           return tiny*__copysignf(tiny,x);      /*underflow*/
        k += 25;                          /* subnormal result */
       SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23));
        return x*twom25;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

float huge = 1.0e+30 [static]

Definition at line 30 of file s_scalbnf.c.

float tiny = 1.0e-30 [static]

Definition at line 31 of file s_scalbnf.c.

float two25 = 3.355443200e+07 [static]

Definition at line 28 of file s_scalbnf.c.

float twom25 = 2.9802322388e-08 [static]

Definition at line 29 of file s_scalbnf.c.