1 /* wf_acos.c -- float version of w_acos.c. 2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. 3 */ 4 5 /* 6 * ==================================================== 7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 8 * 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 12 * is preserved. 13 * ==================================================== 14 */ 15 16 /* 17 * wrap_acosf(x) 18 */ 19 20 #include "fdlibm.h" 21 #include <errno.h> 22 23 #ifdef _HAVE_STDC acosf(float x)24 float acosf(float x) /* wrapper acosf */ 25 #else 26 float acosf(x) /* wrapper acosf */ 27 float x; 28 #endif 29 { 30 #ifdef _IEEE_LIBM 31 return __ieee754_acosf(x); 32 #else 33 float z; 34 struct exception exc; 35 z = __ieee754_acosf(x); 36 if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z; 37 if(fabsf(x)>(float)1.0) { 38 /* acosf(|x|>1) */ 39 exc.type = DOMAIN; 40 exc.name = "acosf"; 41 exc.err = 0; 42 exc.arg1 = exc.arg2 = (double)x; 43 exc.retval = 0.0; 44 if (_LIB_VERSION == _POSIX_) 45 errno = EDOM; 46 else if (!matherr(&exc)) { 47 errno = EDOM; 48 } 49 if (exc.err != 0) 50 errno = exc.err; 51 return (float)exc.retval; 52 } else 53 return z; 54 #endif 55 } 56 57 #ifdef _DOUBLE_IS_32BITS 58 59 #ifdef __STDC__ acos(double x)60 double acos(double x) 61 #else 62 double acos(x) 63 double x; 64 #endif 65 { 66 return (double) acosf((float) x); 67 } 68 69 #endif /* defined(_DOUBLE_IS_32BITS) */ 70