Print this page
11210 libm should be cstyle(1ONBLD) clean
@@ -20,43 +20,46 @@
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
+
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma weak __cacosh = cacosh
-/* INDENT OFF */
+
/*
* dcomplex cacosh(dcomplex z);
* cacosh z = +-i cacos z .
* In order to make conj(cacosh(z))=cacosh(conj(z)),
* we define
* cacosh z = sign(Im(z))*i cacos z .
*
*/
-/* INDENT ON */
#include "libm.h" /* fabs/isnan/isinf/signbit */
#include "complex_wrapper.h"
/* need to work on special cases according to spec */
dcomplex
-cacosh(dcomplex z) {
+cacosh(dcomplex z)
+{
dcomplex w, ans;
double x, y;
w = cacos(z);
x = D_RE(z);
y = D_IM(z);
+
if (isnan(y)) {
D_IM(ans) = y + y;
+
if (isinf(x))
D_RE(ans) = fabs(x);
else
D_RE(ans) = y;
} else if (signbit(y) == 0) {
@@ -64,7 +67,8 @@
D_IM(ans) = D_RE(w);
} else {
D_RE(ans) = D_IM(w);
D_IM(ans) = -D_RE(w);
}
+
return (ans);
}