Back to index

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

Go to the source code of this file.

Functions

long double __ieee754_atan2l (long double y, long double x)

Variables

static long double tiny = 1.0e-4900L
static long double zero = 0.0
static long double pi_o_4 = 7.85398163397448309615660845819875699e-01L
static long double pi_o_2 = 1.57079632679489661923132169163975140e+00L
static long double pi = 3.14159265358979323846264338327950280e+00L
static long double pi_lo = 8.67181013012378102479704402604335225e-35L

Function Documentation

long double __ieee754_atan2l ( long double  y,
long double  x 
)

Definition at line 61 of file e_atan2l.c.

{
       long double z;
       int64_t k,m,hx,hy,ix,iy;
       u_int64_t lx,ly;

       GET_LDOUBLE_WORDS64(hx,lx,x);
       ix = hx&0x7fffffffffffffffLL;
       GET_LDOUBLE_WORDS64(hy,ly,y);
       iy = hy&0x7fffffffffffffffLL;
       if(((ix|((lx|-lx)>>63))>0x7fff000000000000LL)||
          ((iy|((ly|-ly)>>63))>0x7fff000000000000LL))   /* x or y is NaN */
          return x+y;
       if(((hx-0x3fff000000000000LL)|lx)==0) return __atanl(y);   /* x=1.0L */
       m = ((hy>>63)&1)|((hx>>62)&2);     /* 2*sign(x)+sign(y) */

    /* when y = 0 */
       if((iy|ly)==0) {
           switch(m) {
              case 0:
              case 1: return y;    /* atan(+-0,+anything)=+-0 */
              case 2: return  pi+tiny;/* atan(+0,-anything) = pi */
              case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */
           }
       }
    /* when x = 0 */
       if((ix|lx)==0) return (hy<0)?  -pi_o_2-tiny: pi_o_2+tiny;

    /* when x is INF */
       if(ix==0x7fff000000000000LL) {
           if(iy==0x7fff000000000000LL) {
              switch(m) {
                  case 0: return  pi_o_4+tiny;/* atan(+INF,+INF) */
                  case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */
                  case 2: return  3.0L*pi_o_4+tiny;/*atan(+INF,-INF)*/
                  case 3: return -3.0L*pi_o_4-tiny;/*atan(-INF,-INF)*/
              }
           } else {
              switch(m) {
                  case 0: return  zero  ; /* atan(+...,+INF) */
                  case 1: return -zero  ; /* atan(-...,+INF) */
                  case 2: return  pi+tiny  ;     /* atan(+...,-INF) */
                  case 3: return -pi-tiny  ;     /* atan(-...,-INF) */
              }
           }
       }
    /* when y is INF */
       if(iy==0x7fff000000000000LL) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;

    /* compute y/x */
       k = (iy-ix)>>48;
       if(k > 120) z=pi_o_2+0.5L*pi_lo;   /* |y/x| >  2**120 */
       else if(hx<0&&k<-120) z=0.0L;             /* |y|/x < -2**120 */
       else z=__atanl(fabsl(y/x));        /* safe to do y/x */
       switch (m) {
           case 0: return       z  ;      /* atan(+,+) */
           case 1: {
                    u_int64_t zh;
                    GET_LDOUBLE_MSW64(zh,z);
                    SET_LDOUBLE_MSW64(z,zh ^ 0x8000000000000000ULL);
                  }
                  return       z  ;       /* atan(-,+) */
           case 2: return  pi-(z-pi_lo);/* atan(+,-) */
           default: /* case 3 */
                  return  (z-pi_lo)-pi;/* atan(-,-) */
       }
}

Here is the call graph for this function:


Variable Documentation

long double pi = 3.14159265358979323846264338327950280e+00L [static]

Definition at line 55 of file e_atan2l.c.

long double pi_lo = 8.67181013012378102479704402604335225e-35L [static]

Definition at line 56 of file e_atan2l.c.

long double pi_o_2 = 1.57079632679489661923132169163975140e+00L [static]

Definition at line 54 of file e_atan2l.c.

long double pi_o_4 = 7.85398163397448309615660845819875699e-01L [static]

Definition at line 53 of file e_atan2l.c.

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

Definition at line 51 of file e_atan2l.c.

long double zero = 0.0 [static]

Definition at line 52 of file e_atan2l.c.