1: /*
   2:  *	"@(#)sinh.c	1.1"
   3:  */
   4: 
   5: /*
   6: 	sinh(arg) returns the hyperbolic sine of its floating-
   7: 	point argument.
   8: 
   9: 	The exponential function is called for arguments
  10: 	greater in magnitude than 0.5.
  11: 
  12: 	A series is used for arguments smaller in magnitude than 0.5.
  13: 	The coefficients are #2029 from Hart & Cheney. (20.36D)
  14: 
  15: 	cosh(arg) is computed from the exponential function for
  16: 	all arguments.
  17: */
  18: 
  19: double  exp();
  20: 
  21: static double p0  = -0.6307673640497716991184787251e+6;
  22: static double p1  = -0.8991272022039509355398013511e+5;
  23: static double p2  = -0.2894211355989563807284660366e+4;
  24: static double p3  = -0.2630563213397497062819489e+2;
  25: static double q0  = -0.6307673640497716991212077277e+6;
  26: static double q1   = 0.1521517378790019070696485176e+5;
  27: static double q2  = -0.173678953558233699533450911e+3;
  28: 
  29: double
  30: sinh(arg)
  31: double arg;
  32: {
  33:     double temp, argsq;
  34:     register sign;
  35: 
  36:     sign = 1;
  37:     if(arg < 0) {
  38:         arg = - arg;
  39:         sign = -1;
  40:     }
  41: 
  42:     if(arg > 21.) {
  43:         temp = exp(arg)/2;
  44:         if (sign>0)
  45:             return(temp);
  46:         else
  47:             return(-temp);
  48:     }
  49: 
  50:     if(arg > 0.5) {
  51:         return(sign*(exp(arg) - exp(-arg))/2);
  52:     }
  53: 
  54:     argsq = arg*arg;
  55:     temp = (((p3*argsq+p2)*argsq+p1)*argsq+p0)*arg;
  56:     temp /= (((argsq+q2)*argsq+q1)*argsq+q0);
  57:     return(sign*temp);
  58: }
  59: 
  60: double
  61: cosh(arg)
  62: double arg;
  63: {
  64:     if(arg < 0)
  65:         arg = - arg;
  66:     if(arg > 21.) {
  67:         return(exp(arg)/2);
  68:     }
  69: 
  70:     return((exp(arg) + exp(-arg))/2);
  71: }

Defined functions

Defined variables

p0 defined in line 21; used 1 times
  • in line 55
p1 defined in line 22; used 1 times
  • in line 55
p2 defined in line 23; used 1 times
  • in line 55
p3 defined in line 24; used 1 times
  • in line 55
q0 defined in line 25; used 1 times
  • in line 56
q1 defined in line 26; used 1 times
  • in line 56
q2 defined in line 27; used 1 times
  • in line 56
Last modified: 1983-05-20
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 727
Valid CSS Valid XHTML 1.0 Strict