Lines 18-29
Link Here
|
18 |
|
18 |
|
19 |
static const float |
19 |
static const float |
20 |
one = 1.0000000000e+00, /* 0x3F800000 */ |
20 |
one = 1.0000000000e+00, /* 0x3F800000 */ |
21 |
huge = 1.000e+30, |
21 |
huge = 1.000e+30; |
22 |
/* coefficient for R(x^2) */ |
22 |
|
23 |
pS0 = 1.6666586697e-01, |
23 |
/* |
24 |
pS1 = -4.2743422091e-02, |
24 |
* The coefficients for the rational approximatione were generated over |
25 |
pS2 = -8.6563630030e-03, |
25 |
* 0x1p-12f <= x <= 0.5f. The maximum error satisfies log2(e) < -30.084. |
26 |
qS1 = -7.0662963390e-01; |
26 |
*/ |
|
|
27 |
static const float |
28 |
pS0 = 1.66666672e-01f, /* 0x3e2aaaab */ |
29 |
pS1 = -1.19510300e-01f, /* 0xbdf4c1d1 */ |
30 |
pS2 = 5.47002675e-03f, /* 0x3bb33de9 */ |
31 |
qS1 = -1.16706085e+00f, /* 0xbf956240 */ |
32 |
qS2 = 2.90115148e-01f; /* 0x3e9489f9 */ |
27 |
|
33 |
|
28 |
static const double |
34 |
static const double |
29 |
pio2 = 1.570796326794896558e+00; |
35 |
pio2 = 1.570796326794896558e+00; |
Lines 46-52
asinf(float x)
Link Here
|
46 |
} |
52 |
} |
47 |
t = x*x; |
53 |
t = x*x; |
48 |
p = t*(pS0+t*(pS1+t*pS2)); |
54 |
p = t*(pS0+t*(pS1+t*pS2)); |
49 |
q = one+t*qS1; |
55 |
q = one+t*(qS1+t*qS2); |
50 |
w = p/q; |
56 |
w = p/q; |
51 |
return x+x*w; |
57 |
return x+x*w; |
52 |
} |
58 |
} |
Lines 54-60
asinf(float x)
Link Here
|
54 |
w = one-fabsf(x); |
60 |
w = one-fabsf(x); |
55 |
t = w*(float)0.5; |
61 |
t = w*(float)0.5; |
56 |
p = t*(pS0+t*(pS1+t*pS2)); |
62 |
p = t*(pS0+t*(pS1+t*pS2)); |
57 |
q = one+t*qS1; |
63 |
q = one+t*(qS1+t*qS2); |
58 |
s = sqrt(t); |
64 |
s = sqrt(t); |
59 |
w = p/q; |
65 |
w = p/q; |
60 |
t = pio2-2.0*(s+s*w); |
66 |
t = pio2-2.0*(s+s*w); |