Back to index

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

Go to the source code of this file.

Functions

long double __scalbnl (long double x, int n)

Variables

static long double two64 = 1.8446744073709551616e19L
static long double twom64 = 5.421010862427522170037e-20L
static long double huge = 1.0e+4900L
static long double tiny = 1.0e-4900L

Function Documentation

long double __scalbnl ( long double  x,
int  n 
)

Definition at line 44 of file s_scalbnl.c.

{
       int32_t k,es,hx,lx;
       GET_LDOUBLE_WORDS(es,hx,lx,x);
        k = es&0x7fff;                           /* extract exponent */
        if (k==0) {                       /* 0 or subnormal x */
            if ((lx|(hx&0x7fffffff))==0) return x; /* +-0 */
           x *= two64;
           GET_LDOUBLE_EXP(hx,x);
           k = (hx&0x7fff) - 64;
           }
        if (k==0x7fff) return x+x;        /* NaN or Inf */
        k = k+n;
        if (n> 50000 || k > 0x7ffe)
         return huge*__copysignl(huge,x); /* overflow  */
       if (n< -50000)
         return tiny*__copysignl(tiny,x);
        if (k > 0)                        /* normal result */
           {SET_LDOUBLE_EXP(x,(es&0x8000)|k); return x;}
        if (k <= -64)
           return tiny*__copysignl(tiny,x);      /*underflow*/
        k += 64;                          /* subnormal result */
       SET_LDOUBLE_EXP(x,(es&0x8000)|k);
        return x*twom64;
}

Here is the call graph for this function:


Variable Documentation

long double huge = 1.0e+4900L [static]

Definition at line 38 of file s_scalbnl.c.

long double tiny = 1.0e-4900L [static]

Definition at line 39 of file s_scalbnl.c.

long double two64 = 1.8446744073709551616e19L [static]

Definition at line 36 of file s_scalbnl.c.

long double twom64 = 5.421010862427522170037e-20L [static]

Definition at line 37 of file s_scalbnl.c.