49 #pragma clang diagnostic ignored "-Wunused-variable" 50 #pragma clang diagnostic ignored "-Wstrict-aliasing" 51 #elif defined(__GNUC__) && __GNUC__ > 2
52 #pragma GCC diagnostic ignored "-Wunused-but-set-variable" 53 #pragma GCC diagnostic ignored "-Wstrict-aliasing" 61 0.0, 5.84962487220764160156e-01,
64 0.0, 1.35003920212974897128e-08,
70 L1 = 5.99999999999994648725e-01,
71 L2 = 4.28571428578550184252e-01,
72 L3 = 3.33333329818377432918e-01,
73 L4 = 2.72728123808534006489e-01,
74 L5 = 2.30660745775561754067e-01,
75 L6 = 2.06975017800338417784e-01,
76 P1 = 1.66666666666666019037e-01,
77 P2 = -2.77777777770155933842e-03,
78 P3 = 6.61375632143793436117e-05,
79 P4 = -1.65339022054652515390e-06,
80 P5 = 4.13813679705723846039e-08,
81 lg2 = 6.93147180559945286227e-01,
82 lg2_h = 6.93147182464599609375e-01,
83 lg2_l = -1.90465429995776804525e-09,
84 ovt = 8.0085662595372944372e-0017,
85 cp = 9.61796693925975554329e-01,
86 cp_h = 9.61796700954437255859e-01,
87 cp_l = -7.02846165095275826516e-09,
88 ivln2 = 1.44269504088896338700e+00,
138 double pow(
double x,
double y)
140 double z, ax, z_h, z_l, p_h, p_l;
141 double y1, t1, t2, r, s, t, u, v, w;
142 int32_t i, j, k, yisint, n;
143 int32_t hx, hy, ix, iy;
148 ix = hx & 0x7fffffff;
149 iy = hy & 0x7fffffff;
156 if (ix > 0x7ff00000 || ((ix == 0x7ff00000) && (lx != 0)) ||
157 iy > 0x7ff00000 || ((iy == 0x7ff00000) && (ly != 0)))
168 if (iy >= 0x43400000)
170 else if (iy >= 0x3ff00000)
172 k = (iy >> 20) - 0x3ff;
176 if ((uint32_t)(j << (52 - k)) == ly)
177 yisint = 2 - (j & 1);
182 if ((j << (20 - k)) == iy)
183 yisint = 2 - (j & 1);
191 if (iy == 0x7ff00000)
193 if (((ix - 0x3ff00000) | lx) == 0)
195 else if (ix >= 0x3ff00000)
196 return (hy >= 0) ? y :
zero;
198 return (hy < 0) ? -y :
zero;
200 if (iy == 0x3ff00000)
207 if (hy == 0x40000000)
209 if (hy == 0x3fe00000)
220 if (ix == 0x7ff00000 || ix == 0 || ix == 0x3ff00000)
227 if (((ix - 0x3ff00000) | yisint) == 0)
229 z = (z - z) / (z - z);
231 else if (yisint == 1)
241 if ((n | yisint) == 0)
242 return (x - x) / (x - x);
245 if ((n | (yisint - 1)) == 0)
253 if (ix <= 0x3fefffff)
255 if (ix >= 0x3ff00000)
266 w = (t * t) * (0.5 - t * (0.3333333333333333333333 - t * 0.25));
275 double ss, s2, s_h, s_l, t_h, t_l;
284 n += ((ix) >> 20) - 0x3ff;
290 else if (j < 0xBB67A)
302 v =
one / (ax +
bp[k]);
308 SET_HIGH_WORD(t_h, ((ix >> 1) | 0x20000000) + 0x00080000 + (k << 18));
309 t_l = ax - (t_h -
bp[k]);
310 s_l = v * ((u - s_h * t_h) - s_h * t_l);
313 r = s2 * s2 * (
L1 + s2 * (
L2 + s2 * (
L3 + s2 * (
L4 + s2 * (
L5 + s2 *
L6)))));
314 r += s_l * (s_h + ss);
318 t_l = r - ((t_h - 3.0) - s2);
321 v = s_l * t_h + t_l * ss;
330 t1 = (((z_h + z_l) +
dp_h[k]) + t);
332 t2 = z_l - (((t1 - t) -
dp_h[k]) - z_h);
338 p_l = (y - y1) * t1 + y * t2;
344 if (((j - 0x40900000) | i) != 0)
348 if (p_l +
ovt > z - p_h)
352 else if ((j & 0x7fffffff) >= 0x4090cc00)
354 if (((j - 0xc090cc00) | i) != 0)
366 k = (i >> 20) - 0x3ff;
370 n = j + (0x00100000 >> (k + 1));
371 k = ((n & 0x7fffffff) >> 20) - 0x3ff;
374 n = ((n & 0x000fffff) | 0x00100000) >> (20 - k);
382 v = (p_l - (t - p_h)) *
lg2 + t *
lg2_l;
386 t1 = z - t * (
P1 + t * (
P2 + t * (
P3 + t * (
P4 + t *
P5))));
387 r = (z * t1) / (t1 -
two) - (w + z * w);
double sqrt(double x)
Square root function.
#define GET_HIGH_WORD(i, d)
Get the more significant 32 bit int from a double.
double scalbn(double x, int32_t n)
double pow(double x, double y)
Expontation function.
static const double lg2_h
static const double dp_h[]
static const double ivln2_h
static const double two53
#define EXTRACT_WORDS(ix0, ix1, d)
Get two 32 bit ints from a double.
static const double ivln2_l
static const double ivln2
static const double dp_l[]
double fabs(double x)
Returns the absolute value of x.
static const double lg2_l
#define SET_LOW_WORD(d, v)
Set the less significant 32 bits of a double from an int.
#define SET_HIGH_WORD(d, v)
Set the more significant 32 bits of a double from an int.