Print this page
11210 libm should be cstyle(1ONBLD) clean
@@ -20,26 +20,27 @@
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
+
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma weak __ccoshl = ccoshl
#include "libm.h" /* coshl/expl/fabsl/scalbnl/sincosl/sinhl/__k_cexpl */
#include "complex_wrapper.h"
-/* INDENT OFF */
static const long double zero = 0.0L, half = 0.5L;
-/* INDENT ON */
+
ldcomplex
-ccoshl(ldcomplex z) {
+ccoshl(ldcomplex z)
+{
long double t, x, y, S, C;
int hx, ix, hy, iy, n;
ldcomplex ans;
x = LD_RE(z);
@@ -50,10 +51,11 @@
iy = hy & 0x7fffffff;
x = fabsl(x);
y = fabsl(y);
(void) sincosl(y, &S, &C);
+
if (ix >= 0x4004e000) { /* |x| > 60 = prec/2 (14,28,34,60) */
if (ix >= 0x400C62E4) { /* |x| > 11356.52... ~ log(2**16384) */
if (ix >= 0x7fff0000) { /* |x| is inf or NaN */
if (y == zero) {
LD_RE(ans) = x;
@@ -83,9 +85,11 @@
} else {
LD_RE(ans) = C * coshl(x);
LD_IM(ans) = S * sinhl(x);
}
}
+
if ((hx ^ hy) < 0)
LD_IM(ans) = -LD_IM(ans);
+
return (ans);
}