diff options
author | rgrimes <rgrimes@FreeBSD.org> | 1995-05-30 05:51:47 +0000 |
---|---|---|
committer | rgrimes <rgrimes@FreeBSD.org> | 1995-05-30 05:51:47 +0000 |
commit | f05428e4cd63dde97bac14b84dd146a5c00455e3 (patch) | |
tree | e1331adb5d216f2b3fa6baa6491752348d2e5f10 /lib/libm/common_source/cosh.c | |
parent | 6de57e42c294763c78d77b0a9a7c5a08008a378a (diff) | |
download | FreeBSD-src-f05428e4cd63dde97bac14b84dd146a5c00455e3.zip FreeBSD-src-f05428e4cd63dde97bac14b84dd146a5c00455e3.tar.gz |
Remove trailing whitespace.
Diffstat (limited to 'lib/libm/common_source/cosh.c')
-rw-r--r-- | lib/libm/common_source/cosh.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/libm/common_source/cosh.c b/lib/libm/common_source/cosh.c index e2b3073..e8d3519 100644 --- a/lib/libm/common_source/cosh.c +++ b/lib/libm/common_source/cosh.c @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)cosh.c 8.1 (Berkeley) 6/4/93"; /* COSH(X) * RETURN THE HYPERBOLIC COSINE OF X * DOUBLE PRECISION (VAX D format 56 bits, IEEE DOUBLE 53 BITS) - * CODED IN C BY K.C. NG, 1/8/85; + * CODED IN C BY K.C. NG, 1/8/85; * REVISED BY K.C. NG on 2/8/85, 2/23/85, 3/7/85, 3/29/85, 4/16/85. * * Required system supported functions : @@ -46,20 +46,20 @@ static char sccsid[] = "@(#)cosh.c 8.1 (Berkeley) 6/4/93"; * scalb(x,N) * * Required kernel function: - * exp(x) + * exp(x) * exp__E(x,c) ...return exp(x+c)-1-x for |x|<0.3465 * * Method : - * 1. Replace x by |x|. - * 2. - * [ exp(x) - 1 ]^2 + * 1. Replace x by |x|. + * 2. + * [ exp(x) - 1 ]^2 * 0 <= x <= 0.3465 : cosh(x) := 1 + ------------------- * 2*exp(x) * * exp(x) + 1/exp(x) * 0.3465 <= x <= 22 : cosh(x) := ------------------- * 2 - * 22 <= x <= lnovfl : cosh(x) := exp(x)/2 + * 22 <= x <= lnovfl : cosh(x) := exp(x)/2 * lnovfl <= x <= lnovfl+log(2) * : cosh(x) := exp(x)/2 (avoid overflow) * log(2)+lnovfl < x < INF: overflow to INF @@ -106,7 +106,7 @@ static max = 1023 ; double cosh(x) double x; -{ +{ static const double half=1.0/2.0, one=1.0, small=1.0E-18; /* fl(1+small)==1 */ double t; @@ -115,19 +115,19 @@ double x; if(x!=x) return(x); /* x is NaN */ #endif /* !defined(vax)&&!defined(tahoe) */ if((x=copysign(x,one)) <= 22) - if(x<0.3465) + if(x<0.3465) if(x<small) return(one+x); else {t=x+__exp__E(x,0.0);x=t+t; return(one+t*t/(2.0+x)); } else /* for x lies in [0.3465,22] */ { t=exp(x); return((t+one/t)*half); } - if( lnovfl <= x && x <= (lnovfl+0.7)) - /* for x lies in [lnovfl, lnovfl+ln2], decrease x by ln(2^(max+1)) - * and return 2^max*exp(x) to avoid unnecessary overflow + if( lnovfl <= x && x <= (lnovfl+0.7)) + /* for x lies in [lnovfl, lnovfl+ln2], decrease x by ln(2^(max+1)) + * and return 2^max*exp(x) to avoid unnecessary overflow */ - return(scalb(exp((x-mln2hi)-mln2lo), max)); + return(scalb(exp((x-mln2hi)-mln2lo), max)); - else + else return(exp(x)*half); /* for large x, cosh(x)=exp(x)/2 */ } |