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