Sync usage with man page.
[netbsd-mini2440.git] / external / bsd / pcc / dist / pcc-libs / libF77 / sinh.c
blob65dd1ae3572dc319f887edfcb1a0de9be7156448
1 /* $Id: sinh.c,v 1.1.1.1 2008/08/24 05:34:47 gmcgarry Exp $ */
2 /*
3 * Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
9 * Redistributions of source code and documentation must retain the above
10 * copyright notice, this list of conditions and the following disclaimer.
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditionsand the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * All advertising materials mentioning features or use of this software
15 * must display the following acknowledgement:
16 * This product includes software developed or owned by Caldera
17 * International, Inc.
18 * Neither the name of Caldera International, Inc. nor the names of other
19 * contributors may be used to endorse or promote products derived from
20 * this software without specific prior written permission.
22 * USE OF THE SOFTWARE PROVIDED FOR UNDER THIS LICENSE BY CALDERA
23 * INTERNATIONAL, INC. AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 * DISCLAIMED. IN NO EVENT SHALL CALDERA INTERNATIONAL, INC. BE LIABLE
27 * FOR ANY DIRECT, INDIRECT INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
36 sinh(arg) returns the hyperbolic sign of its floating-
37 point argument.
39 The exponential function is called for arguments
40 greater in magnitude than 0.5.
41 The result overflows and 'huge' is returned for
42 arguments greater than somewhat.
44 A series is used for arguments smaller in magnitude than 0.5.
45 The coeffieients are #2029 from Hart & Cheney. (20.36D)
47 cosh(arg) is computed from the exponential function for
48 all arguments.
51 double exp();
53 static double p0 -0.6307673640497716991184787251e+6;
54 static double p1 -0.8991272022039509355398013511e+5;
55 static double p2 -0.2894211355989563807284660366e+4;
56 static double p3 -0.2630563213397497062819489e+2;
57 static double q0 -0.6307673640497716991212077277e+6;
58 static double q1 0.1521517378790019070696485176e+5;
59 static double q2 -0.173678953558233699533450911e+3;
60 static double q3 1.0;
62 double
63 sinh(arg) double arg; {
65 double sign, temp, argsq;
67 sign = 1;
68 if(arg < 0){
69 arg = - arg;
70 sign = -1;
73 if(arg > 21.){
74 temp = exp(arg)/2;
75 return(sign*temp);
78 if(arg > 0.5) {
79 temp = (exp(arg) - exp(-arg))/2;
80 return(sign*temp);
83 argsq = arg*arg;
84 temp = (((p3*argsq+p2)*argsq+p1)*argsq+p0)*arg;
85 temp = temp/(((q3*argsq+q2)*argsq+q1)*argsq+q0);
86 return(sign*temp);
90 double
91 cosh(arg) double arg; {
93 double temp;
95 if(arg < 0)
96 arg = - arg;
98 if(arg > 21.){
99 temp = exp(arg)/2;
100 return(temp);
103 temp = (exp(arg) + exp(-arg))/2;
104 return(temp);