Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3362 | Serge | 1 | |
2 | /* |
||
3 | * ==================================================== |
||
4 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. |
||
5 | * |
||
6 | * Developed at SunPro, a Sun Microsystems, Inc. business. |
||
7 | * Permission to use, copy, modify, and distribute this |
||
8 | * software is freely granted, provided that this notice |
||
9 | * is preserved. |
||
10 | * ==================================================== |
||
11 | */ |
||
12 | |||
13 | |||
14 | FUNCTION |
||
15 | < |
||
16 | |||
17 | |||
18 | atanh |
||
19 | INDEX |
||
20 | atanhf |
||
21 | |||
22 | |||
23 | #include |
||
24 | double atanh(double <[x]>); |
||
25 | float atanhf(float <[x]>); |
||
26 | |||
27 | |||
28 | #include |
||
29 | double atanh(<[x]>) |
||
30 | double <[x]>; |
||
31 | |||
32 | |||
33 | float <[x]>; |
||
34 | |||
35 | |||
36 | < |
||
37 | |||
38 | |||
39 | < |
||
40 | |||
41 | |||
42 | < |
||
43 | |||
44 | |||
45 | @ifnottex |
||
46 | |<[x]>| |
||
47 | @end ifnottex |
||
48 | @tex |
||
49 | $|x|$ |
||
50 | @end tex |
||
51 | is greater than 1, the global < |
||
52 | the result is a NaN. A < |
||
53 | |||
54 | |||
55 | @ifnottex |
||
56 | |<[x]>| |
||
57 | @end ifnottex |
||
58 | @tex |
||
59 | $|x|$ |
||
60 | @end tex |
||
61 | is 1, the global < |
||
62 | infinity with the same sign as < |
||
63 | |||
64 | |||
65 | < |
||
66 | |||
67 | |||
68 | Neither < |
||
69 | |||
70 | |||
71 | atanh - pure |
||
72 | atanhf - pure |
||
73 | |||
74 | |||
75 | |||
76 | |||
77 | |||
78 | * wrapper atanh(x) |
||
79 | */ |
||
80 | |||
81 | |||
82 | #include |
||
83 | |||
84 | |||
85 | |||
86 | |||
87 | double atanh(double x) /* wrapper atanh */ |
||
88 | #else |
||
89 | double atanh(x) /* wrapper atanh */ |
||
90 | double x; |
||
91 | #endif |
||
92 | { |
||
93 | #ifdef _IEEE_LIBM |
||
94 | return __ieee754_atanh(x); |
||
95 | #else |
||
96 | double z,y; |
||
97 | struct exception exc; |
||
98 | z = __ieee754_atanh(x); |
||
99 | if(_LIB_VERSION == _IEEE_ || isnan(x)) return z; |
||
100 | y = fabs(x); |
||
101 | if(y>=1.0) { |
||
102 | if(y>1.0) { |
||
103 | /* atanh(|x|>1) */ |
||
104 | exc.type = DOMAIN; |
||
105 | exc.name = "atanh"; |
||
106 | exc.err = 0; |
||
107 | exc.arg1 = exc.arg2 = x; |
||
108 | exc.retval = 0.0/0.0; |
||
109 | if (_LIB_VERSION == _POSIX_) |
||
110 | errno = EDOM; |
||
111 | else if (!matherr(&exc)) { |
||
112 | errno = EDOM; |
||
113 | } |
||
114 | } else { |
||
115 | /* atanh(|x|=1) */ |
||
116 | exc.type = SING; |
||
117 | exc.name = "atanh"; |
||
118 | exc.err = 0; |
||
119 | exc.arg1 = exc.arg2 = x; |
||
120 | exc.retval = x/0.0; /* sign(x)*inf */ |
||
121 | if (_LIB_VERSION == _POSIX_) |
||
122 | errno = EDOM; |
||
123 | else if (!matherr(&exc)) { |
||
124 | errno = EDOM; |
||
125 | } |
||
126 | } |
||
127 | if (exc.err != 0) |
||
128 | errno = exc.err; |
||
129 | return exc.retval; |
||
130 | } else |
||
131 | return z; |
||
132 | #endif |
||
133 | } |
||
134 | |||
135 | |||
136 |