2 /* @(#)z_asinef.c 1.0 98/08/13 */
3 /******************************************************************
4 * The following routines are coded directly from the algorithms
5 * and coefficients given in "Software Manual for the Elementary
6 * Functions" by William J. Cody, Jr. and William Waite, Prentice
8 ******************************************************************/
9 /******************************************************************
13 * x - floating point value
14 * acosine - indicates acos calculation
20 * This routine calculates arcsine / arccosine.
22 *****************************************************************/
27 static const float p
[] = { 0.933935835, -0.504400557 };
28 static const float q
[] = { 0.560363004e+1, -0.554846723e+1 };
29 static const float a
[] = { 0.0, 0.785398163 };
30 static const float b
[] = { 1.570796326, 0.785398163 };
38 float g
, res
, R
, P
, Q
, y
;
40 /* Check for special values. */
42 if (i
== NAN
|| i
== INF
)
48 return (z_infinity_f
.f
);
58 /* Check for range error. */
62 return (z_notanum_f
.f
);
78 if (y
>= z_rooteps_f
|| branch
== 1)
80 /* Calculate the Taylor series. */
81 P
= (p
[1] * g
+ p
[0]) * g
;
82 Q
= (g
+ q
[1]) * g
+ q
[0];
88 /* Calculate asine or acose. */
91 res
= (a
[i
] + res
) + a
[i
];
98 res
= (b
[i
] + res
) + b
[i
];
100 res
= (a
[i
] - res
) + a
[i
];