00001 /* 00002 * Copyright 2003, 2004 PathScale, Inc. All Rights Reserved. 00003 */ 00004 00005 /* 00006 00007 Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00008 00009 This program is free software; you can redistribute it and/or modify it 00010 under the terms of version 2.1 of the GNU Lesser General Public License 00011 as published by the Free Software Foundation. 00012 00013 This program is distributed in the hope that it would be useful, but 00014 WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 00017 Further, this software is distributed without any warranty that it is 00018 free of the rightful claim of any third person regarding infringement 00019 or the like. Any license provided herein, whether implied or 00020 otherwise, applies only to this software file. Patent licenses, if 00021 any, provided herein do not apply to combinations of this program with 00022 other software, or any other product whatsoever. 00023 00024 You should have received a copy of the GNU Lesser General Public 00025 License along with this program; if not, write the Free Software 00026 Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, 00027 USA. 00028 00029 Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00030 Mountain View, CA 94043, or: 00031 00032 http://www.sgi.com 00033 00034 For further information regarding this notice, see: 00035 00036 http://oss.sgi.com/projects/GenInfo/NoticeExplan 00037 00038 */ 00039 00040 00041 /* VMS Compatibility Version @(#)sinh.c 1.1 7/18/87 00042 */ 00043 /* 00044 sinh(arg) returns the hyperbolic sine of its floating- 00045 point argument. 00046 00047 The exponential function is called for arguments 00048 greater in magnitude than 0.5. 00049 00050 A series is used for arguments smaller in magnitude than 0.5. 00051 The coefficients are #2029 from Hart & Cheney. (20.36D) 00052 00053 cosh(arg) is computed from the exponential function for 00054 all arguments. 00055 */ 00056 #include "cmplrs/host.h" 00057 #include <math.h> 00058 #include "moremath.h" 00059 00060 static double p0 = -0.6307673640497716991184787251e+6; 00061 static double p1 = -0.8991272022039509355398013511e+5; 00062 static double p2 = -0.2894211355989563807284660366e+4; 00063 static double p3 = -0.2630563213397497062819489e+2; 00064 static double q0 = -0.6307673640497716991212077277e+6; 00065 static double q1 = 0.1521517378790019070696485176e+5; 00066 static double q2 = -0.173678953558233699533450911e+3; 00067 00068 double 00069 sinh(double arg) 00070 { 00071 double temp, argsq; 00072 register int32 sign; 00073 00074 sign = 1; 00075 if(arg < 0) { 00076 arg = - arg; 00077 sign = -1; 00078 } 00079 00080 if(arg > 21.) { 00081 temp = exp(arg)/2; 00082 if (sign>0) 00083 return(temp); 00084 else 00085 return(-temp); 00086 } 00087 00088 if(arg > 0.5) { 00089 return(sign*(exp(arg) - exp(-arg))/2); 00090 } 00091 00092 argsq = arg*arg; 00093 temp = (((p3*argsq+p2)*argsq+p1)*argsq+p0)*arg; 00094 temp /= (((argsq+q2)*argsq+q1)*argsq+q0); 00095 return(sign*temp); 00096 } 00097 00098 double 00099 cosh(double arg) 00100 { 00101 if(arg < 0) 00102 arg = - arg; 00103 if(arg > 21.) { 00104 return(exp(arg)/2); 00105 } 00106 00107 return((exp(arg) + exp(-arg))/2); 00108 }
1.5.6