/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* 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 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include "complex_wrapper.h"
#include "longdouble.h"
/* INDENT OFF */
/* INDENT ON */
long double r, u, v, t, x, y, S, C;
x = LD_RE(z);
y = LD_IM(z);
x = fabsl(x);
y = fabsl(y);
if (y == zero) { /* ctanh(x,0) = (x,0) for x = 0 or NaN */
else if (isinfl(x)) { /* x is inf */
} else {
}
} else if (ix >= 0x4004e000) {
/* INDENT OFF */
/*
* |x| > 60 = prec/2 (14,28,34,60)
* ctanh z ~ 1 + i (sin2y)/(exp(2x))
*/
/* INDENT ON */
S = sinl(y + y);
else {
(void) sincosl(y, &S, &C);
S = (S + S) * C;
}
if (isnanl(x)) /* x is NaN */
else
} else
} else
/* 2 sin 2y / exp(2x) */
} else {
/* INDENT OFF */
/*
* t*t+2t
* ctanh z = ---------------------------
* t*t+[4(t+1)(cos y)](cos y)
*
* [4(t+1)(cos y)]*(sin y)
* i --------------------------
* t*t+[4(t+1)(cos y)](cos y)
*/
/* INDENT ON */
sincosl(y, &S, &C);
t = expm1l(x + x);
u = t * t;
v = one / (u + r * C);
}
if (hx < 0)
if (hy < 0)
return (ans);
}