Back to index

glibc  2.9
Functions
mptan.c File Reference
#include "endian.h"
#include "mpa.h"

Go to the source code of this file.

Functions

int __mpranred (double, mp_no *, int)
void __c32 (mp_no *, mp_no *, mp_no *, int)
void __mptan (double x, mp_no *mpy, int p)

Function Documentation

void __c32 ( mp_no ,
mp_no ,
mp_no ,
int   
)

Definition at line 112 of file sincos32.c.

                                                {
  static const mp_no mpt={1,{1.0,2.0}}, one={1,{1.0,1.0}};
  mp_no u,t,t1,t2,c,s;
  int i;
  __cpy(x,&u,p);
  u.e=u.e-1;
  cc32(&u,&c,p);
  ss32(&u,&s,p);
  for (i=0;i<24;i++) {
    __mul(&c,&s,&t,p);
    __sub(&s,&t,&t1,p);
    __add(&t1,&t1,&s,p);
    __sub(&mpt,&c,&t1,p);
    __mul(&t1,&c,&t2,p);
    __add(&t2,&t2,&c,p);
  }
  __sub(&one,&c,y,p);
  __cpy(&s,z,p);
}

Here is the call graph for this function:

int __mpranred ( double  ,
mp_no ,
int   
)

Definition at line 230 of file sincos32.c.

{
  number v;
  double t,xn;
  int i,k,n;
  static const mp_no one = {1,{1.0,1.0}};
  mp_no a,b,c;

  if (ABS(x) < 2.8e14) {
    t = (x*hpinv.d + toint.d);
    xn = t - toint.d;
    v.d = t;
    n =v.i[LOW_HALF]&3;
    __dbl_mp(xn,&a,p);
    __mul(&a,&hp,&b,p);
    __dbl_mp(x,&c,p);
    __sub(&c,&b,y,p);
    return n;
  }
  else {                      /* if x is very big more precision required */
    __dbl_mp(x,&a,p);
    a.d[0]=1.0;
    k = a.e-5;
    if (k < 0) k=0;
    b.e = -k;
    b.d[0] = 1.0;
    for (i=0;i<p;i++) b.d[i+1] = toverp[i+k];
    __mul(&a,&b,&c,p);
    t = c.d[c.e];
    for (i=1;i<=p-c.e;i++) c.d[i]=c.d[i+c.e];
    for (i=p+1-c.e;i<=p;i++) c.d[i]=0;
    c.e=0;
    if (c.d[1] >=  8388608.0)
    { t +=1.0;
      __sub(&c,&one,&b,p);
      __mul(&b,&hp,y,p);
    }
    else __mul(&c,&hp,y,p);
    n = (int) t;
    if (x < 0) { y->d[0] = - y->d[0]; n = -n; }
    return (n&3);
  }
}

Here is the call graph for this function:

void __mptan ( double  x,
mp_no mpy,
int  p 
)

Definition at line 44 of file mptan.c.

                                          {

  static const double MONE = -1.0;

  int n;
  mp_no mpw, mpc, mps;

  n = __mpranred(x, &mpw, p) & 0x00000001; /* negative or positive result */
  __c32(&mpw, &mpc, &mps, p);              /* computing sin(x) and cos(x) */
  if (n)                     /* second or fourth quarter of unit circle */
  { __dvd(&mpc,&mps,mpy,p);
    mpy->d[0] *= MONE;
  }                          /* tan is negative in this area */
  else  __dvd(&mps,&mpc,mpy,p);

  return;
}

Here is the call graph for this function:

Here is the caller graph for this function: