1 /* $NetBSD: w_acos.c,v 1.11 2024/06/09 13:35:38 riastradh Exp $ */ 2 3 /* @(#)w_acos.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_acos.c,v 1.11 2024/06/09 13:35:38 riastradh Exp $"); 18 #endif 19 20 /* 21 * wrap_acos(x) 22 */ 23 24 #include "namespace.h" 25 26 #include "math.h" 27 #include "math_private.h" 28 29 #ifndef __HAVE_LONG_DOUBLE 30 __weak_alias(acosl, _acosl) 31 __strong_alias(_acosl, _acos) 32 #endif 33 34 __weak_alias(acos, _acos) 35 36 double 37 acos(double x) /* wrapper acos */ 38 { 39 #ifdef _IEEE_LIBM 40 return __ieee754_acos(x); 41 #else 42 double z; 43 z = __ieee754_acos(x); 44 if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; 45 if(fabs(x)>1.0) { 46 return __kernel_standard(x,x,1); /* acos(|x|>1) */ 47 } else 48 return z; 49 #endif 50 } 51