Print this page
11210 libm should be cstyle(1ONBLD) clean
@@ -20,10 +20,11 @@
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
+
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -81,27 +82,34 @@
#define lnovft C[4]
#define lnovlo C[5]
#define tinyl C[6]
long double
-coshl(long double x) {
+coshl(long double x)
+{
long double w, t;
w = fabsl(x);
+
if (!finitel(w))
return (w + w); /* x is INF or NaN */
+
if (w < thr1) {
if (w < tinyl)
return (one + w); /* inexact+directed rounding */
+
t = expm1l(w);
w = one + t;
w = one + (t * t) / (w + w);
return (w);
}
+
if (w < thr2) {
t = expl(w);
return (half * (t + one / t));
}
+
if (w <= lnovft)
return (half * expl(w));
+
return (scalbnl(expl((w - lnovft) - lnovlo), 16383));
}