aboutsummaryrefslogtreecommitdiff
path: root/math/s_ctanh_template.c
diff options
context:
space:
mode:
Diffstat (limited to 'math/s_ctanh_template.c')
-rw-r--r--math/s_ctanh_template.c69
1 files changed, 35 insertions, 34 deletions
diff --git a/math/s_ctanh_template.c b/math/s_ctanh_template.c
index 2d18875..a7b7ebc 100644
--- a/math/s_ctanh_template.c
+++ b/math/s_ctanh_template.c
@@ -1,4 +1,4 @@
-/* Complex hyperbole tangent for double.
+/* Complex hyperbolic tangent for float types.
Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@@ -23,33 +23,33 @@
#include <math_private.h>
#include <float.h>
-__complex__ double
-__ctanh (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__ctanh) (CFLOAT x)
{
- __complex__ double res;
+ CFLOAT res;
if (__glibc_unlikely (!isfinite (__real__ x) || !isfinite (__imag__ x)))
{
if (isinf (__real__ x))
{
- __real__ res = __copysign (1.0, __real__ x);
- if (isfinite (__imag__ x) && fabs (__imag__ x) > 1.0)
+ __real__ res = M_COPYSIGN (1, __real__ x);
+ if (isfinite (__imag__ x) && M_FABS (__imag__ x) > 1)
{
- double sinix, cosix;
- __sincos (__imag__ x, &sinix, &cosix);
- __imag__ res = __copysign (0.0, sinix * cosix);
+ FLOAT sinix, cosix;
+ M_SINCOS (__imag__ x, &sinix, &cosix);
+ __imag__ res = M_COPYSIGN (0, sinix * cosix);
}
else
- __imag__ res = __copysign (0.0, __imag__ x);
+ __imag__ res = M_COPYSIGN (0, __imag__ x);
}
- else if (__imag__ x == 0.0)
+ else if (__imag__ x == 0)
{
res = x;
}
else
{
- __real__ res = __nan ("");
- __imag__ res = __nan ("");
+ __real__ res = M_NAN;
+ __imag__ res = M_NAN;
if (isinf (__imag__ x))
feraiseexcept (FE_INVALID);
@@ -57,34 +57,34 @@ __ctanh (__complex__ double x)
}
else
{
- double sinix, cosix;
- double den;
- const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2 / 2);
+ FLOAT sinix, cosix;
+ FLOAT den;
+ const int t = (int) ((M_MAX_EXP - 1) * M_MLIT (M_LN2) / 2);
/* tanh(x+iy) = (sinh(2x) + i*sin(2y))/(cosh(2x) + cos(2y))
= (sinh(x)*cosh(x) + i*sin(y)*cos(y))/(sinh(x)^2 + cos(y)^2). */
- if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
+ if (__glibc_likely (M_FABS (__imag__ x) > M_MIN))
{
- __sincos (__imag__ x, &sinix, &cosix);
+ M_SINCOS (__imag__ x, &sinix, &cosix);
}
else
{
sinix = __imag__ x;
- cosix = 1.0;
+ cosix = 1;
}
- if (fabs (__real__ x) > t)
+ if (M_FABS (__real__ x) > t)
{
/* Avoid intermediate overflow when the imaginary part of
the result may be subnormal. Ignoring negligible terms,
the real part is +/- 1, the imaginary part is
sin(y)*cos(y)/sinh(x)^2 = 4*sin(y)*cos(y)/exp(2x). */
- double exp_2t = __ieee754_exp (2 * t);
+ FLOAT exp_2t = M_EXP (2 * t);
- __real__ res = __copysign (1.0, __real__ x);
+ __real__ res = M_COPYSIGN (1, __real__ x);
__imag__ res = 4 * sinix * cosix;
- __real__ x = fabs (__real__ x);
+ __real__ x = M_FABS (__real__ x);
__real__ x -= t;
__imag__ res /= exp_2t;
if (__real__ x > t)
@@ -94,23 +94,23 @@ __ctanh (__complex__ double x)
__imag__ res /= exp_2t;
}
else
- __imag__ res /= __ieee754_exp (2 * __real__ x);
+ __imag__ res /= M_EXP (2 * __real__ x);
}
else
{
- double sinhrx, coshrx;
- if (fabs (__real__ x) > DBL_MIN)
+ FLOAT sinhrx, coshrx;
+ if (M_FABS (__real__ x) > M_MIN)
{
- sinhrx = __ieee754_sinh (__real__ x);
- coshrx = __ieee754_cosh (__real__ x);
+ sinhrx = M_SINH (__real__ x);
+ coshrx = M_COSH (__real__ x);
}
else
{
sinhrx = __real__ x;
- coshrx = 1.0;
+ coshrx = 1;
}
- if (fabs (sinhrx) > fabs (cosix) * DBL_EPSILON)
+ if (M_FABS (sinhrx) > M_FABS (cosix) * M_EPSILON)
den = sinhrx * sinhrx + cosix * cosix;
else
den = cosix * cosix;
@@ -122,8 +122,9 @@ __ctanh (__complex__ double x)
return res;
}
-weak_alias (__ctanh, ctanh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__ctanh, __ctanhl)
-weak_alias (__ctanh, ctanhl)
+
+declare_mgen_alias (__ctanh, ctanh)
+
+#if M_LIBM_NEED_COMPAT (ctanh)
+declare_mgen_libm_compat (__ctanh, ctanh)
#endif