1 /* wf_asin.c -- float version of w_asin.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 /*
18  * wrapper asinf(x)
19  */
20 
21 
22 #include "fdlibm.h"
23 #include <errno.h>
24 
25 #ifdef __STDC__
asinf(float x)26 	float asinf(float x)		/* wrapper asinf */
27 #else
28 	float asinf(x)			/* wrapper asinf */
29 	float x;
30 #endif
31 {
32 #ifdef _IEEE_LIBM
33 	return __ieee754_asinf(x);
34 #else
35 	float z;
36 	struct exception exc;
37 	z = __ieee754_asinf(x);
38 	if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
39 	if(fabsf(x)>(float)1.0) {
40 	    /* asinf(|x|>1) */
41 	    exc.type = DOMAIN;
42 	    exc.name = "asinf";
43 	    exc.err = 0;
44 	    exc.arg1 = exc.arg2 = (double)x;
45 	    exc.retval = nan("");
46 	    if(_LIB_VERSION == _POSIX_)
47 	      errno = EDOM;
48 	    else if (!matherr(&exc)) {
49 	      errno = EDOM;
50 	    }
51 	    if (exc.err != 0)
52 	      errno = exc.err;
53 	    return (float)exc.retval;
54 	} else
55 	    return z;
56 #endif
57 }
58 
59 #ifdef _DOUBLE_IS_32BITS
60 
61 #ifdef __STDC__
asin(double x)62 	double asin(double x)
63 #else
64 	double asin(x)
65 	double x;
66 #endif
67 {
68 	return (double) asinf((float) x);
69 }
70 
71 #endif /* defined(_DOUBLE_IS_32BITS) */
72