1 /* e_asinf.c -- float version of e_asin.c.
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
9 * Developed at SunPro, a Sun Microsystems, Inc. business.
10 * Permission to use, copy, modify, and distribute this
11 * software is freely granted, provided that this notice
13 * ====================================================
17 static char rcsid
[] = "$FreeBSD: src/lib/msun/src/e_asinf.c,v 1.9 2005/12/04 13:52:46 bde Exp $";
21 #include "math_private.h"
24 one
= 1.0000000000e+00, /* 0x3F800000 */
26 pio2_hi
= 1.5707962513e+00, /* 0x3fc90fda */
27 pio2_lo
= 7.5497894159e-08, /* 0x33a22168 */
28 pio4_hi
= 7.8539812565e-01, /* 0x3f490fda */
29 /* coefficient for R(x^2) */
30 pS0
= 1.6666667163e-01, /* 0x3e2aaaab */
31 pS1
= -3.2556581497e-01, /* 0xbea6b090 */
32 pS2
= 2.0121252537e-01, /* 0x3e4e0aa8 */
33 pS3
= -4.0055535734e-02, /* 0xbd241146 */
34 pS4
= 7.9153501429e-04, /* 0x3a4f7f04 */
35 pS5
= 3.4793309169e-05, /* 0x3811ef08 */
36 qS1
= -2.4033949375e+00, /* 0xc019d139 */
37 qS2
= 2.0209457874e+00, /* 0x4001572d */
38 qS3
= -6.8828397989e-01, /* 0xbf303361 */
39 qS4
= 7.7038154006e-02; /* 0x3d9dc62e */
42 __ieee754_asinf(float x
)
44 float t
=0.0,w
,p
,q
,c
,r
,s
;
49 /* asin(1)=+-pi/2 with inexact */
50 return x
*pio2_hi
+x
*pio2_lo
;
51 } else if(ix
> 0x3f800000) { /* |x|>= 1 */
52 return (x
-x
)/(x
-x
); /* asin(|x|>1) is NaN */
53 } else if (ix
<0x3f000000) { /* |x|<0.5 */
54 if(ix
<0x32000000) { /* if |x| < 2**-27 */
55 if(huge
+x
>one
) return x
;/* return x with inexact if x!=0*/
58 p
= t
*(pS0
+t
*(pS1
+t
*(pS2
+t
*(pS3
+t
*(pS4
+t
*pS5
)))));
59 q
= one
+t
*(qS1
+t
*(qS2
+t
*(qS3
+t
*qS4
)));
66 p
= t
*(pS0
+t
*(pS1
+t
*(pS2
+t
*(pS3
+t
*(pS4
+t
*pS5
)))));
67 q
= one
+t
*(qS1
+t
*(qS2
+t
*(qS3
+t
*qS4
)));
68 s
= __ieee754_sqrtf(t
);
69 if(ix
>=0x3F79999A) { /* if |x| > 0.975 */
71 t
= pio2_hi
-((float)2.0*(s
+s
*w
)-pio2_lo
);
76 SET_FLOAT_WORD(w
,iw
&0xfffff000);
79 p
= (float)2.0*s
*r
-(pio2_lo
-(float)2.0*c
);
80 q
= pio4_hi
-(float)2.0*w
;
83 if(hx
>0) return t
; else return -t
;