2 * ====================================================
3 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5 * Developed at SunPro, a Sun Microsystems, Inc. business.
6 * Permission to use, copy, modify, and distribute this
7 * software is freely granted, provided that this notice
9 * ====================================================
13 static char rcsid
[] = "$FreeBSD: src/lib/msun/src/e_asinl.c,v 1.2 2008/08/03 17:49:05 das Exp $";
17 * See comments in e_asin.c.
18 * Converted to long double by David Schultz <das@FreeBSD.ORG>.
25 #include "math_private.h"
27 static const long double
28 one
= 1.00000000000000000000e+00,
35 long double t
=0.0,w
,p
,q
,c
,r
,s
;
36 int16_t expsign
, expt
;
38 expsign
= u
.xbits
.expsign
;
39 expt
= expsign
& 0x7fff;
40 if(expt
>= BIAS
) { /* |x|>= 1 */
41 if(expt
==BIAS
&& ((u
.bits
.manh
&~LDBL_NBIT
)|u
.bits
.manl
)==0)
42 /* asin(1)=+-pi/2 with inexact */
43 return x
*pio2_hi
+x
*pio2_lo
;
44 return (x
-x
)/(x
-x
); /* asin(|x|>1) is NaN */
45 } else if (expt
<BIAS
-1) { /* |x|<0.5 */
46 if(expt
<ASIN_LINEAR
) { /* if |x| is small, asinl(x)=x */
47 if(huge
+x
>one
) return x
;/* return x with inexact if x!=0*/
61 if(u
.bits
.manh
>=THRESH
) { /* if |x| is close to 1 */
63 t
= pio2_hi
-(2.0*(s
+s
*w
)-pio2_lo
);
70 p
= 2.0*s
*r
-(pio2_lo
-2.0*c
);
74 if(expsign
>0) return t
; else return -t
;