math_private.h File Reference
`#include "SDL_endian.h"`
Include dependency graph for math_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures

union | ieee_double_shape_type
union | ieee_float_shape_type

## Macros

#define | attribute_hidden
#define | libm_hidden_proto(x)
#define | libm_hidden_def(x)
#define | atan SDL_uclibc_atan
#define | __ieee754_atan2 SDL_uclibc_atan2
#define | copysign SDL_uclibc_copysign
#define | cos SDL_uclibc_cos
#define | fabs SDL_uclibc_fabs
#define | floor SDL_uclibc_floor
#define | __ieee754_log SDL_uclibc_log
#define | __ieee754_pow SDL_uclibc_pow
#define | scalbn SDL_uclibc_scalbn
#define | sin SDL_uclibc_sin
#define | __ieee754_sqrt SDL_uclibc_sqrt
#define | tan SDL_uclibc_tan
#define | EXTRACT_WORDS(ix0, ix1, d)
#define | GET_HIGH_WORD(i, d)
#define | GET_LOW_WORD(i, d)
#define | INSERT_WORDS(d, ix0, ix1)
#define | SET_HIGH_WORD(d, v)
#define | SET_LOW_WORD(d, v)
#define | GET_FLOAT_WORD(i, d)
#define | SET_FLOAT_WORD(d, i)

## Typedefs

typedef unsigned int | u_int32_t

## Functions

double | __ieee754_sqrt (double) attribute_hidden
double | __ieee754_acos (double) attribute_hidden
double | __ieee754_acosh (double) attribute_hidden
double | __ieee754_log (double) attribute_hidden
double | __ieee754_atanh (double) attribute_hidden
double | __ieee754_asin (double) attribute_hidden
double | __ieee754_atan2 (double, double) attribute_hidden
double | __ieee754_exp (double) attribute_hidden
double | __ieee754_cosh (double) attribute_hidden
double | __ieee754_fmod (double, double) attribute_hidden
double | __ieee754_pow (double, double) attribute_hidden
double | __ieee754_lgamma_r (double, int *) attribute_hidden
double | __ieee754_gamma_r (double, int *) attribute_hidden
double | __ieee754_lgamma (double) attribute_hidden
double | __ieee754_gamma (double) attribute_hidden
double | __ieee754_log10 (double) attribute_hidden
double | __ieee754_sinh (double) attribute_hidden
double | __ieee754_hypot (double, double) attribute_hidden
double | __ieee754_j0 (double) attribute_hidden
double | __ieee754_j1 (double) attribute_hidden
double | __ieee754_y0 (double) attribute_hidden
double | __ieee754_y1 (double) attribute_hidden
double | __ieee754_jn (int, double) attribute_hidden
double | __ieee754_yn (int, double) attribute_hidden
double | __ieee754_remainder (double, double) attribute_hidden
int | __ieee754_rem_pio2 (double, double *) attribute_hidden
double | __ieee754_scalb (double, double) attribute_hidden
double | __kernel_standard (double, double, int) attribute_hidden
double | __kernel_sin (double, double, int) attribute_hidden
double | __kernel_cos (double, double) attribute_hidden
double | __kernel_tan (double, double, int) attribute_hidden
int | __kernel_rem_pio2 (double *, double *, int, int, int, const int *) attribute_hidden

## Macro Definition Documentation

#define __ieee754_atan2 SDL_uclibc_atan2

Definition at line 33 of file math_private.h.

#define __ieee754_log SDL_uclibc_log

Definition at line 38 of file math_private.h.

#define __ieee754_pow SDL_uclibc_pow

Definition at line 39 of file math_private.h.

#define __ieee754_sqrt SDL_uclibc_sqrt

Definition at line 42 of file math_private.h.

Referenced by __ieee754_pow().

#define atan SDL_uclibc_atan

Definition at line 32 of file math_private.h.

#define attribute_hidden

Definition at line 24 of file math_private.h.

#define copysign SDL_uclibc_copysign

Definition at line 34 of file math_private.h.

Referenced by libm_hidden_proto(), and SDL_copysign().

#define cos SDL_uclibc_cos

Definition at line 35 of file math_private.h.

Referenced by libm_hidden_proto(), and SDL_cos().

#define EXTRACT_WORDS | ( |  | ix0,
|  |  | ix1,
|  |  | d
| ) |  |

Value:
do { \
ieee_double_shape_type ew_u; \
ew_u.value = (d); \
(ix0) = ew_u.parts.msw; \
(ix1) = ew_u.parts.lsw; \
} while (0)
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121

Definition at line 93 of file math_private.h.

Referenced by __ieee754_atan2(), __ieee754_log(), __ieee754_pow(), __ieee754_sqrt(), and libm_hidden_proto().

#define fabs SDL_uclibc_fabs

Definition at line 36 of file math_private.h.

Referenced by __ieee754_atan2(), __ieee754_pow(), __ieee754_rem_pio2(), __kernel_tan(), atan(), libm_hidden_proto(), and SDL_fabs().

#define floor SDL_uclibc_floor

Definition at line 37 of file math_private.h.

Referenced by __kernel_rem_pio2(), libm_hidden_proto(), and SDL_floor().

#define GET_FLOAT_WORD | ( |  | i,
|  |  | d
| ) |  |

Value:
do { \
ieee_float_shape_type gf_u; \
gf_u.value = (d); \
(i) = gf_u.word; \
} while (0)
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42

Definition at line 160 of file math_private.h.

#define GET_HIGH_WORD | ( |  | i,
|  |  | d
| ) |  |

Value:
do { \
ieee_double_shape_type gh_u; \
gh_u.value = (d); \
(i) = gh_u.parts.msw; \
} while (0)
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42

Definition at line 103 of file math_private.h.

Referenced by __ieee754_atan2(), __ieee754_log(), __ieee754_pow(), __ieee754_rem_pio2(), __kernel_cos(), __kernel_sin(), __kernel_tan(), atan(), libm_hidden_proto(), and tan().

#define GET_LOW_WORD | ( |  | i,
|  |  | d
| ) |  |

Value:
do { \
ieee_double_shape_type gl_u; \
gl_u.value = (d); \
(i) = gl_u.parts.lsw; \
} while (0)
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42

Definition at line 112 of file math_private.h.

Referenced by __ieee754_rem_pio2(), __kernel_tan(), and atan().

#define INSERT_WORDS | ( |  | d,
|  |  | ix0,
|  |  | ix1
| ) |  |

Value:
do { \
ieee_double_shape_type iw_u; \
iw_u.parts.msw = (ix0); \
iw_u.parts.lsw = (ix1); \
(d) = iw_u.value; \
} while (0)
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121

Definition at line 121 of file math_private.h.

Referenced by __ieee754_sqrt(), __kernel_cos(), and libm_hidden_proto().

#define libm_hidden_def | ( |  | x | ) |

Definition at line 26 of file math_private.h.

Referenced by atan(), libm_hidden_proto(), and tan().

#define libm_hidden_proto | ( |  | x | ) |

Definition at line 25 of file math_private.h.

#define scalbn SDL_uclibc_scalbn

Definition at line 40 of file math_private.h.

Referenced by __ieee754_pow(), __kernel_rem_pio2(), libm_hidden_proto(), and SDL_scalbn().

#define SET_FLOAT_WORD | ( |  | d,
|  |  | i
| ) |  |

Value:
do { \
ieee_float_shape_type sf_u; \
sf_u.word = (i); \
(d) = sf_u.value; \
} while (0)
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42

Definition at line 169 of file math_private.h.

#define SET_HIGH_WORD | ( |  | d,
|  |  | v
| ) |  |

Value:
do { \
ieee_double_shape_type sh_u; \
sh_u.value = (d); \
sh_u.parts.msw = (v); \
(d) = sh_u.value; \
} while (0)
v
const GLdouble * v
Definition: SDL_opengl.h:2057
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121

Definition at line 131 of file math_private.h.

Referenced by __ieee754_atan2(), __ieee754_log(), __ieee754_pow(), __ieee754_rem_pio2(), and libm_hidden_proto().

#define SET_LOW_WORD | ( |  | d,
|  |  | v
| ) |  |

Value:
do { \
ieee_double_shape_type sl_u; \
sl_u.value = (d); \
sl_u.parts.lsw = (v); \
(d) = sl_u.value; \
} while (0)
v
const GLdouble * v
Definition: SDL_opengl.h:2057
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:121

Definition at line 141 of file math_private.h.

Referenced by __ieee754_pow(), __ieee754_rem_pio2(), and __kernel_tan().

#define sin SDL_uclibc_sin

Definition at line 41 of file math_private.h.

Referenced by libm_hidden_proto(), and SDL_sin().

#define tan SDL_uclibc_tan

Definition at line 43 of file math_private.h.

## Typedef Documentation

typedef unsigned int u_int32_t

Definition at line 29 of file math_private.h.

## Function Documentation

double __ieee754_acos | ( | double |  | ) |

double __ieee754_acosh | ( | double |  | ) |

double __ieee754_asin | ( | double |  | ) |

double __ieee754_atan2 | ( | double | ,
|  | double |
| ) |  |

Definition at line 50 of file e_atan2.c.

References atan(), EXTRACT_WORDS, fabs, GET_HIGH_WORD, pi, pi_lo, pi_o_2, pi_o_4, SET_HIGH_WORD, tiny, and zero.

{
double z;
int32_t k,m,hx,hy,ix,iy;
u_int32_t lx,ly;
EXTRACT_WORDS(hx,lx,x);
ix = hx&0x7fffffff;
EXTRACT_WORDS(hy,ly,y);
iy = hy&0x7fffffff;
if(((ix|((lx|-(int32_t)lx)>>31))>0x7ff00000)||
((iy|((ly|-(int32_t)ly)>>31))>0x7ff00000)) /* x or y is NaN */
return x+y;
if(((hx-0x3ff00000)|lx)==0) return atan(y); /* x=1.0 */
m = ((hy>>31)&1)|((hx>>30)&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==0x7ff00000) {
if(iy==0x7ff00000) {
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.0*pi_o_4+tiny;/* atan(+INF,-INF) */
case 3: return -3.0*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==0x7ff00000) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny;
/* compute y/x */
k = (iy-ix)>>20;
if(k > 60) z=pi_o_2+0.5*pi_lo; /* |y/x| > 2**60 */
else if(hx<0&&k<-60) z=0.0; /* |y|/x < -2**60 */
else z=atan(fabs(y/x)); /* safe to do y/x */
switch (m) {
case 0: return z ; /* atan(+,+) */
case 1: {
u_int32_t zh;
GET_HIGH_WORD(zh,z);
SET_HIGH_WORD(z,zh ^ 0x80000000);
}
return z ; /* atan(-,+) */
case 2: return pi-(z-pi_lo);/* atan(+,-) */
default: /* case 3 */
return (z-pi_lo)-pi;/* atan(-,-) */
}
}
GET_HIGH_WORD
#define GET_HIGH_WORD(i, d)
Definition: math_private.h:103
pi
static const double pi
Definition: e_atan2.c:47
tiny
static const double tiny
Definition: e_atan2.c:43
int32_t
signed int int32_t
Definition: SDL_config_windows.h:61
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
m
const GLfloat * m
Definition: SDL_opengl_glext.h:6092
pi_o_4
static const double pi_o_4
Definition: e_atan2.c:45
SET_HIGH_WORD
#define SET_HIGH_WORD(d, v)
Definition: math_private.h:131
pi_lo
static const double pi_lo
Definition: e_atan2.c:48
zero
static const double zero
Definition: e_atan2.c:44
u_int32_t
unsigned int u_int32_t
Definition: math_private.h:29
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
EXTRACT_WORDS
#define EXTRACT_WORDS(ix0, ix1, d)
Definition: math_private.h:93
pi_o_2
static const double pi_o_2
Definition: e_atan2.c:46
fabs
#define fabs
Definition: math_private.h:36
z
GLdouble GLdouble z
Definition: SDL_opengl_glext.h:404
atan
double atan(double x)
Definition: s_atan.c:67

double __ieee754_atanh | ( | double |  | ) |

double __ieee754_cosh | ( | double |  | ) |

double __ieee754_exp | ( | double |  | ) |

double __ieee754_fmod | ( | double | ,
|  | double |
| ) |  |

double __ieee754_gamma | ( | double |  | ) |

double __ieee754_gamma_r | ( | double | ,
|  | int * |
| ) |  |

double __ieee754_hypot | ( | double | ,
|  | double |
| ) |  |

double __ieee754_j0 | ( | double |  | ) |

double __ieee754_j1 | ( | double |  | ) |

double __ieee754_jn | ( | int | ,
|  | double |
| ) |  |

double __ieee754_lgamma | ( | double |  | ) |

double __ieee754_lgamma_r | ( | double | ,
|  | int * |
| ) |  |

double __ieee754_log | ( | double |  | ) |

Definition at line 99 of file e_log.c.

References EXTRACT_WORDS, GET_HIGH_WORD, i, j, Lg1, Lg2, Lg3, Lg4, Lg5, Lg6, Lg7, ln2_hi, ln2_lo, SET_HIGH_WORD, two54, and zero.

{
double hfsq, f, s, z, R, w, t1, t2, dk;
int32_t k, hx, i, j;
u_int32_t lx;
EXTRACT_WORDS(hx, lx, x);
k = 0;
if (hx < 0x00100000) { /* x < 2**-1022 */
if (((hx & 0x7fffffff) | lx) == 0)
return -two54 / zero; /* log(+-0)=-inf */
if (hx < 0)
return (x - x) / zero; /* log(-#) = NaN */
k -= 54;
x *= two54; /* subnormal number, scale up x */
GET_HIGH_WORD(hx, x);
}
if (hx >= 0x7ff00000)
return x + x;
k += (hx >> 20) - 1023;
hx &= 0x000fffff;
i = (hx + 0x95f64) & 0x100000;
SET_HIGH_WORD(x, hx | (i ^ 0x3ff00000)); /* normalize x or x/2 */
k += (i >> 20);
f = x - 1.0;
if ((0x000fffff & (2 + hx)) < 3) { /* |f| < 2**-20 */
if (f == zero) {
if (k == 0)
return zero;
else {
dk = (double) k;
return dk * ln2_hi + dk * ln2_lo;
}
}
R = f * f * (0.5 - 0.33333333333333333 * f);
if (k == 0)
return f - R;
else {
dk = (double) k;
return dk * ln2_hi - ((R - dk * ln2_lo) - f);
}
}
s = f / (2.0 + f);
dk = (double) k;
z = s * s;
i = hx - 0x6147a;
w = z * z;
j = 0x6b851 - hx;
t1 = w * (Lg2 + w * (Lg4 + w * Lg6));
t2 = z * (Lg1 + w * (Lg3 + w * (Lg5 + w * Lg7)));
i |= j;
R = t2 + t1;
if (i > 0) {
hfsq = 0.5 * f * f;
if (k == 0)
return f - (hfsq - s * (hfsq + R));
else
return dk * ln2_hi - ((hfsq - (s * (hfsq + R) + dk * ln2_lo)) -
f);
} else {
if (k == 0)
return f - s * (f - R);
else
return dk * ln2_hi - ((s * (f - R) - dk * ln2_lo) - f);
}
}
GET_HIGH_WORD
#define GET_HIGH_WORD(i, d)
Definition: math_private.h:103
zero
static double zero
Definition: e_log.c:91
s
GLdouble s
Definition: SDL_opengl.h:2056
int32_t
signed int int32_t
Definition: SDL_config_windows.h:61
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
Lg1
static double Lg1
Definition: e_log.c:80
ln2_lo
static double ln2_lo
Definition: e_log.c:78
f
GLfloat f
Definition: SDL_opengl_glext.h:1870
Lg6
static double Lg6
Definition: e_log.c:85
SET_HIGH_WORD
#define SET_HIGH_WORD(d, v)
Definition: math_private.h:131
t1
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
Definition: SDL_opengl_glext.h:8583
u_int32_t
unsigned int u_int32_t
Definition: math_private.h:29
EXTRACT_WORDS
#define EXTRACT_WORDS(ix0, ix1, d)
Definition: math_private.h:93
Lg5
static double Lg5
Definition: e_log.c:84
Lg4
static double Lg4
Definition: e_log.c:83
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
z
GLdouble GLdouble z
Definition: SDL_opengl_glext.h:404
Lg3
static double Lg3
Definition: e_log.c:82
Lg7
static double Lg7
Definition: e_log.c:86
two54
static double two54
Definition: e_log.c:79
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:731
Lg2
static double Lg2
Definition: e_log.c:81
ln2_hi
static double ln2_hi
Definition: e_log.c:77
j
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
Definition: SDL_x11sym.h:42

double __ieee754_log10 | ( | double |  | ) |

double __ieee754_pow | ( | double | ,
|  | double |
| ) |  |

Definition at line 106 of file e_pow.c.

References __ieee754_sqrt, cp, cp_h, cp_l, dp_h, dp_l, EXTRACT_WORDS, fabs, GET_HIGH_WORD, huge_val, i, ivln2, ivln2_h, ivln2_l, j, L1, L2, L3, L4, L5, L6, lg2, lg2_h, lg2_l, one, ovt, P1, P2, P3, P4, P5, scalbn, SET_HIGH_WORD, SET_LOW_WORD, tiny, two, two53, and zero.

{
double z, ax, z_h, z_l, p_h, p_l;
double y1, t1, t2, r, s, t, u, v, w;
int32_t i, j, k, yisint, n;
int32_t hx, hy, ix, iy;
u_int32_t lx, ly;
EXTRACT_WORDS(hx, lx, x);
EXTRACT_WORDS(hy, ly, y);
ix = hx & 0x7fffffff;
iy = hy & 0x7fffffff;
/* y==zero: x**0 = 1 */
if ((iy | ly) == 0)
return one;
/* +-NaN return x+y */
if (ix > 0x7ff00000 || ((ix == 0x7ff00000) && (lx != 0)) ||
iy > 0x7ff00000 || ((iy == 0x7ff00000) && (ly != 0)))
return x + y;
/* determine if y is an odd int when x < 0
* yisint = 0 ... y is not an integer
* yisint = 1 ... y is an odd int
* yisint = 2 ... y is an even int
*/
yisint = 0;
if (hx < 0) {
if (iy >= 0x43400000)
yisint = 2; /* even integer y */
else if (iy >= 0x3ff00000) {
k = (iy >> 20) - 0x3ff; /* exponent */
if (k > 20) {
j = ly >> (52 - k);
if ((j << (52 - k)) == ly)
yisint = 2 - (j & 1);
} else if (ly == 0) {
j = iy >> (20 - k);
if ((j << (20 - k)) == iy)
yisint = 2 - (j & 1);
}
}
}
/* special value of y */
if (ly == 0) {
if (iy == 0x7ff00000) { /* y is +-inf */
if (((ix - 0x3ff00000) | lx) == 0)
return y - y; /* inf**+-1 is NaN */
else if (ix >= 0x3ff00000) /* (|x|>1)**+-inf = inf,0 */
return (hy >= 0) ? y : zero;
else /* (|x|<1)**-,+inf = inf,0 */
return (hy < 0) ? -y : zero;
}
if (iy == 0x3ff00000) { /* y is +-1 */
if (hy < 0)
return one / x;
else
return x;
}
if (hy == 0x40000000)
return x * x; /* y is 2 */
if (hy == 0x3fe00000) { /* y is 0.5 */
if (hx >= 0) /* x >= +0 */
return __ieee754_sqrt(x);
}
}
ax = fabs(x);
/* special value of x */
if (lx == 0) {
if (ix == 0x7ff00000 || ix == 0 || ix == 0x3ff00000) {
z = ax; /* x is +-0,+-inf,+-1 */
if (hy < 0)
z = one / z; /* z = (1/|x|) */
if (hx < 0) {
if (((ix - 0x3ff00000) | yisint) == 0) {
z = (z - z) / (z - z); /* (-1)**non-int is NaN */
} else if (yisint == 1)
z = -z; /* (x<0)**odd = -(|x|**odd) */
}
return z;
}
}
/* (x<0)**(non-int) is NaN */
if (((((u_int32_t) hx >> 31) - 1) | yisint) == 0)
return (x - x) / (x - x);
/* |y| is huge */
if (iy > 0x41e00000) { /* if |y| > 2**31 */
if (iy > 0x43f00000) { /* if |y| > 2**64, must o/uflow */
if (ix <= 0x3fefffff)
return (hy < 0) ? huge_val * huge_val : tiny * tiny;
if (ix >= 0x3ff00000)
return (hy > 0) ? huge_val * huge_val : tiny * tiny;
}
/* over/underflow if x is not close to one */
if (ix < 0x3fefffff)
return (hy < 0) ? huge_val * huge_val : tiny * tiny;
if (ix > 0x3ff00000)
return (hy > 0) ? huge_val * huge_val : tiny * tiny;
/* now |1-x| is tiny <= 2**-20, suffice to compute
log(x) by x-x^2/2+x^3/3-x^4/4 */
t = x - 1; /* t has 20 trailing zeros */
w = (t * t) * (0.5 - t * (0.3333333333333333333333 - t * 0.25));
u = ivln2_h * t; /* ivln2_h has 21 sig. bits */
v = t * ivln2_l - w * ivln2;
t1 = u + v;
SET_LOW_WORD(t1, 0);
t2 = v - (t1 - u);
} else {
double s2, s_h, s_l, t_h, t_l;
n = 0;
/* take care subnormal number */
if (ix < 0x00100000) {
ax *= two53;
n -= 53;
GET_HIGH_WORD(ix, ax);
}
n += ((ix) >> 20) - 0x3ff;
j = ix & 0x000fffff;
/* determine interval */
ix = j | 0x3ff00000; /* normalize ix */
if (j <= 0x3988E)
k = 0; /* |x|<sqrt(3/2) */
else if (j < 0xBB67A)
k = 1; /* |x|<sqrt(3) */
else {
k = 0;
n += 1;
ix -= 0x00100000;
}
SET_HIGH_WORD(ax, ix);
/* compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5) */
u = ax - bp[k]; /* bp[0]=1.0, bp[1]=1.5 */
v = one / (ax + bp[k]);
s = u * v;
s_h = s;
SET_LOW_WORD(s_h, 0);
/* t_h=ax+bp[k] High */
t_h = zero;
SET_HIGH_WORD(t_h,
((ix >> 1) | 0x20000000) + 0x00080000 + (k << 18));
t_l = ax - (t_h - bp[k]);
s_l = v * ((u - s_h * t_h) - s_h * t_l);
/* compute log(ax) */
s2 = s * s;
r = s2 * s2 * (L1 +
s2 * (L2 +
s2 * (L3 +
s2 * (L4 + s2 * (L5 + s2 * L6)))));
r += s_l * (s_h + s);
s2 = s_h * s_h;
t_h = 3.0 + s2 + r;
SET_LOW_WORD(t_h, 0);
t_l = r - ((t_h - 3.0) - s2);
/* u+v = s*(1+...) */
u = s_h * t_h;
v = s_l * t_h + t_l * s;
/* 2/(3log2)*(s+...) */
p_h = u + v;
SET_LOW_WORD(p_h, 0);
p_l = v - (p_h - u);
z_h = cp_h * p_h; /* cp_h+cp_l = 2/(3*log2) */
z_l = cp_l * p_h + p_l * cp + dp_l[k];
/* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */
t = (double) n;
t1 = (((z_h + z_l) + dp_h[k]) + t);
SET_LOW_WORD(t1, 0);
t2 = z_l - (((t1 - t) - dp_h[k]) - z_h);
}
s = one; /* s (sign of result -ve**odd) = -1 else = 1 */
if (((((u_int32_t) hx >> 31) - 1) | (yisint - 1)) == 0)
s = -one; /* (-ve)**(odd int) */
/* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */
y1 = y;
SET_LOW_WORD(y1, 0);
p_l = (y - y1) * t1 + y * t2;
p_h = y1 * t1;
z = p_l + p_h;
EXTRACT_WORDS(j, i, z);
if (j >= 0x40900000) { /* z >= 1024 */
if (((j - 0x40900000) | i) != 0) /* if z > 1024 */
return s * huge_val * huge_val; /* overflow */
else {
if (p_l + ovt > z - p_h)
return s * huge_val * huge_val; /* overflow */
}
} else if ((j & 0x7fffffff) >= 0x4090cc00) { /* z <= -1075 */
if (((j - 0xc090cc00) | i) != 0) /* z < -1075 */
return s * tiny * tiny; /* underflow */
else {
if (p_l <= z - p_h)
return s * tiny * tiny; /* underflow */
}
}
/*
* compute 2**(p_h+p_l)
*/
i = j & 0x7fffffff;
k = (i >> 20) - 0x3ff;
n = 0;
if (i > 0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */
n = j + (0x00100000 >> (k + 1));
k = ((n & 0x7fffffff) >> 20) - 0x3ff; /* new k for n */
t = zero;
SET_HIGH_WORD(t, n & ~(0x000fffff >> k));
n = ((n & 0x000fffff) | 0x00100000) >> (20 - k);
if (j < 0)
n = -n;
p_h -= t;
}
t = p_l + p_h;
SET_LOW_WORD(t, 0);
u = t * lg2_h;
v = (p_l - (t - p_h)) * lg2 + t * lg2_l;
z = u + v;
w = v - (z - u);
t = z * z;
t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5))));
r = (z * t1) / (t1 - two) - (w + z * w);
z = one - (r - z);
GET_HIGH_WORD(j, z);
j += (n << 20);
if ((j >> 20) <= 0)
z = scalbn(z, n); /* subnormal output */
else
SET_HIGH_WORD(z, j);
return s * z;
}
GET_HIGH_WORD
#define GET_HIGH_WORD(i, d)
Definition: math_private.h:103
ovt
ovt
Definition: e_pow.c:95
one
one
Definition: e_pow.c:78
r
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
s
GLdouble s
Definition: SDL_opengl.h:2056
ivln2_l
ivln2_l
Definition: e_pow.c:101
n
GLdouble n
Definition: SDL_opengl_glext.h:1952
int32_t
signed int int32_t
Definition: SDL_config_windows.h:61
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
tiny
tiny
Definition: e_pow.c:79
two
two
Definition: e_pow.c:78
cp_l
cp_l
Definition: e_pow.c:98
P3
P3
Definition: e_pow.c:89
__ieee754_sqrt
#define __ieee754_sqrt
Definition: math_private.h:42
lg2
lg2
Definition: e_pow.c:92
SET_HIGH_WORD
#define SET_HIGH_WORD(d, v)
Definition: math_private.h:131
t1
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
Definition: SDL_opengl_glext.h:8583
scalbn
#define scalbn
Definition: math_private.h:40
y1
GLfixed y1
Definition: SDL_opengl_glext.h:4583
v
const GLdouble * v
Definition: SDL_opengl.h:2057
P2
P2
Definition: e_pow.c:88
dp_l
dp_l[]
Definition: e_pow.c:75
u_int32_t
unsigned int u_int32_t
Definition: math_private.h:29
ivln2
ivln2
Definition: e_pow.c:99
cp
cp
Definition: e_pow.c:96
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
SET_LOW_WORD
#define SET_LOW_WORD(d, v)
Definition: math_private.h:141
EXTRACT_WORDS
#define EXTRACT_WORDS(ix0, ix1, d)
Definition: math_private.h:93
L3
L3
Definition: e_pow.c:83
P5
P5
Definition: e_pow.c:91
lg2_h
lg2_h
Definition: e_pow.c:93
P4
P4
Definition: e_pow.c:90
fabs
#define fabs
Definition: math_private.h:36
L6
L6
Definition: e_pow.c:86
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
ivln2_h
ivln2_h
Definition: e_pow.c:100
z
GLdouble GLdouble z
Definition: SDL_opengl_glext.h:404
L5
L5
Definition: e_pow.c:85
lg2_l
lg2_l
Definition: e_pow.c:94
P1
P1
Definition: e_pow.c:87
dp_h
dp_h[]
Definition: e_pow.c:72
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:731
cp_h
cp_h
Definition: e_pow.c:97
huge_val
huge_val
Definition: e_pow.c:79
L4
L4
Definition: e_pow.c:84
zero
zero
Definition: e_pow.c:78
L1
L1
Definition: e_pow.c:81
t
GLdouble GLdouble t
Definition: SDL_opengl.h:2064
L2
L2
Definition: e_pow.c:82
two53
two53
Definition: e_pow.c:78
j
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
Definition: SDL_x11sym.h:42

int __ieee754_rem_pio2 | ( | double | ,
|  | double * |
| ) |  |

double __ieee754_remainder | ( | double | ,
|  | double |
| ) |  |

double __ieee754_scalb | ( | double | ,
|  | double |
| ) |  |

double __ieee754_sinh | ( | double |  | ) |

double __ieee754_sqrt | ( | double |  | ) |

Definition at line 102 of file e_sqrt.c.

References EXTRACT_WORDS, i, INSERT_WORDS, one, and tiny.

{
double z;
int32_t sign = (int) 0x80000000;
int32_t ix0, s0, q, m, t, i;
u_int32_t r, t1, s1, ix1, q1;
EXTRACT_WORDS(ix0, ix1, x);
/* take care of Inf and NaN */
if ((ix0 & 0x7ff00000) == 0x7ff00000) {
return x * x + x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf
sqrt(-inf)=sNaN */
}
/* take care of zero */
if (ix0 <= 0) {
if (((ix0 & (~sign)) | ix1) == 0)
return x; /* sqrt(+-0) = +-0 */
else if (ix0 < 0)
return (x - x) / (x - x); /* sqrt(-ve) = sNaN */
}
/* normalize x */
m = (ix0 >> 20);
if (m == 0) { /* subnormal x */
while (ix0 == 0) {
m -= 21;
ix0 |= (ix1 >> 11);
ix1 <<= 21;
}
for (i = 0; (ix0 & 0x00100000) == 0; i++)
ix0 <<= 1;
m -= i - 1;
ix0 |= (ix1 >> (32 - i));
ix1 <<= i;
}
m -= 1023; /* unbias exponent */
ix0 = (ix0 & 0x000fffff) | 0x00100000;
if (m & 1) { /* odd m, double x to make it even */
ix0 += ix0 + ((ix1 & sign) >> 31);
ix1 += ix1;
}
m >>= 1; /* m = [m/2] */
/* generate sqrt(x) bit by bit */
ix0 += ix0 + ((ix1 & sign) >> 31);
ix1 += ix1;
q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */
r = 0x00200000; /* r = moving bit from right to left */
while (r != 0) {
t = s0 + r;
if (t <= ix0) {
s0 = t + r;
ix0 -= t;
q += r;
}
ix0 += ix0 + ((ix1 & sign) >> 31);
ix1 += ix1;
r >>= 1;
}
r = sign;
while (r != 0) {
t1 = s1 + r;
t = s0;
if ((t < ix0) || ((t == ix0) && (t1 <= ix1))) {
s1 = t1 + r;
if (((t1 & sign) == sign) && (s1 & sign) == 0)
s0 += 1;
ix0 -= t;
if (ix1 < t1)
ix0 -= 1;
ix1 -= t1;
q1 += r;
}
ix0 += ix0 + ((ix1 & sign) >> 31);
ix1 += ix1;
r >>= 1;
}
/* use floating add to find out rounding direction */
if ((ix0 | ix1) != 0) {
z = one - tiny; /* trigger inexact flag */
if (z >= one) {
z = one + tiny;
if (q1 == (u_int32_t) 0xffffffff) {
q1 = 0;
q += 1;
} else if (z > one) {
if (q1 == (u_int32_t) 0xfffffffe)
q += 1;
q1 += 2;
} else
q1 += (q1 & 1);
}
}
ix0 = (q >> 1) + 0x3fe00000;
ix1 = q1 >> 1;
if ((q & 1) == 1)
ix1 |= sign;
ix0 += (m << 20);
INSERT_WORDS(z, ix0, ix1);
return z;
}
r
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
int32_t
signed int int32_t
Definition: SDL_config_windows.h:61
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
q
GLdouble GLdouble GLdouble GLdouble q
Definition: SDL_opengl.h:2080
m
const GLfloat * m
Definition: SDL_opengl_glext.h:6092
t1
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat t1
Definition: SDL_opengl_glext.h:8583
u_int32_t
unsigned int u_int32_t
Definition: math_private.h:29
EXTRACT_WORDS
#define EXTRACT_WORDS(ix0, ix1, d)
Definition: math_private.h:93
INSERT_WORDS
#define INSERT_WORDS(d, ix0, ix1)
Definition: math_private.h:121
s1
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
Definition: SDL_opengl_glext.h:8583
s0
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s0
Definition: SDL_opengl_glext.h:8583
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:42
z
GLdouble GLdouble z
Definition: SDL_opengl_glext.h:404
tiny
static double tiny
Definition: e_sqrt.c:94
t
GLdouble GLdouble t
Definition: SDL_opengl.h:2064
one
static double one
Definition: e_sqrt.c:94

double __ieee754_y0 | ( | double |  | ) |

double __ieee754_y1 | ( | double |  | ) |

double __ieee754_yn | ( | int | ,
|  | double |
| ) |  |

double __kernel_cos | ( | double | ,
|  | double |
| ) |  |

Definition at line 74 of file k_cos.c.

References C1, C2, C3, C4, C5, C6, GET_HIGH_WORD, INSERT_WORDS, and one.

Referenced by libm_hidden_proto().

{
double a, hz, z, r, qx;
int32_t ix;
GET_HIGH_WORD(ix, x);
ix &= 0x7fffffff; /* ix = |x|'s high word */
if (ix < 0x3e400000) { /* if x < 2**27 */
if (((int) x) == 0)
return one; /* generate inexact */
}
z = x * x;
r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * C6)))));
if (ix < 0x3FD33333) /* if |x| < 0.3 */
return one - (0.5 * z - (z * r - x * y));
else {
if (ix > 0x3fe90000) { /* x > 0.78125 */
qx = 0.28125;
} else {
INSERT_WORDS(qx, ix - 0x00200000, 0); /* x/4 */
}
hz = 0.5 * z - qx;
a = one - qx;
return a - (hz - (z * r - x * y));
}
}
GET_HIGH_WORD
#define GET_HIGH_WORD(i, d)
Definition: math_private.h:103
r
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
int32_t
signed int int32_t
Definition: SDL_config_windows.h:61
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
one
static double one
Definition: k_cos.c:61
C2
static double C2
Definition: k_cos.c:63
C5
static double C5
Definition: k_cos.c:66
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
C4
static double C4
Definition: k_cos.c:65
INSERT_WORDS
#define INSERT_WORDS(d, ix0, ix1)
Definition: math_private.h:121
C3
static double C3
Definition: k_cos.c:64
C6
static double C6
Definition: k_cos.c:67
z
GLdouble GLdouble z
Definition: SDL_opengl_glext.h:404
C1
static double C1
Definition: k_cos.c:62
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109

int __kernel_rem_pio2 | ( | double * | ,
|  | double * | ,
|  | int | ,
|  | int | ,
|  | int | ,
|  | const int * |
| ) |  |

double __kernel_sin | ( | double | ,
|  | double | ,
|  | int |
| ) |  |

Definition at line 67 of file k_sin.c.

References GET_HIGH_WORD, half, S1, S2, S3, S4, S5, and S6.

Referenced by libm_hidden_proto().

{
double z, r, v;
int32_t ix;
GET_HIGH_WORD(ix, x);
ix &= 0x7fffffff; /* high word of x */
if (ix < 0x3e400000) { /* |x| < 2**-27 */
if ((int) x == 0)
return x;
} /* generate inexact */
z = x * x;
v = z * x;
r = S2 + z * (S3 + z * (S4 + z * (S5 + z * S6)));
if (iy == 0)
return x + v * (S1 + z * r);
else
return x - ((z * (half * y - v * r) - y) - v * S1);
}
GET_HIGH_WORD
#define GET_HIGH_WORD(i, d)
Definition: math_private.h:103
r
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
S3
static double S3
Definition: k_sin.c:57
int32_t
signed int int32_t
Definition: SDL_config_windows.h:61
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
S1
static double S1
Definition: k_sin.c:55
v
const GLdouble * v
Definition: SDL_opengl.h:2057
S4
static double S4
Definition: k_sin.c:58
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
S6
static double S6
Definition: k_sin.c:60
z
GLdouble GLdouble z
Definition: SDL_opengl_glext.h:404
half
static double half
Definition: k_sin.c:54
S5
static double S5
Definition: k_sin.c:59
S2
static double S2
Definition: k_sin.c:56

double __kernel_standard | ( | double | ,
|  | double | ,
|  | int |
| ) |  |

double __kernel_tan | ( | double | ,
|  | double | ,
|  | int |
| ) |  |

Definition at line 69 of file k_tan.c.

References fabs, GET_HIGH_WORD, GET_LOW_WORD, one, pio4, pio4lo, SET_LOW_WORD, and T.

Referenced by tan().

{
double z,r,v,w,s;
int32_t ix,hx;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff; /* high word of |x| */
if(ix<0x3e300000) /* x < 2**-28 */
{if((int)x==0) { /* generate inexact */
u_int32_t low;
GET_LOW_WORD(low,x);
if(((ix|low)|(iy+1))==0) return one/fabs(x);
else return (iy==1)? x: -one/x;
}
}
if(ix>=0x3FE59428) { /* |x|>=0.6744 */
if(hx<0) {x = -x; y = -y;}
z = pio4-x;
w = pio4lo-y;
x = z+w; y = 0.0;
}
z = x*x;
w = z*z;
/* Break x^5*(T[1]+x^2*T[2]+...) into
* x^5(T[1]+x^4*T[3]+...+x^20*T[11]) +
* x^5(x^2*(T[2]+x^4*T[4]+...+x^22*[T12]))
*/
r = T[1]+w*(T[3]+w*(T[5]+w*(T[7]+w*(T[9]+w*T[11]))));
v = z*(T[2]+w*(T[4]+w*(T[6]+w*(T[8]+w*(T[10]+w*T[12])))));
s = z*x;
r = y + z*(s*(r+v)+y);
r += T[0]*s;
w = x+r;
if(ix>=0x3FE59428) {
v = (double)iy;
return (double)(1-((hx>>30)&2))*(v-2.0*(x-(w*w/(w+v)-r)));
}
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 */
double a,t;
z = w;
SET_LOW_WORD(z,0);
v = r-(z - x); /* z+v = r+x */
t = a = -1.0/w; /* a = -1.0/w */
SET_LOW_WORD(t,0);
s = 1.0+t*z;
return t+a*(s+t*v);
}
}
GET_HIGH_WORD
#define GET_HIGH_WORD(i, d)
Definition: math_private.h:103
r
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2072
s
GLdouble s
Definition: SDL_opengl.h:2056
pio4lo
static const double pio4lo
Definition: k_tan.c:52
int32_t
signed int int32_t
Definition: SDL_config_windows.h:61
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
T
static const double T[]
Definition: k_tan.c:53
v
const GLdouble * v
Definition: SDL_opengl.h:2057
u_int32_t
unsigned int u_int32_t
Definition: math_private.h:29
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
SET_LOW_WORD
#define SET_LOW_WORD(d, v)
Definition: math_private.h:141
fabs
#define fabs
Definition: math_private.h:36
z
GLdouble GLdouble z
Definition: SDL_opengl_glext.h:404
GET_LOW_WORD
#define GET_LOW_WORD(i, d)
Definition: math_private.h:112
pio4
static const double pio4
Definition: k_tan.c:51
w
GLubyte GLubyte GLubyte GLubyte w
Definition: SDL_opengl_glext.h:731
one
static const double one
Definition: k_tan.c:50
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1109
t
GLdouble GLdouble t
Definition: SDL_opengl.h:2064