Print this page
11210 libm should be cstyle(1ONBLD) clean
*** 16,36 ****
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma weak __cosh = cosh
! /* INDENT OFF */
/*
* cosh(x)
* Code originated from 4.3bsd.
* Modified by K.C. Ng for SUN 4.0 libm.
* Method :
--- 16,38 ----
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
+
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
+
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma weak __cosh = cosh
!
/*
* cosh(x)
* Code originated from 4.3bsd.
* Modified by K.C. Ng for SUN 4.0 libm.
* Method :
*** 50,89 ****
*
* Special cases:
* cosh(x) is |x| if x is +INF, -INF, or NaN.
* only cosh(0)=1 is exact for finite x.
*/
- /* INDENT ON */
#include "libm.h"
! static const double
! ln2 = 6.93147180559945286227e-01,
ln2hi = 6.93147180369123816490e-01,
ln2lo = 1.90821492927058770002e-10,
lnovft = 7.09782712893383973096e+02;
double
! cosh(double x) {
double t, w;
w = fabs(x);
if (!finite(w))
return (w * w);
if (w < 0.3465) {
t = expm1(w);
w = 1.0 + t;
if (w != 1.0)
w = 1.0 + (t * t) / (w + w);
return (w);
} else if (w < 22.0) {
t = exp(w);
return (0.5 * (t + 1.0 / t));
} else if (w <= lnovft) {
return (0.5 * exp(w));
} else {
w = (w - 1024 * ln2hi) - 1024 * ln2lo;
if (w >= ln2)
return (_SVID_libm_err(x, x, 5));
else
return (scalbn(exp(w), 1023));
}
--- 52,95 ----
*
* Special cases:
* cosh(x) is |x| if x is +INF, -INF, or NaN.
* only cosh(0)=1 is exact for finite x.
*/
#include "libm.h"
! static const double ln2 = 6.93147180559945286227e-01,
ln2hi = 6.93147180369123816490e-01,
ln2lo = 1.90821492927058770002e-10,
lnovft = 7.09782712893383973096e+02;
double
! cosh(double x)
! {
double t, w;
w = fabs(x);
+
if (!finite(w))
return (w * w);
+
if (w < 0.3465) {
t = expm1(w);
w = 1.0 + t;
+
if (w != 1.0)
w = 1.0 + (t * t) / (w + w);
+
return (w);
} else if (w < 22.0) {
t = exp(w);
return (0.5 * (t + 1.0 / t));
} else if (w <= lnovft) {
return (0.5 * exp(w));
} else {
w = (w - 1024 * ln2hi) - 1024 * ln2lo;
+
if (w >= ln2)
return (_SVID_libm_err(x, x, 5));
else
return (scalbn(exp(w), 1023));
}