Back to index

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

Go to the source code of this file.

Functions

long double __kernel_tanl (long double x, long double y, int iy)

Variables

static long double one = 1.0L
static long double pio4hi = 7.8539816339744830961566084581987569936977E-1L
static long double pio4lo = 2.1679525325309452561992610065108379921906E-35L
static long double TH = 3.333333333333333333333333333333333333333E-1L
static long double T0 = -1.813014711743583437742363284336855889393E7L
static long double T1 = 1.320767960008972224312740075083259247618E6L
static long double T2 = -2.626775478255838182468651821863299023956E4L
static long double T3 = 1.764573356488504935415411383687150199315E2L
static long double T4 = -3.333267763822178690794678978979803526092E-1L
static long double U0 = -1.359761033807687578306772463253710042010E8L
static long double U1 = 6.494370630656893175666729313065113194784E7L
static long double U2 = -4.180787672237927475505536849168729386782E6L
static long double U3 = 8.031643765106170040139966622980914621521E4L
static long double U4 = -5.323131271912475695157127875560667378597E2L

Function Documentation

long double __kernel_tanl ( long double  x,
long double  y,
int  iy 
)

Definition at line 93 of file k_tanl.c.

{
  long double z, r, v, w, s;
  int32_t ix, sign;
  ieee854_long_double_shape_type u, u1;

  u.value = x;
  ix = u.parts32.w0 & 0x7fffffff;
  if (ix < 0x3fc60000)             /* x < 2**-57 */
    {
      if ((int) x == 0)
       {                    /* generate inexact */
         if ((ix | u.parts32.w1 | u.parts32.w2 | u.parts32.w3
              | (iy + 1)) == 0)
           return one / fabs (x);
         else
           return (iy == 1) ? x : -one / x;
       }
    }
  if (ix >= 0x3ffe5942) /* |x| >= 0.6743316650390625 */
    {
      if ((u.parts32.w0 & 0x80000000) != 0)
       {
         x = -x;
         y = -y;
         sign = -1;
       }
      else
       sign = 1;
      z = pio4hi - x;
      w = pio4lo - y;
      x = z + w;
      y = 0.0;
    }
  z = x * x;
  r = T0 + z * (T1 + z * (T2 + z * (T3 + z * T4)));
  v = U0 + z * (U1 + z * (U2 + z * (U3 + z * (U4 + z))));
  r = r / v;

  s = z * x;
  r = y + z * (s * r + y);
  r += TH * s;
  w = x + r;
  if (ix >= 0x3ffe5942)
    {
      v = (long double) iy;
      w = (v - 2.0 * (x - (w * w / (w + v) - r)));
      if (sign < 0)
       w = -w;
      return w;
    }
  if (iy == 1)
    return w;
  else
    {                       /* if allow error up to 2 ulp,
                               simply return -1.0/(x+r) here */
      /*  compute -1.0/(x+r) accurately */
      u1.value = w;
      u1.parts32.w2 = 0;
      u1.parts32.w3 = 0;
      v = r - (u1.value - x);             /* u1+v = r+x */
      z = -1.0 / w;
      u.value = z;
      u.parts32.w2 = 0;
      u.parts32.w3 = 0;
      s = 1.0 + u.value * u1.value;
      return u.value + z * (s + u.value * v);
    }
}

Here is the call graph for this function:


Variable Documentation

long double one = 1.0L [static]

Definition at line 66 of file k_tanl.c.

long double pio4hi = 7.8539816339744830961566084581987569936977E-1L [static]

Definition at line 67 of file k_tanl.c.

long double pio4lo = 2.1679525325309452561992610065108379921906E-35L [static]

Definition at line 68 of file k_tanl.c.

long double T0 = -1.813014711743583437742363284336855889393E7L [static]

Definition at line 74 of file k_tanl.c.

long double T1 = 1.320767960008972224312740075083259247618E6L [static]

Definition at line 75 of file k_tanl.c.

long double T2 = -2.626775478255838182468651821863299023956E4L [static]

Definition at line 76 of file k_tanl.c.

long double T3 = 1.764573356488504935415411383687150199315E2L [static]

Definition at line 77 of file k_tanl.c.

long double T4 = -3.333267763822178690794678978979803526092E-1L [static]

Definition at line 78 of file k_tanl.c.

long double TH = 3.333333333333333333333333333333333333333E-1L [static]

Definition at line 73 of file k_tanl.c.

long double U0 = -1.359761033807687578306772463253710042010E8L [static]

Definition at line 80 of file k_tanl.c.

long double U1 = 6.494370630656893175666729313065113194784E7L [static]

Definition at line 81 of file k_tanl.c.

long double U2 = -4.180787672237927475505536849168729386782E6L [static]

Definition at line 82 of file k_tanl.c.

long double U3 = 8.031643765106170040139966622980914621521E4L [static]

Definition at line 83 of file k_tanl.c.

long double U4 = -5.323131271912475695157127875560667378597E2L [static]

Definition at line 84 of file k_tanl.c.