OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libm/] [math/] [w_atanh.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1010 ivang
 
2
/* @(#)w_atanh.c 5.1 93/09/24 */
3
/*
4
 * ====================================================
5
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6
 *
7
 * Developed at SunPro, a Sun Microsystems, Inc. business.
8
 * Permission to use, copy, modify, and distribute this
9
 * software is freely granted, provided that this notice
10
 * is preserved.
11
 * ====================================================
12
 */
13
 
14
/*
15
FUNCTION
16
        <<atanh>>, <<atanhf>>---inverse hyperbolic tangent
17
 
18
INDEX
19
        atanh
20
INDEX
21
        atanhf
22
 
23
ANSI_SYNOPSIS
24
        #include <math.h>
25
        double atanh(double <[x]>);
26
        float atanhf(float <[x]>);
27
 
28
TRAD_SYNOPSIS
29
        #include <math.h>
30
        double atanh(<[x]>)
31
        double <[x]>;
32
 
33
        float atanhf(<[x]>)
34
        float <[x]>;
35
 
36
DESCRIPTION
37
        <<atanh>> calculates the inverse hyperbolic tangent of <[x]>.
38
 
39
        <<atanhf>> is identical, other than taking and returning
40
        <<float>> values.
41
 
42
RETURNS
43
        <<atanh>> and <<atanhf>> return the calculated value.
44
 
45
        If
46
        @ifinfo
47
        |<[x]>|
48
        @end ifinfo
49
        @tex
50
        $|x|$
51
        @end tex
52
        is greater than 1, the global <<errno>> is set to <<EDOM>> and
53
        the result is a NaN.  A <<DOMAIN error>> is reported.
54
 
55
        If
56
        @ifinfo
57
        |<[x]>|
58
        @end ifinfo
59
        @tex
60
        $|x|$
61
        @end tex
62
        is 1, the global <<errno>> is set to <<EDOM>>; and the result is
63
        infinity with the same sign as <<x>>.  A <<SING error>> is reported.
64
 
65
        You can modify the error handling for these routines using
66
        <<matherr>>.
67
 
68
PORTABILITY
69
        Neither <<atanh>> nor <<atanhf>> are ANSI C.
70
 
71
QUICKREF
72
        atanh - pure
73
        atanhf - pure
74
 
75
 
76
*/
77
 
78
/*
79
 * wrapper atanh(x)
80
 */
81
 
82
#include "fdlibm.h"
83
#include <errno.h>
84
 
85
#ifndef _DOUBLE_IS_32BITS
86
 
87
#ifdef __STDC__
88
        double atanh(double x)          /* wrapper atanh */
89
#else
90
        double atanh(x)                 /* wrapper atanh */
91
        double x;
92
#endif
93
{
94
#ifdef _IEEE_LIBM
95
        return __ieee754_atanh(x);
96
#else
97
        double z,y;
98
        struct exception exc;
99
        z = __ieee754_atanh(x);
100
        if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
101
        y = fabs(x);
102
        if(y>=1.0) {
103
            if(y>1.0) {
104
                /* atanh(|x|>1) */
105
                exc.type = DOMAIN;
106
                exc.name = "atanh";
107
                exc.err = 0;
108
                exc.arg1 = exc.arg2 = x;
109
                exc.retval = 0.0/0.0;
110
                if (_LIB_VERSION == _POSIX_)
111
                  errno = EDOM;
112
                else if (!matherr(&exc)) {
113
                  errno = EDOM;
114
                }
115
            } else {
116
                /* atanh(|x|=1) */
117
                exc.type = SING;
118
                exc.name = "atanh";
119
                exc.err = 0;
120
                exc.arg1 = exc.arg2 = x;
121
                exc.retval = x/0.0;     /* sign(x)*inf */
122
                if (_LIB_VERSION == _POSIX_)
123
                  errno = EDOM;
124
                else if (!matherr(&exc)) {
125
                  errno = EDOM;
126
                }
127
            }
128
            if (exc.err != 0)
129
              errno = exc.err;
130
            return exc.retval;
131
        } else
132
            return z;
133
#endif
134
}
135
 
136
#endif /* defined(_DOUBLE_IS_32BITS) */
137
 
138
 
139
 
140
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.