xref: /netbsd-src/lib/libm/src/w_asin.c (revision cdac1ac4dece451fbf0fbbfbff391e86552ee8da)
1 /*	$NetBSD: w_asin.c,v 1.12 2024/06/09 13:35:38 riastradh Exp $	*/
2 
3 /* @(#)w_asin.c 5.1 93/09/24 */
4 /*
5  * ====================================================
6  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
7  *
8  * Developed at SunPro, a Sun Microsystems, Inc. business.
9  * Permission to use, copy, modify, and distribute this
10  * software is freely granted, provided that this notice
11  * is preserved.
12  * ====================================================
13  */
14 
15 #include <sys/cdefs.h>
16 #if defined(LIBM_SCCS) && !defined(lint)
17 __RCSID("$NetBSD: w_asin.c,v 1.12 2024/06/09 13:35:38 riastradh Exp $");
18 #endif
19 
20 /*
21  * wrapper asin(x)
22  */
23 
24 #include "namespace.h"
25 
26 #include "math.h"
27 #include "math_private.h"
28 
29 #ifndef __HAVE_LONG_DOUBLE
__weak_alias(asinl,_asinl)30 __weak_alias(asinl, _asinl)
31 __strong_alias(_asinl, _asin)
32 #endif
33 
34 __weak_alias(asin, _asin)
35 
36 double
37 asin(double x)		/* wrapper asin */
38 {
39 #ifdef _IEEE_LIBM
40 	return __ieee754_asin(x);
41 #else
42 	double z;
43 	z = __ieee754_asin(x);
44 	if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
45 	if(fabs(x)>1.0) {
46 	        return __kernel_standard(x,x,2); /* asin(|x|>1) */
47 	} else
48 	    return z;
49 #endif
50 }
51