Back to index

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

Go to the source code of this file.

Functions

long double __ieee754_remainderl (long double x, long double p)

Variables

static long double zero = 0.0

Function Documentation

long double __ieee754_remainderl ( long double  x,
long double  p 
)

Definition at line 43 of file e_remainderl.c.

{
       u_int32_t sx,sex,sep,x0,x1,p0,p1;
       long double p_half;

       GET_LDOUBLE_WORDS(sex,x0,x1,x);
       GET_LDOUBLE_WORDS(sep,p0,p1,p);
       sx = sex&0x8000;
       sep &= 0x7fff;
       sex &= 0x7fff;

    /* purge off exception values */
       if((sep|p0|p1)==0) return (x*p)/(x*p);    /* p = 0 */
       if((sex==0x7fff)||                 /* x not finite */
         ((sep==0x7fff)&&                 /* p is NaN */
          ((p0|p1)!=0)))
           return (x*p)/(x*p);


       if (sep<0x7ffe) x = __ieee754_fmodl(x,p+p);      /* now x < 2p */
       if (((sex-sep)|(x0-p0)|(x1-p1))==0) return zero*x;
       x  = fabsl(x);
       p  = fabsl(p);
       if (sep<0x0002) {
           if(x+x>p) {
              x-=p;
              if(x+x>=p) x -= p;
           }
       } else {
           p_half = 0.5*p;
           if(x>p_half) {
              x-=p;
              if(x>=p_half) x -= p;
           }
       }
       GET_LDOUBLE_EXP(sex,x);
       SET_LDOUBLE_EXP(x,sex^sx);
       return x;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

long double zero = 0.0 [static]

Definition at line 36 of file e_remainderl.c.