1 /* wf_atanh.c -- float version of w_atanh.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  * wrapper atanhf(x)
17  */
18 
19 #include "fdlibm.h"
20 #include <errno.h>
21 
22 #ifdef __STDC__
atanhf(float x)23 	float atanhf(float x)		/* wrapper atanhf */
24 #else
25 	float atanhf(x)			/* wrapper atanhf */
26 	float x;
27 #endif
28 {
29 #ifdef _IEEE_LIBM
30 	return __ieee754_atanhf(x);
31 #else
32 	float z,y;
33 	struct exception exc;
34 	z = __ieee754_atanhf(x);
35 	if(_LIB_VERSION == _IEEE_ || isnanf(x)) return z;
36 	y = fabsf(x);
37 	if(y>=(float)1.0) {
38 	    if(y>(float)1.0) {
39                 /* atanhf(|x|>1) */
40                 exc.type = DOMAIN;
41                 exc.name = "atanhf";
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 	    } else {
51                 /* atanhf(|x|=1) */
52                 exc.type = SING;
53                 exc.name = "atanhf";
54 		exc.err = 0;
55 		exc.arg1 = exc.arg2 = (double)x;
56 		exc.retval = x/0.0;	/* sign(x)*inf */
57                 if (_LIB_VERSION == _POSIX_)
58                   errno = EDOM;
59                 else if (!matherr(&exc)) {
60                   errno = EDOM;
61                 }
62             }
63 	    if (exc.err != 0)
64               errno = exc.err;
65             return (float)exc.retval;
66 	} else
67 	    return z;
68 #endif
69 }
70 
71 #ifdef _DOUBLE_IS_32BITS
72 
73 #ifdef __STDC__
atanh(double x)74 	double atanh(double x)
75 #else
76 	double atanh(x)
77 	double x;
78 #endif
79 {
80 	return (double) atanhf((float) x);
81 }
82 
83 #endif /* defined(_DOUBLE_IS_32BITS) */
84