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

Subversion Repositories or1k

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 lampret
 
2
/* @(#)w_acosh.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
/*
16
FUNCTION
17
<<acosh>>, <<acoshf>>---inverse hyperbolic cosine
18
 
19
INDEX
20
acosh
21
INDEX
22
acoshf
23
 
24
ANSI_SYNOPSIS
25
        #include <math.h>
26
        double acosh(double <[x]>);
27
        float acoshf(float <[x]>);
28
 
29
TRAD_SYNOPSIS
30
        #include <math.h>
31
        double acosh(<[x]>)
32
        double <[x]>;
33
 
34
        float acoshf(<[x]>)
35
        float <[x]>;
36
 
37
DESCRIPTION
38
<<acosh>> calculates the inverse hyperbolic cosine of <[x]>.
39
<<acosh>> is defined as
40
@ifinfo
41
. log(<[x]> + sqrt(<[x]>*<[x]>-1))
42
@end ifinfo
43
@tex
44
$$ln\Bigl(x + \sqrt{x^2-1}\Bigr)$$
45
@end tex
46
 
47
<[x]> must be a number greater than or equal to 1.
48
 
49
<<acoshf>> is identical, other than taking and returning floats.
50
 
51
RETURNS
52
<<acosh>> and <<acoshf>> return the calculated value.  If <[x]>
53
less than 1, the return value is NaN and <<errno>> is set to <<EDOM>>.
54
 
55
You can change the error-handling behavior with the non-ANSI
56
<<matherr>> function.
57
 
58
PORTABILITY
59
Neither <<acosh>> nor <<acoshf>> are ANSI C.  They are not recommended
60
for portable programs.
61
 
62
 
63
QUICKREF ANSI SVID POSIX RENTRANT
64
 acos    n,n,n,m
65
 acosf   n,n,n,m
66
 
67
MATHREF
68
 acosh, NAN,   arg,DOMAIN,EDOM
69
 acosh, < 1.0, NAN,DOMAIN,EDOM
70
 acosh, >=1.0, acosh(arg),,,
71
 
72
MATHREF
73
 acoshf, NAN,   arg,DOMAIN,EDOM
74
 acoshf, < 1.0, NAN,DOMAIN,EDOM
75
 acoshf, >=1.0, acosh(arg),,,
76
 
77
*/
78
 
79
/*
80
 * wrapper acosh(x)
81
 */
82
 
83
#include "fdlibm.h"
84
#include <errno.h>
85
 
86
#ifndef _DOUBLE_IS_32BITS
87
 
88
#ifdef __STDC__
89
        double acosh(double x)          /* wrapper acosh */
90
#else
91
        double acosh(x)                 /* wrapper acosh */
92
        double x;
93
#endif
94
{
95
#ifdef _IEEE_LIBM
96
        return __ieee754_acosh(x);
97
#else
98
        double z;
99
        struct exception exc;
100
        z = __ieee754_acosh(x);
101
        if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
102
        if(x<1.0) {
103
            /* acosh(x<1) */
104
            exc.type = DOMAIN;
105
            exc.name = "acosh";
106 56 joel
            exc.err = 0;
107
            exc.arg1 = exc.arg2 = x;
108 39 lampret
            exc.retval = 0.0/0.0;
109
            if (_LIB_VERSION == _POSIX_)
110
               errno = EDOM;
111
            else if (!matherr(&exc)) {
112
               errno = EDOM;
113
            }
114
            if (exc.err != 0)
115
               errno = exc.err;
116
            return exc.retval;
117
        } else
118
            return z;
119
#endif
120
}
121
 
122
#endif /* defined(_DOUBLE_IS_32BITS) */

powered by: WebSVN 2.1.0

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