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 Modifications for single precision expansion are
18 Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
19 and are incorporated herein by permission of the author. The author
20 reserves the right to distribute this material elsewhere under different
21 copying permissions. These modifications are distributed here under
24 This library is free software; you can redistribute it and/or
25 modify it under the terms of the GNU Lesser General Public
26 License as published by the Free Software Foundation; either
27 version 2.1 of the License, or (at your option) any later version.
29 This library is distributed in the hope that it will be useful,
30 but WITHOUT ANY WARRANTY; without even the implied warranty of
31 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
32 Lesser General Public License for more details.
34 You should have received a copy of the GNU Lesser General Public
35 License along with this library; if not, write to the Free Software
36 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
38 #if defined(LIBM_SCCS) && !defined(lint)
39 static char rcsid
[] = "$NetBSD: e_asinf.c,v 1.5 1995/05/12 04:57:25 jtc Exp $";
42 #include "math_private.h"
49 one
= 1.0000000000e+00, /* 0x3F800000 */
52 pio2_hi
= 1.57079637050628662109375f
,
53 pio2_lo
= -4.37113900018624283e-8f
,
54 pio4_hi
= 0.785398185253143310546875f
,
56 /* asin x = x + x^3 p(x^2)
58 Peak relative error 4.8e-9 */
66 float __ieee754_asinf(float x
)
68 float __ieee754_asinf(x
)
77 /* asin(1)=+-pi/2 with inexact */
78 return x
*pio2_hi
+x
*pio2_lo
;
79 } else if(ix
> 0x3f800000) { /* |x|>= 1 */
80 return (x
-x
)/(x
-x
); /* asin(|x|>1) is NaN */
81 } else if (ix
<0x3f000000) { /* |x|<0.5 */
82 if(ix
<0x32000000) { /* if |x| < 2**-27 */
83 if(huge
+x
>one
) return x
;/* return x with inexact if x!=0*/
86 w
= t
* (p0
+ t
* (p1
+ t
* (p2
+ t
* (p3
+ t
* p4
))));
93 p
= t
* (p0
+ t
* (p1
+ t
* (p2
+ t
* (p3
+ t
* p4
))));
94 s
= __ieee754_sqrtf(t
);
95 if(ix
>=0x3F79999A) { /* if |x| > 0.975 */
96 t
= pio2_hi
-(2.0f
*(s
+s
*p
)-pio2_lo
);
100 GET_FLOAT_WORD(iw
,w
);
101 SET_FLOAT_WORD(w
,iw
&0xfffff000);
104 p
= 2.0f
*s
*r
-(pio2_lo
-2.0f
*c
);
108 if(hx
>0) return t
; else return -t
;