Subversion Repositories Kolibri OS

Rev

Rev 4872 | Go to most recent revision | Details | Last modification | View Log | RSS feed

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