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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libm/] [math/] [w_sinh.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
 
2
/* @(#)w_sinh.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
        <<sinh>>, <<sinhf>>---hyperbolic sine
18
 
19
INDEX
20
        sinh
21
INDEX
22
        sinhf
23
 
24
ANSI_SYNOPSIS
25
        #include <math.h>
26
        double sinh(double <[x]>);
27
        float  sinhf(float <[x]>);
28
 
29
TRAD_SYNOPSIS
30
        #include <math.h>
31
        double sinh(<[x]>)
32
        double <[x]>;
33
 
34
        float  sinhf(<[x]>)
35
        float <[x]>;
36
 
37
DESCRIPTION
38
        <<sinh>> computes the hyperbolic sine of the argument <[x]>.
39
        Angles are specified in radians.   <<sinh>>(<[x]>) is defined as
40
        @ifnottex
41
        . (exp(<[x]>) - exp(-<[x]>))/2
42
        @end ifnottex
43
        @tex
44
        $${e^x - e^{-x}}\over 2$$
45
        @end tex
46
 
47
        <<sinhf>> is identical, save that it takes and returns <<float>> values.
48
 
49
RETURNS
50
        The hyperbolic sine of <[x]> is returned.
51
 
52
        When the correct result is too large to be representable (an
53
        overflow),  <<sinh>> returns <<HUGE_VAL>> with the
54
        appropriate sign, and sets the global value <<errno>> to
55
        <<ERANGE>>.
56
 
57
        You can modify error handling for these functions with <<matherr>>.
58
 
59
PORTABILITY
60
        <<sinh>> is ANSI C.
61
        <<sinhf>> is an extension.
62
 
63
QUICKREF
64
        sinh ansi pure
65
        sinhf - pure
66
*/
67
 
68
/*
69
 * wrapper sinh(x)
70
 */
71
 
72
#include "fdlibm.h"
73
#include <errno.h>
74
 
75
#ifndef _DOUBLE_IS_32BITS
76
 
77
#ifdef __STDC__
78
        double sinh(double x)           /* wrapper sinh */
79
#else
80
        double sinh(x)                  /* wrapper sinh */
81
        double x;
82
#endif
83
{
84
#ifdef _IEEE_LIBM
85
        return __ieee754_sinh(x);
86
#else
87
        double z;
88
        struct exception exc;
89
        z = __ieee754_sinh(x);
90
        if(_LIB_VERSION == _IEEE_) return z;
91
        if(!finite(z)&&finite(x)) {
92
            /* sinh(finite) overflow */
93
#ifndef HUGE_VAL 
94
#define HUGE_VAL inf
95
            double inf = 0.0;
96
 
97
            SET_HIGH_WORD(inf,0x7ff00000);      /* set inf to infinite */
98
#endif
99
            exc.type = OVERFLOW;
100
            exc.name = "sinh";
101
            exc.err = 0;
102
            exc.arg1 = exc.arg2 = x;
103
            if (_LIB_VERSION == _SVID_)
104
               exc.retval = ( (x>0.0) ? HUGE : -HUGE);
105
            else
106
               exc.retval = ( (x>0.0) ? HUGE_VAL : -HUGE_VAL);
107
            if (_LIB_VERSION == _POSIX_)
108
               errno = ERANGE;
109
            else if (!matherr(&exc)) {
110
               errno = ERANGE;
111
            }
112
            if (exc.err != 0)
113
               errno = exc.err;
114
            return exc.retval;
115
        } else
116
            return z;
117
#endif
118
}
119
 
120
#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.