aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul E. Murphy <murphyp@linux.vnet.ibm.com>2016-06-28 08:49:23 -0500
committerPaul E. Murphy <murphyp@linux.vnet.ibm.com>2016-08-19 16:46:41 -0500
commitc50eee19c447d3f2c182dc3a22f2b01a053dca41 (patch)
tree3b5f0d5c832bad20fce31502026f27fd6915ea8f
parentffb84f5e197aaa9d46a35df84689c75d689d73cb (diff)
downloadglibc-c50eee19c447d3f2c182dc3a22f2b01a053dca41.zip
glibc-c50eee19c447d3f2c182dc3a22f2b01a053dca41.tar.gz
glibc-c50eee19c447d3f2c182dc3a22f2b01a053dca41.tar.bz2
Convert _Complex sine functions to generated code
Refactor s_c{,a}sin{,h}{f,,l} into a single templated macro.
-rw-r--r--ChangeLog52
-rw-r--r--math/Makefile13
-rw-r--r--math/k_casinh.c210
-rw-r--r--math/k_casinh_template.c181
-rw-r--r--math/k_casinhf.c212
-rw-r--r--math/k_casinhl.c219
-rw-r--r--math/s_casin.c66
-rw-r--r--math/s_casin_template.c31
-rw-r--r--math/s_casinf.c64
-rw-r--r--math/s_casinh.c73
-rw-r--r--math/s_casinh_template.c34
-rw-r--r--math/s_casinhf.c71
-rw-r--r--math/s_casinhl.c69
-rw-r--r--math/s_casinl.c62
-rw-r--r--math/s_csin.c171
-rw-r--r--math/s_csin_template.c79
-rw-r--r--math/s_csinf.c169
-rw-r--r--math/s_csinh.c166
-rw-r--r--math/s_csinh_template.c79
-rw-r--r--math/s_csinhf.c164
-rw-r--r--math/s_csinhl.c162
-rw-r--r--math/s_csinl.c167
-rw-r--r--sysdeps/alpha/fpu/s_casinf.c12
-rw-r--r--sysdeps/alpha/fpu/s_casinhf.c12
-rw-r--r--sysdeps/alpha/fpu/s_csinf.c12
-rw-r--r--sysdeps/alpha/fpu/s_csinhf.c12
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casin.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casinh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casinhl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_casinl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csin.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csinh.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csinhl.c6
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_csinl.c6
-rw-r--r--sysdeps/m68k/m680x0/fpu/s_csin_template.c (renamed from sysdeps/m68k/m680x0/fpu/s_csin.c)18
-rw-r--r--sysdeps/m68k/m680x0/fpu/s_csinf.c3
-rw-r--r--sysdeps/m68k/m680x0/fpu/s_csinh_template.c (renamed from sysdeps/m68k/m680x0/fpu/s_csinh.c)17
-rw-r--r--sysdeps/m68k/m680x0/fpu/s_csinhf.c3
-rw-r--r--sysdeps/m68k/m680x0/fpu/s_csinhl.c3
-rw-r--r--sysdeps/m68k/m680x0/fpu/s_csinl.c3
40 files changed, 303 insertions, 2354 deletions
diff --git a/ChangeLog b/ChangeLog
index b097cd4..18ae1c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,57 @@
2016-08-19 Paul E. Murphy <murphyp@linux.vnet.ibm.com>
+ * math/Makefile (gen-libm-calls): Move
+ casin, casinh, csin, csinh here.
+ (libm-calls): Remove the above.
+
+ * math/s_casin_template.c: Update using type-generic macros.
+ * math/s_casinh_template.c: Likewise.
+ * math/s_csin_template.c: Likewise.
+ * math/s_csinh_template.c: Likewise.
+ * math/k_casinh_template.c: Likewise.
+
+ * math/s_casinf.c: Removed.
+ * math/s_casin.c: Removed.
+ * math/s_casinl.c: Removed.
+ * math/s_casinh.c: Removed.
+ * math/s_casinhf.c: Removed.
+ * math/s_casinhl.c: Removed.
+ * math/s_csin.c: Removed.
+ * math/s_csinf.c: Removed.
+ * math/s_csinl.c: Removed.
+ * math/s_csinh.c: Removed.
+ * math/s_csinhf.c: Removed.
+ * math/s_csinhl.c: Removed.
+ * math/k_casinh.c: Removed.
+ * math/k_casinhf.c: Removed.
+ * math/k_casinhl.c: Removed.
+
+ * sysdeps/alpha/fpu/s_casinf.c: Refactor using templated version.
+ * sysdeps/alpha/fpu/s_casinhf.c: Likewise.
+ * sysdeps/alpha/fpu/s_csinf.c: Likewise.
+ * sysdeps/alpha/fpu/s_csinhf.c: Likewise.
+
+ * sysdeps/ieee754/ldbl-opt/s_casin.c: Removed.
+ * sysdeps/ieee754/ldbl-opt/s_casinh.c: Removed.
+ * sysdeps/ieee754/ldbl-opt/s_casinhl.c: Removed.
+ * sysdeps/ieee754/ldbl-opt/s_casinl.c: Removed.
+ * sysdeps/ieee754/ldbl-opt/s_csin.c: Removed.
+ * sysdeps/ieee754/ldbl-opt/s_csinh.c: Removed.
+ * sysdeps/ieee754/ldbl-opt/s_csinhl.c: Removed.
+ * sysdeps/ieee754/ldbl-opt/s_csinl.c: Removed.
+
+ * sysdeps/m68k/m680x0/fpu/s_csin.c: Refactor into ...
+ * sysdeps/m68k/m680x0/fpu/s_csin_template.c: New file.
+ * sysdeps/m68k/m680x0/fpu/s_csinf.c: Removed.
+ * sysdeps/m68k/m680x0/fpu/s_csinl.c: Removed.
+
+ * sysdeps/m68k/m680x0/fpu/s_csinh.c: Refactor into.
+ * sysdeps/m68k/m680x0/fpu/s_csinh_template.c: New file.
+ * sysdeps/m68k/m680x0/fpu/s_csinhf.c: Removed.
+ * sysdeps/m68k/m680x0/fpu/s_csinhl.c: Removed.
+
+2016-08-19 Paul E. Murphy <murphyp@linux.vnet.ibm.com>
+
* s_casin_template.c: Copy of s_casin.c.
* s_casinh_template.c: Copy of s_casinh.c.
* s_csin_template.c: Copy of s_csin.c.
diff --git a/math/Makefile b/math/Makefile
index e02b430..8873a9e 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -45,8 +45,9 @@ libm-support = s_lib_version s_matherr s_signgam \
# Wrappers for these functions generated per type using a file named
# <func>_template.c and the appropriate math-type-macros-<TYPE>.h.
-gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF \
- s_cacoshF s_ccosF s_ccoshF
+gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF \
+ s_cacoshF s_ccosF s_ccoshF s_casinF s_csinF s_casinhF \
+ k_casinhF s_csinhF
libm-calls = \
e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \
@@ -64,11 +65,11 @@ libm-calls = \
w_ilogbF \
s_fpclassifyF s_fmaxF s_fminF s_fdimF s_nanF s_truncF \
s_remquoF e_log2F e_exp2F s_roundF s_nearbyintF s_sincosF \
- s_cexpF s_csinhF s_clogF \
- s_catanF s_casinF s_csinF s_ctanF s_ctanhF \
- s_casinhF s_catanhF s_csqrtF s_cpowF s_cprojF s_clog10F \
+ s_cexpF s_clogF \
+ s_catanF s_ctanF s_ctanhF \
+ s_catanhF s_csqrtF s_cpowF s_cprojF s_clog10F \
s_fmaF s_lrintF s_llrintF s_lroundF s_llroundF e_exp10F w_log2F \
- s_issignalingF $(calls:s_%=m_%) x2y2m1F k_casinhF \
+ s_issignalingF $(calls:s_%=m_%) x2y2m1F \
gamma_productF lgamma_negF lgamma_productF \
s_nextupF s_nextdownF $(gen-libm-calls)
diff --git a/math/k_casinh.c b/math/k_casinh.c
deleted file mode 100644
index 354dde1..0000000
--- a/math/k_casinh.c
+++ /dev/null
@@ -1,210 +0,0 @@
-/* Return arc hyperbole sine for double value, with the imaginary part
- of the result possibly adjusted for use in computing other
- functions.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-/* Return the complex inverse hyperbolic sine of finite nonzero Z,
- with the imaginary part of the result subtracted from pi/2 if ADJ
- is nonzero. */
-
-__complex__ double
-__kernel_casinh (__complex__ double x, int adj)
-{
- __complex__ double res;
- double rx, ix;
- __complex__ double y;
-
- /* Avoid cancellation by reducing to the first quadrant. */
- rx = fabs (__real__ x);
- ix = fabs (__imag__ x);
-
- if (rx >= 1.0 / DBL_EPSILON || ix >= 1.0 / DBL_EPSILON)
- {
- /* For large x in the first quadrant, x + csqrt (1 + x * x)
- is sufficiently close to 2 * x to make no significant
- difference to the result; avoid possible overflow from
- the squaring and addition. */
- __real__ y = rx;
- __imag__ y = ix;
-
- if (adj)
- {
- double t = __real__ y;
- __real__ y = __copysign (__imag__ y, __imag__ x);
- __imag__ y = t;
- }
-
- res = __clog (y);
- __real__ res += M_LN2;
- }
- else if (rx >= 0.5 && ix < DBL_EPSILON / 8.0)
- {
- double s = __ieee754_hypot (1.0, rx);
-
- __real__ res = __ieee754_log (rx + s);
- if (adj)
- __imag__ res = __ieee754_atan2 (s, __imag__ x);
- else
- __imag__ res = __ieee754_atan2 (ix, s);
- }
- else if (rx < DBL_EPSILON / 8.0 && ix >= 1.5)
- {
- double s = __ieee754_sqrt ((ix + 1.0) * (ix - 1.0));
-
- __real__ res = __ieee754_log (ix + s);
- if (adj)
- __imag__ res = __ieee754_atan2 (rx, __copysign (s, __imag__ x));
- else
- __imag__ res = __ieee754_atan2 (s, rx);
- }
- else if (ix > 1.0 && ix < 1.5 && rx < 0.5)
- {
- if (rx < DBL_EPSILON * DBL_EPSILON)
- {
- double ix2m1 = (ix + 1.0) * (ix - 1.0);
- double s = __ieee754_sqrt (ix2m1);
-
- __real__ res = __log1p (2.0 * (ix2m1 + ix * s)) / 2.0;
- if (adj)
- __imag__ res = __ieee754_atan2 (rx, __copysign (s, __imag__ x));
- else
- __imag__ res = __ieee754_atan2 (s, rx);
- }
- else
- {
- double ix2m1 = (ix + 1.0) * (ix - 1.0);
- double rx2 = rx * rx;
- double f = rx2 * (2.0 + rx2 + 2.0 * ix * ix);
- double d = __ieee754_sqrt (ix2m1 * ix2m1 + f);
- double dp = d + ix2m1;
- double dm = f / dp;
- double r1 = __ieee754_sqrt ((dm + rx2) / 2.0);
- double r2 = rx * ix / r1;
-
- __real__ res = __log1p (rx2 + dp + 2.0 * (rx * r1 + ix * r2)) / 2.0;
- if (adj)
- __imag__ res = __ieee754_atan2 (rx + r1, __copysign (ix + r2,
- __imag__ x));
- else
- __imag__ res = __ieee754_atan2 (ix + r2, rx + r1);
- }
- }
- else if (ix == 1.0 && rx < 0.5)
- {
- if (rx < DBL_EPSILON / 8.0)
- {
- __real__ res = __log1p (2.0 * (rx + __ieee754_sqrt (rx))) / 2.0;
- if (adj)
- __imag__ res = __ieee754_atan2 (__ieee754_sqrt (rx),
- __copysign (1.0, __imag__ x));
- else
- __imag__ res = __ieee754_atan2 (1.0, __ieee754_sqrt (rx));
- }
- else
- {
- double d = rx * __ieee754_sqrt (4.0 + rx * rx);
- double s1 = __ieee754_sqrt ((d + rx * rx) / 2.0);
- double s2 = __ieee754_sqrt ((d - rx * rx) / 2.0);
-
- __real__ res = __log1p (rx * rx + d + 2.0 * (rx * s1 + s2)) / 2.0;
- if (adj)
- __imag__ res = __ieee754_atan2 (rx + s1, __copysign (1.0 + s2,
- __imag__ x));
- else
- __imag__ res = __ieee754_atan2 (1.0 + s2, rx + s1);
- }
- }
- else if (ix < 1.0 && rx < 0.5)
- {
- if (ix >= DBL_EPSILON)
- {
- if (rx < DBL_EPSILON * DBL_EPSILON)
- {
- double onemix2 = (1.0 + ix) * (1.0 - ix);
- double s = __ieee754_sqrt (onemix2);
-
- __real__ res = __log1p (2.0 * rx / s) / 2.0;
- if (adj)
- __imag__ res = __ieee754_atan2 (s, __imag__ x);
- else
- __imag__ res = __ieee754_atan2 (ix, s);
- }
- else
- {
- double onemix2 = (1.0 + ix) * (1.0 - ix);
- double rx2 = rx * rx;
- double f = rx2 * (2.0 + rx2 + 2.0 * ix * ix);
- double d = __ieee754_sqrt (onemix2 * onemix2 + f);
- double dp = d + onemix2;
- double dm = f / dp;
- double r1 = __ieee754_sqrt ((dp + rx2) / 2.0);
- double r2 = rx * ix / r1;
-
- __real__ res
- = __log1p (rx2 + dm + 2.0 * (rx * r1 + ix * r2)) / 2.0;
- if (adj)
- __imag__ res = __ieee754_atan2 (rx + r1,
- __copysign (ix + r2,
- __imag__ x));
- else
- __imag__ res = __ieee754_atan2 (ix + r2, rx + r1);
- }
- }
- else
- {
- double s = __ieee754_hypot (1.0, rx);
-
- __real__ res = __log1p (2.0 * rx * (rx + s)) / 2.0;
- if (adj)
- __imag__ res = __ieee754_atan2 (s, __imag__ x);
- else
- __imag__ res = __ieee754_atan2 (ix, s);
- }
- math_check_force_underflow_nonneg (__real__ res);
- }
- else
- {
- __real__ y = (rx - ix) * (rx + ix) + 1.0;
- __imag__ y = 2.0 * rx * ix;
-
- y = __csqrt (y);
-
- __real__ y += rx;
- __imag__ y += ix;
-
- if (adj)
- {
- double t = __real__ y;
- __real__ y = __copysign (__imag__ y, __imag__ x);
- __imag__ y = t;
- }
-
- res = __clog (y);
- }
-
- /* Give results the correct sign for the original argument. */
- __real__ res = __copysign (__real__ res, __real__ x);
- __imag__ res = __copysign (__imag__ res, (adj ? 1.0 : __imag__ x));
-
- return res;
-}
diff --git a/math/k_casinh_template.c b/math/k_casinh_template.c
index 354dde1..74626b1 100644
--- a/math/k_casinh_template.c
+++ b/math/k_casinh_template.c
@@ -1,6 +1,6 @@
-/* Return arc hyperbole sine for double value, with the imaginary part
- of the result possibly adjusted for use in computing other
- functions.
+/* Return arc hyperbolic sine for a complex float type, with the
+ imaginary part of the result possibly adjusted for use in
+ computing other functions.
Copyright (C) 1997-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -27,18 +27,18 @@
with the imaginary part of the result subtracted from pi/2 if ADJ
is nonzero. */
-__complex__ double
-__kernel_casinh (__complex__ double x, int adj)
+CFLOAT
+M_DECL_FUNC (__kernel_casinh) (CFLOAT x, int adj)
{
- __complex__ double res;
- double rx, ix;
- __complex__ double y;
+ CFLOAT res;
+ FLOAT rx, ix;
+ CFLOAT y;
/* Avoid cancellation by reducing to the first quadrant. */
- rx = fabs (__real__ x);
- ix = fabs (__imag__ x);
+ rx = M_FABS (__real__ x);
+ ix = M_FABS (__imag__ x);
- if (rx >= 1.0 / DBL_EPSILON || ix >= 1.0 / DBL_EPSILON)
+ if (rx >= 1 / M_EPSILON || ix >= 1 / M_EPSILON)
{
/* For large x in the first quadrant, x + csqrt (1 + x * x)
is sufficiently close to 2 * x to make no significant
@@ -49,162 +49,157 @@ __kernel_casinh (__complex__ double x, int adj)
if (adj)
{
- double t = __real__ y;
- __real__ y = __copysign (__imag__ y, __imag__ x);
+ FLOAT t = __real__ y;
+ __real__ y = M_COPYSIGN (__imag__ y, __imag__ x);
__imag__ y = t;
}
- res = __clog (y);
- __real__ res += M_LN2;
+ res = M_SUF (__clog) (y);
+ __real__ res += (FLOAT) M_MLIT (M_LN2);
}
- else if (rx >= 0.5 && ix < DBL_EPSILON / 8.0)
+ else if (rx >= M_LIT (0.5) && ix < M_EPSILON / 8)
{
- double s = __ieee754_hypot (1.0, rx);
+ FLOAT s = M_HYPOT (1, rx);
- __real__ res = __ieee754_log (rx + s);
+ __real__ res = M_LOG (rx + s);
if (adj)
- __imag__ res = __ieee754_atan2 (s, __imag__ x);
+ __imag__ res = M_ATAN2 (s, __imag__ x);
else
- __imag__ res = __ieee754_atan2 (ix, s);
+ __imag__ res = M_ATAN2 (ix, s);
}
- else if (rx < DBL_EPSILON / 8.0 && ix >= 1.5)
+ else if (rx < M_EPSILON / 8 && ix >= M_LIT (1.5))
{
- double s = __ieee754_sqrt ((ix + 1.0) * (ix - 1.0));
+ FLOAT s = M_SQRT ((ix + 1) * (ix - 1));
- __real__ res = __ieee754_log (ix + s);
+ __real__ res = M_LOG (ix + s);
if (adj)
- __imag__ res = __ieee754_atan2 (rx, __copysign (s, __imag__ x));
+ __imag__ res = M_ATAN2 (rx, M_COPYSIGN (s, __imag__ x));
else
- __imag__ res = __ieee754_atan2 (s, rx);
+ __imag__ res = M_ATAN2 (s, rx);
}
- else if (ix > 1.0 && ix < 1.5 && rx < 0.5)
+ else if (ix > 1 && ix < M_LIT (1.5) && rx < M_LIT (0.5))
{
- if (rx < DBL_EPSILON * DBL_EPSILON)
+ if (rx < M_EPSILON * M_EPSILON)
{
- double ix2m1 = (ix + 1.0) * (ix - 1.0);
- double s = __ieee754_sqrt (ix2m1);
+ FLOAT ix2m1 = (ix + 1) * (ix - 1);
+ FLOAT s = M_SQRT (ix2m1);
- __real__ res = __log1p (2.0 * (ix2m1 + ix * s)) / 2.0;
+ __real__ res = M_LOG1P (2 * (ix2m1 + ix * s)) / 2;
if (adj)
- __imag__ res = __ieee754_atan2 (rx, __copysign (s, __imag__ x));
+ __imag__ res = M_ATAN2 (rx, M_COPYSIGN (s, __imag__ x));
else
- __imag__ res = __ieee754_atan2 (s, rx);
+ __imag__ res = M_ATAN2 (s, rx);
}
else
{
- double ix2m1 = (ix + 1.0) * (ix - 1.0);
- double rx2 = rx * rx;
- double f = rx2 * (2.0 + rx2 + 2.0 * ix * ix);
- double d = __ieee754_sqrt (ix2m1 * ix2m1 + f);
- double dp = d + ix2m1;
- double dm = f / dp;
- double r1 = __ieee754_sqrt ((dm + rx2) / 2.0);
- double r2 = rx * ix / r1;
-
- __real__ res = __log1p (rx2 + dp + 2.0 * (rx * r1 + ix * r2)) / 2.0;
+ FLOAT ix2m1 = (ix + 1) * (ix - 1);
+ FLOAT rx2 = rx * rx;
+ FLOAT f = rx2 * (2 + rx2 + 2 * ix * ix);
+ FLOAT d = M_SQRT (ix2m1 * ix2m1 + f);
+ FLOAT dp = d + ix2m1;
+ FLOAT dm = f / dp;
+ FLOAT r1 = M_SQRT ((dm + rx2) / 2);
+ FLOAT r2 = rx * ix / r1;
+
+ __real__ res = M_LOG1P (rx2 + dp + 2 * (rx * r1 + ix * r2)) / 2;
if (adj)
- __imag__ res = __ieee754_atan2 (rx + r1, __copysign (ix + r2,
- __imag__ x));
+ __imag__ res = M_ATAN2 (rx + r1, M_COPYSIGN (ix + r2, __imag__ x));
else
- __imag__ res = __ieee754_atan2 (ix + r2, rx + r1);
+ __imag__ res = M_ATAN2 (ix + r2, rx + r1);
}
}
- else if (ix == 1.0 && rx < 0.5)
+ else if (ix == 1 && rx < M_LIT (0.5))
{
- if (rx < DBL_EPSILON / 8.0)
+ if (rx < M_EPSILON / 8)
{
- __real__ res = __log1p (2.0 * (rx + __ieee754_sqrt (rx))) / 2.0;
+ __real__ res = M_LOG1P (2 * (rx + M_SQRT (rx))) / 2;
if (adj)
- __imag__ res = __ieee754_atan2 (__ieee754_sqrt (rx),
- __copysign (1.0, __imag__ x));
+ __imag__ res = M_ATAN2 (M_SQRT (rx), M_COPYSIGN (1, __imag__ x));
else
- __imag__ res = __ieee754_atan2 (1.0, __ieee754_sqrt (rx));
+ __imag__ res = M_ATAN2 (1, M_SQRT (rx));
}
else
{
- double d = rx * __ieee754_sqrt (4.0 + rx * rx);
- double s1 = __ieee754_sqrt ((d + rx * rx) / 2.0);
- double s2 = __ieee754_sqrt ((d - rx * rx) / 2.0);
+ FLOAT d = rx * M_SQRT (4 + rx * rx);
+ FLOAT s1 = M_SQRT ((d + rx * rx) / 2);
+ FLOAT s2 = M_SQRT ((d - rx * rx) / 2);
- __real__ res = __log1p (rx * rx + d + 2.0 * (rx * s1 + s2)) / 2.0;
+ __real__ res = M_LOG1P (rx * rx + d + 2 * (rx * s1 + s2)) / 2;
if (adj)
- __imag__ res = __ieee754_atan2 (rx + s1, __copysign (1.0 + s2,
- __imag__ x));
+ __imag__ res = M_ATAN2 (rx + s1, M_COPYSIGN (1 + s2, __imag__ x));
else
- __imag__ res = __ieee754_atan2 (1.0 + s2, rx + s1);
+ __imag__ res = M_ATAN2 (1 + s2, rx + s1);
}
}
- else if (ix < 1.0 && rx < 0.5)
+ else if (ix < 1 && rx < M_LIT (0.5))
{
- if (ix >= DBL_EPSILON)
+ if (ix >= M_EPSILON)
{
- if (rx < DBL_EPSILON * DBL_EPSILON)
+ if (rx < M_EPSILON * M_EPSILON)
{
- double onemix2 = (1.0 + ix) * (1.0 - ix);
- double s = __ieee754_sqrt (onemix2);
+ FLOAT onemix2 = (1 + ix) * (1 - ix);
+ FLOAT s = M_SQRT (onemix2);
- __real__ res = __log1p (2.0 * rx / s) / 2.0;
+ __real__ res = M_LOG1P (2 * rx / s) / 2;
if (adj)
- __imag__ res = __ieee754_atan2 (s, __imag__ x);
+ __imag__ res = M_ATAN2 (s, __imag__ x);
else
- __imag__ res = __ieee754_atan2 (ix, s);
+ __imag__ res = M_ATAN2 (ix, s);
}
else
{
- double onemix2 = (1.0 + ix) * (1.0 - ix);
- double rx2 = rx * rx;
- double f = rx2 * (2.0 + rx2 + 2.0 * ix * ix);
- double d = __ieee754_sqrt (onemix2 * onemix2 + f);
- double dp = d + onemix2;
- double dm = f / dp;
- double r1 = __ieee754_sqrt ((dp + rx2) / 2.0);
- double r2 = rx * ix / r1;
-
- __real__ res
- = __log1p (rx2 + dm + 2.0 * (rx * r1 + ix * r2)) / 2.0;
+ FLOAT onemix2 = (1 + ix) * (1 - ix);
+ FLOAT rx2 = rx * rx;
+ FLOAT f = rx2 * (2 + rx2 + 2 * ix * ix);
+ FLOAT d = M_SQRT (onemix2 * onemix2 + f);
+ FLOAT dp = d + onemix2;
+ FLOAT dm = f / dp;
+ FLOAT r1 = M_SQRT ((dp + rx2) / 2);
+ FLOAT r2 = rx * ix / r1;
+
+ __real__ res = M_LOG1P (rx2 + dm + 2 * (rx * r1 + ix * r2)) / 2;
if (adj)
- __imag__ res = __ieee754_atan2 (rx + r1,
- __copysign (ix + r2,
- __imag__ x));
+ __imag__ res = M_ATAN2 (rx + r1, M_COPYSIGN (ix + r2,
+ __imag__ x));
else
- __imag__ res = __ieee754_atan2 (ix + r2, rx + r1);
+ __imag__ res = M_ATAN2 (ix + r2, rx + r1);
}
}
else
{
- double s = __ieee754_hypot (1.0, rx);
+ FLOAT s = M_HYPOT (1, rx);
- __real__ res = __log1p (2.0 * rx * (rx + s)) / 2.0;
+ __real__ res = M_LOG1P (2 * rx * (rx + s)) / 2;
if (adj)
- __imag__ res = __ieee754_atan2 (s, __imag__ x);
+ __imag__ res = M_ATAN2 (s, __imag__ x);
else
- __imag__ res = __ieee754_atan2 (ix, s);
+ __imag__ res = M_ATAN2 (ix, s);
}
math_check_force_underflow_nonneg (__real__ res);
}
else
{
- __real__ y = (rx - ix) * (rx + ix) + 1.0;
- __imag__ y = 2.0 * rx * ix;
+ __real__ y = (rx - ix) * (rx + ix) + 1;
+ __imag__ y = 2 * rx * ix;
- y = __csqrt (y);
+ y = M_SUF (__csqrt) (y);
__real__ y += rx;
__imag__ y += ix;
if (adj)
{
- double t = __real__ y;
- __real__ y = __copysign (__imag__ y, __imag__ x);
+ FLOAT t = __real__ y;
+ __real__ y = M_COPYSIGN (__imag__ y, __imag__ x);
__imag__ y = t;
}
- res = __clog (y);
+ res = M_SUF (__clog) (y);
}
/* Give results the correct sign for the original argument. */
- __real__ res = __copysign (__real__ res, __real__ x);
- __imag__ res = __copysign (__imag__ res, (adj ? 1.0 : __imag__ x));
+ __real__ res = M_COPYSIGN (__real__ res, __real__ x);
+ __imag__ res = M_COPYSIGN (__imag__ res, (adj ? 1 : __imag__ x));
return res;
}
diff --git a/math/k_casinhf.c b/math/k_casinhf.c
deleted file mode 100644
index 7697f31..0000000
--- a/math/k_casinhf.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* Return arc hyperbole sine for float value, with the imaginary part
- of the result possibly adjusted for use in computing other
- functions.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-/* Return the complex inverse hyperbolic sine of finite nonzero Z,
- with the imaginary part of the result subtracted from pi/2 if ADJ
- is nonzero. */
-
-__complex__ float
-__kernel_casinhf (__complex__ float x, int adj)
-{
- __complex__ float res;
- float rx, ix;
- __complex__ float y;
-
- /* Avoid cancellation by reducing to the first quadrant. */
- rx = fabsf (__real__ x);
- ix = fabsf (__imag__ x);
-
- if (rx >= 1.0f / FLT_EPSILON || ix >= 1.0f / FLT_EPSILON)
- {
- /* For large x in the first quadrant, x + csqrt (1 + x * x)
- is sufficiently close to 2 * x to make no significant
- difference to the result; avoid possible overflow from
- the squaring and addition. */
- __real__ y = rx;
- __imag__ y = ix;
-
- if (adj)
- {
- float t = __real__ y;
- __real__ y = __copysignf (__imag__ y, __imag__ x);
- __imag__ y = t;
- }
-
- res = __clogf (y);
- __real__ res += (float) M_LN2;
- }
- else if (rx >= 0.5f && ix < FLT_EPSILON / 8.0f)
- {
- float s = __ieee754_hypotf (1.0f, rx);
-
- __real__ res = __ieee754_logf (rx + s);
- if (adj)
- __imag__ res = __ieee754_atan2f (s, __imag__ x);
- else
- __imag__ res = __ieee754_atan2f (ix, s);
- }
- else if (rx < FLT_EPSILON / 8.0f && ix >= 1.5f)
- {
- float s = __ieee754_sqrtf ((ix + 1.0f) * (ix - 1.0f));
-
- __real__ res = __ieee754_logf (ix + s);
- if (adj)
- __imag__ res = __ieee754_atan2f (rx, __copysignf (s, __imag__ x));
- else
- __imag__ res = __ieee754_atan2f (s, rx);
- }
- else if (ix > 1.0f && ix < 1.5f && rx < 0.5f)
- {
- if (rx < FLT_EPSILON * FLT_EPSILON)
- {
- float ix2m1 = (ix + 1.0f) * (ix - 1.0f);
- float s = __ieee754_sqrtf (ix2m1);
-
- __real__ res = __log1pf (2.0f * (ix2m1 + ix * s)) / 2.0f;
- if (adj)
- __imag__ res = __ieee754_atan2f (rx, __copysignf (s, __imag__ x));
- else
- __imag__ res = __ieee754_atan2f (s, rx);
- }
- else
- {
- float ix2m1 = (ix + 1.0f) * (ix - 1.0f);
- float rx2 = rx * rx;
- float f = rx2 * (2.0f + rx2 + 2.0f * ix * ix);
- float d = __ieee754_sqrtf (ix2m1 * ix2m1 + f);
- float dp = d + ix2m1;
- float dm = f / dp;
- float r1 = __ieee754_sqrtf ((dm + rx2) / 2.0f);
- float r2 = rx * ix / r1;
-
- __real__ res
- = __log1pf (rx2 + dp + 2.0f * (rx * r1 + ix * r2)) / 2.0f;
- if (adj)
- __imag__ res = __ieee754_atan2f (rx + r1, __copysignf (ix + r2,
- __imag__ x));
- else
- __imag__ res = __ieee754_atan2f (ix + r2, rx + r1);
- }
- }
- else if (ix == 1.0f && rx < 0.5f)
- {
- if (rx < FLT_EPSILON / 8.0f)
- {
- __real__ res = __log1pf (2.0f * (rx + __ieee754_sqrtf (rx))) / 2.0f;
- if (adj)
- __imag__ res = __ieee754_atan2f (__ieee754_sqrtf (rx),
- __copysignf (1.0f, __imag__ x));
- else
- __imag__ res = __ieee754_atan2f (1.0f, __ieee754_sqrtf (rx));
- }
- else
- {
- float d = rx * __ieee754_sqrtf (4.0f + rx * rx);
- float s1 = __ieee754_sqrtf ((d + rx * rx) / 2.0f);
- float s2 = __ieee754_sqrtf ((d - rx * rx) / 2.0f);
-
- __real__ res = __log1pf (rx * rx + d + 2.0f * (rx * s1 + s2)) / 2.0f;
- if (adj)
- __imag__ res = __ieee754_atan2f (rx + s1,
- __copysignf (1.0f + s2,
- __imag__ x));
- else
- __imag__ res = __ieee754_atan2f (1.0f + s2, rx + s1);
- }
- }
- else if (ix < 1.0f && rx < 0.5f)
- {
- if (ix >= FLT_EPSILON)
- {
- if (rx < FLT_EPSILON * FLT_EPSILON)
- {
- float onemix2 = (1.0f + ix) * (1.0f - ix);
- float s = __ieee754_sqrtf (onemix2);
-
- __real__ res = __log1pf (2.0f * rx / s) / 2.0f;
- if (adj)
- __imag__ res = __ieee754_atan2f (s, __imag__ x);
- else
- __imag__ res = __ieee754_atan2f (ix, s);
- }
- else
- {
- float onemix2 = (1.0f + ix) * (1.0f - ix);
- float rx2 = rx * rx;
- float f = rx2 * (2.0f + rx2 + 2.0f * ix * ix);
- float d = __ieee754_sqrtf (onemix2 * onemix2 + f);
- float dp = d + onemix2;
- float dm = f / dp;
- float r1 = __ieee754_sqrtf ((dp + rx2) / 2.0f);
- float r2 = rx * ix / r1;
-
- __real__ res
- = __log1pf (rx2 + dm + 2.0f * (rx * r1 + ix * r2)) / 2.0f;
- if (adj)
- __imag__ res = __ieee754_atan2f (rx + r1,
- __copysignf (ix + r2,
- __imag__ x));
- else
- __imag__ res = __ieee754_atan2f (ix + r2, rx + r1);
- }
- }
- else
- {
- float s = __ieee754_hypotf (1.0f, rx);
-
- __real__ res = __log1pf (2.0f * rx * (rx + s)) / 2.0f;
- if (adj)
- __imag__ res = __ieee754_atan2f (s, __imag__ x);
- else
- __imag__ res = __ieee754_atan2f (ix, s);
- }
- math_check_force_underflow_nonneg (__real__ res);
- }
- else
- {
- __real__ y = (rx - ix) * (rx + ix) + 1.0f;
- __imag__ y = 2.0f * rx * ix;
-
- y = __csqrtf (y);
-
- __real__ y += rx;
- __imag__ y += ix;
-
- if (adj)
- {
- float t = __real__ y;
- __real__ y = __copysignf (__imag__ y, __imag__ x);
- __imag__ y = t;
- }
-
- res = __clogf (y);
- }
-
- /* Give results the correct sign for the original argument. */
- __real__ res = __copysignf (__real__ res, __real__ x);
- __imag__ res = __copysignf (__imag__ res, (adj ? 1.0f : __imag__ x));
-
- return res;
-}
diff --git a/math/k_casinhl.c b/math/k_casinhl.c
deleted file mode 100644
index 7c4b9c3..0000000
--- a/math/k_casinhl.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/* Return arc hyperbole sine for long double value, with the imaginary
- part of the result possibly adjusted for use in computing other
- functions.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-/* To avoid spurious overflows, use this definition to treat IBM long
- double as approximating an IEEE-style format. */
-#if LDBL_MANT_DIG == 106
-# undef LDBL_EPSILON
-# define LDBL_EPSILON 0x1p-106L
-#endif
-
-/* Return the complex inverse hyperbolic sine of finite nonzero Z,
- with the imaginary part of the result subtracted from pi/2 if ADJ
- is nonzero. */
-
-__complex__ long double
-__kernel_casinhl (__complex__ long double x, int adj)
-{
- __complex__ long double res;
- long double rx, ix;
- __complex__ long double y;
-
- /* Avoid cancellation by reducing to the first quadrant. */
- rx = fabsl (__real__ x);
- ix = fabsl (__imag__ x);
-
- if (rx >= 1.0L / LDBL_EPSILON || ix >= 1.0L / LDBL_EPSILON)
- {
- /* For large x in the first quadrant, x + csqrt (1 + x * x)
- is sufficiently close to 2 * x to make no significant
- difference to the result; avoid possible overflow from
- the squaring and addition. */
- __real__ y = rx;
- __imag__ y = ix;
-
- if (adj)
- {
- long double t = __real__ y;
- __real__ y = __copysignl (__imag__ y, __imag__ x);
- __imag__ y = t;
- }
-
- res = __clogl (y);
- __real__ res += M_LN2l;
- }
- else if (rx >= 0.5L && ix < LDBL_EPSILON / 8.0L)
- {
- long double s = __ieee754_hypotl (1.0L, rx);
-
- __real__ res = __ieee754_logl (rx + s);
- if (adj)
- __imag__ res = __ieee754_atan2l (s, __imag__ x);
- else
- __imag__ res = __ieee754_atan2l (ix, s);
- }
- else if (rx < LDBL_EPSILON / 8.0L && ix >= 1.5L)
- {
- long double s = __ieee754_sqrtl ((ix + 1.0L) * (ix - 1.0L));
-
- __real__ res = __ieee754_logl (ix + s);
- if (adj)
- __imag__ res = __ieee754_atan2l (rx, __copysignl (s, __imag__ x));
- else
- __imag__ res = __ieee754_atan2l (s, rx);
- }
- else if (ix > 1.0L && ix < 1.5L && rx < 0.5L)
- {
- if (rx < LDBL_EPSILON * LDBL_EPSILON)
- {
- long double ix2m1 = (ix + 1.0L) * (ix - 1.0L);
- long double s = __ieee754_sqrtl (ix2m1);
-
- __real__ res = __log1pl (2.0L * (ix2m1 + ix * s)) / 2.0L;
- if (adj)
- __imag__ res = __ieee754_atan2l (rx, __copysignl (s, __imag__ x));
- else
- __imag__ res = __ieee754_atan2l (s, rx);
- }
- else
- {
- long double ix2m1 = (ix + 1.0L) * (ix - 1.0L);
- long double rx2 = rx * rx;
- long double f = rx2 * (2.0L + rx2 + 2.0L * ix * ix);
- long double d = __ieee754_sqrtl (ix2m1 * ix2m1 + f);
- long double dp = d + ix2m1;
- long double dm = f / dp;
- long double r1 = __ieee754_sqrtl ((dm + rx2) / 2.0L);
- long double r2 = rx * ix / r1;
-
- __real__ res
- = __log1pl (rx2 + dp + 2.0L * (rx * r1 + ix * r2)) / 2.0L;
- if (adj)
- __imag__ res = __ieee754_atan2l (rx + r1, __copysignl (ix + r2,
- __imag__ x));
- else
- __imag__ res = __ieee754_atan2l (ix + r2, rx + r1);
- }
- }
- else if (ix == 1.0L && rx < 0.5L)
- {
- if (rx < LDBL_EPSILON / 8.0L)
- {
- __real__ res = __log1pl (2.0L * (rx + __ieee754_sqrtl (rx))) / 2.0L;
- if (adj)
- __imag__ res = __ieee754_atan2l (__ieee754_sqrtl (rx),
- __copysignl (1.0L, __imag__ x));
- else
- __imag__ res = __ieee754_atan2l (1.0L, __ieee754_sqrtl (rx));
- }
- else
- {
- long double d = rx * __ieee754_sqrtl (4.0L + rx * rx);
- long double s1 = __ieee754_sqrtl ((d + rx * rx) / 2.0L);
- long double s2 = __ieee754_sqrtl ((d - rx * rx) / 2.0L);
-
- __real__ res = __log1pl (rx * rx + d + 2.0L * (rx * s1 + s2)) / 2.0L;
- if (adj)
- __imag__ res = __ieee754_atan2l (rx + s1,
- __copysignl (1.0L + s2,
- __imag__ x));
- else
- __imag__ res = __ieee754_atan2l (1.0L + s2, rx + s1);
- }
- }
- else if (ix < 1.0L && rx < 0.5L)
- {
- if (ix >= LDBL_EPSILON)
- {
- if (rx < LDBL_EPSILON * LDBL_EPSILON)
- {
- long double onemix2 = (1.0L + ix) * (1.0L - ix);
- long double s = __ieee754_sqrtl (onemix2);
-
- __real__ res = __log1pl (2.0L * rx / s) / 2.0L;
- if (adj)
- __imag__ res = __ieee754_atan2l (s, __imag__ x);
- else
- __imag__ res = __ieee754_atan2l (ix, s);
- }
- else
- {
- long double onemix2 = (1.0L + ix) * (1.0L - ix);
- long double rx2 = rx * rx;
- long double f = rx2 * (2.0L + rx2 + 2.0L * ix * ix);
- long double d = __ieee754_sqrtl (onemix2 * onemix2 + f);
- long double dp = d + onemix2;
- long double dm = f / dp;
- long double r1 = __ieee754_sqrtl ((dp + rx2) / 2.0L);
- long double r2 = rx * ix / r1;
-
- __real__ res
- = __log1pl (rx2 + dm + 2.0L * (rx * r1 + ix * r2)) / 2.0L;
- if (adj)
- __imag__ res = __ieee754_atan2l (rx + r1,
- __copysignl (ix + r2,
- __imag__ x));
- else
- __imag__ res = __ieee754_atan2l (ix + r2, rx + r1);
- }
- }
- else
- {
- long double s = __ieee754_hypotl (1.0L, rx);
-
- __real__ res = __log1pl (2.0L * rx * (rx + s)) / 2.0L;
- if (adj)
- __imag__ res = __ieee754_atan2l (s, __imag__ x);
- else
- __imag__ res = __ieee754_atan2l (ix, s);
- }
- math_check_force_underflow_nonneg (__real__ res);
- }
- else
- {
- __real__ y = (rx - ix) * (rx + ix) + 1.0L;
- __imag__ y = 2.0L * rx * ix;
-
- y = __csqrtl (y);
-
- __real__ y += rx;
- __imag__ y += ix;
-
- if (adj)
- {
- long double t = __real__ y;
- __real__ y = __copysignl (__imag__ y, __imag__ x);
- __imag__ y = t;
- }
-
- res = __clogl (y);
- }
-
- /* Give results the correct sign for the original argument. */
- __real__ res = __copysignl (__real__ res, __real__ x);
- __imag__ res = __copysignl (__imag__ res, (adj ? 1.0L : __imag__ x));
-
- return res;
-}
diff --git a/math/s_casin.c b/math/s_casin.c
deleted file mode 100644
index a37933b..0000000
--- a/math/s_casin.c
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Return arc sine of complex double value.
- 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.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-
-
-__complex__ double
-__casin (__complex__ double x)
-{
- __complex__ double res;
-
- if (isnan (__real__ x) || isnan (__imag__ x))
- {
- if (__real__ x == 0.0)
- {
- res = x;
- }
- else if (isinf (__real__ x) || isinf (__imag__ x))
- {
- __real__ res = __nan ("");
- __imag__ res = __copysign (HUGE_VAL, __imag__ x);
- }
- else
- {
- __real__ res = __nan ("");
- __imag__ res = __nan ("");
- }
- }
- else
- {
- __complex__ double y;
-
- __real__ y = -__imag__ x;
- __imag__ y = __real__ x;
-
- y = __casinh (y);
-
- __real__ res = __imag__ y;
- __imag__ res = -__real__ y;
- }
-
- return res;
-}
-weak_alias (__casin, casin)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__casin, __casinl)
-weak_alias (__casin, casinl)
-#endif
diff --git a/math/s_casin_template.c b/math/s_casin_template.c
index a37933b..5b1e979 100644
--- a/math/s_casin_template.c
+++ b/math/s_casin_template.c
@@ -1,4 +1,4 @@
-/* Return arc sine of complex double value.
+/* Return arc sine of a complex float type.
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.
@@ -22,36 +22,36 @@
#include <math_private.h>
-__complex__ double
-__casin (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__casin) (CFLOAT x)
{
- __complex__ double res;
+ CFLOAT res;
if (isnan (__real__ x) || isnan (__imag__ x))
{
- if (__real__ x == 0.0)
+ if (__real__ x == 0)
{
res = x;
}
else if (isinf (__real__ x) || isinf (__imag__ x))
{
- __real__ res = __nan ("");
- __imag__ res = __copysign (HUGE_VAL, __imag__ x);
+ __real__ res = M_NAN;
+ __imag__ res = M_COPYSIGN (M_HUGE_VAL, __imag__ x);
}
else
{
- __real__ res = __nan ("");
- __imag__ res = __nan ("");
+ __real__ res = M_NAN;
+ __imag__ res = M_NAN;
}
}
else
{
- __complex__ double y;
+ CFLOAT y;
__real__ y = -__imag__ x;
__imag__ y = __real__ x;
- y = __casinh (y);
+ y = M_SUF (__casinh) (y);
__real__ res = __imag__ y;
__imag__ res = -__real__ y;
@@ -59,8 +59,9 @@ __casin (__complex__ double x)
return res;
}
-weak_alias (__casin, casin)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__casin, __casinl)
-weak_alias (__casin, casinl)
+
+declare_mgen_alias (__casin, casin)
+
+#if M_LIBM_NEED_COMPAT (casin)
+declare_mgen_libm_compat (__casin, casin)
#endif
diff --git a/math/s_casinf.c b/math/s_casinf.c
deleted file mode 100644
index ccb5766..0000000
--- a/math/s_casinf.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Return arc sine of complex float value.
- 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.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-
-
-__complex__ float
-__casinf (__complex__ float x)
-{
- __complex__ float res;
-
- if (isnan (__real__ x) || isnan (__imag__ x))
- {
- if (__real__ x == 0.0)
- {
- res = x;
- }
- else if (isinf (__real__ x) || isinf (__imag__ x))
- {
- __real__ res = __nanf ("");
- __imag__ res = __copysignf (HUGE_VALF, __imag__ x);
- }
- else
- {
- __real__ res = __nanf ("");
- __imag__ res = __nanf ("");
- }
- }
- else
- {
- __complex__ float y;
-
- __real__ y = -__imag__ x;
- __imag__ y = __real__ x;
-
- y = __casinhf (y);
-
- __real__ res = __imag__ y;
- __imag__ res = -__real__ y;
- }
-
- return res;
-}
-#ifndef __casinf
-weak_alias (__casinf, casinf)
-#endif
diff --git a/math/s_casinh.c b/math/s_casinh.c
deleted file mode 100644
index 32cbc13..0000000
--- a/math/s_casinh.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Return arc hyperbole sine for double value.
- 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.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-
-__complex__ double
-__casinh (__complex__ double x)
-{
- __complex__ double res;
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
- {
- if (icls == FP_INFINITE)
- {
- __real__ res = __copysign (HUGE_VAL, __real__ x);
-
- if (rcls == FP_NAN)
- __imag__ res = __nan ("");
- else
- __imag__ res = __copysign (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
- __imag__ x);
- }
- else if (rcls <= FP_INFINITE)
- {
- __real__ res = __real__ x;
- if ((rcls == FP_INFINITE && icls >= FP_ZERO)
- || (rcls == FP_NAN && icls == FP_ZERO))
- __imag__ res = __copysign (0.0, __imag__ x);
- else
- __imag__ res = __nan ("");
- }
- else
- {
- __real__ res = __nan ("");
- __imag__ res = __nan ("");
- }
- }
- else if (rcls == FP_ZERO && icls == FP_ZERO)
- {
- res = x;
- }
- else
- {
- res = __kernel_casinh (x, 0);
- }
-
- return res;
-}
-weak_alias (__casinh, casinh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__casinh, __casinhl)
-weak_alias (__casinh, casinhl)
-#endif
diff --git a/math/s_casinh_template.c b/math/s_casinh_template.c
index 32cbc13..fd29e63 100644
--- a/math/s_casinh_template.c
+++ b/math/s_casinh_template.c
@@ -1,4 +1,4 @@
-/* Return arc hyperbole sine for double value.
+/* Return arc hyperbolic sine for a complex float type.
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.
@@ -21,10 +21,10 @@
#include <math.h>
#include <math_private.h>
-__complex__ double
-__casinh (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__casinh) (CFLOAT x)
{
- __complex__ double res;
+ CFLOAT res;
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
@@ -32,12 +32,13 @@ __casinh (__complex__ double x)
{
if (icls == FP_INFINITE)
{
- __real__ res = __copysign (HUGE_VAL, __real__ x);
+ __real__ res = M_COPYSIGN (M_HUGE_VAL, __real__ x);
if (rcls == FP_NAN)
- __imag__ res = __nan ("");
+ __imag__ res = M_NAN;
else
- __imag__ res = __copysign (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
+ __imag__ res = M_COPYSIGN ((rcls >= FP_ZERO
+ ? M_MLIT (M_PI_2) : M_MLIT (M_PI_4)),
__imag__ x);
}
else if (rcls <= FP_INFINITE)
@@ -45,14 +46,14 @@ __casinh (__complex__ double x)
__real__ res = __real__ x;
if ((rcls == FP_INFINITE && icls >= FP_ZERO)
|| (rcls == FP_NAN && icls == FP_ZERO))
- __imag__ res = __copysign (0.0, __imag__ x);
+ __imag__ res = M_COPYSIGN (0, __imag__ x);
else
- __imag__ res = __nan ("");
+ __imag__ res = M_NAN;
}
else
{
- __real__ res = __nan ("");
- __imag__ res = __nan ("");
+ __real__ res = M_NAN;
+ __imag__ res = M_NAN;
}
}
else if (rcls == FP_ZERO && icls == FP_ZERO)
@@ -61,13 +62,14 @@ __casinh (__complex__ double x)
}
else
{
- res = __kernel_casinh (x, 0);
+ res = M_SUF (__kernel_casinh) (x, 0);
}
return res;
}
-weak_alias (__casinh, casinh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__casinh, __casinhl)
-weak_alias (__casinh, casinhl)
+
+declare_mgen_alias (__casinh, casinh)
+
+#if M_LIBM_NEED_COMPAT (casinh)
+declare_mgen_libm_compat (__casinh, casinh)
#endif
diff --git a/math/s_casinhf.c b/math/s_casinhf.c
deleted file mode 100644
index 8d08b4b..0000000
--- a/math/s_casinhf.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* Return arc hyperbole sine for float value.
- 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.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-
-__complex__ float
-__casinhf (__complex__ float x)
-{
- __complex__ float res;
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
- {
- if (icls == FP_INFINITE)
- {
- __real__ res = __copysignf (HUGE_VALF, __real__ x);
-
- if (rcls == FP_NAN)
- __imag__ res = __nanf ("");
- else
- __imag__ res = __copysignf (rcls >= FP_ZERO ? M_PI_2 : M_PI_4,
- __imag__ x);
- }
- else if (rcls <= FP_INFINITE)
- {
- __real__ res = __real__ x;
- if ((rcls == FP_INFINITE && icls >= FP_ZERO)
- || (rcls == FP_NAN && icls == FP_ZERO))
- __imag__ res = __copysignf (0.0, __imag__ x);
- else
- __imag__ res = __nanf ("");
- }
- else
- {
- __real__ res = __nanf ("");
- __imag__ res = __nanf ("");
- }
- }
- else if (rcls == FP_ZERO && icls == FP_ZERO)
- {
- res = x;
- }
- else
- {
- res = __kernel_casinhf (x, 0);
- }
-
- return res;
-}
-#ifndef __casinhf
-weak_alias (__casinhf, casinhf)
-#endif
diff --git a/math/s_casinhl.c b/math/s_casinhl.c
deleted file mode 100644
index 81d888e..0000000
--- a/math/s_casinhl.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Return arc hyperbole sine for long double value.
- 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.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-
-__complex__ long double
-__casinhl (__complex__ long double x)
-{
- __complex__ long double res;
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- if (rcls <= FP_INFINITE || icls <= FP_INFINITE)
- {
- if (icls == FP_INFINITE)
- {
- __real__ res = __copysignl (HUGE_VALL, __real__ x);
-
- if (rcls == FP_NAN)
- __imag__ res = __nanl ("");
- else
- __imag__ res = __copysignl (rcls >= FP_ZERO ? M_PI_2l : M_PI_4l,
- __imag__ x);
- }
- else if (rcls <= FP_INFINITE)
- {
- __real__ res = __real__ x;
- if ((rcls == FP_INFINITE && icls >= FP_ZERO)
- || (rcls == FP_NAN && icls == FP_ZERO))
- __imag__ res = __copysignl (0.0, __imag__ x);
- else
- __imag__ res = __nanl ("");
- }
- else
- {
- __real__ res = __nanl ("");
- __imag__ res = __nanl ("");
- }
- }
- else if (rcls == FP_ZERO && icls == FP_ZERO)
- {
- res = x;
- }
- else
- {
- res = __kernel_casinhl (x, 0);
- }
-
- return res;
-}
-weak_alias (__casinhl, casinhl)
diff --git a/math/s_casinl.c b/math/s_casinl.c
deleted file mode 100644
index 95f25bb..0000000
--- a/math/s_casinl.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Return arc sine of complex long double value.
- 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.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <complex.h>
-#include <math.h>
-#include <math_private.h>
-
-
-__complex__ long double
-__casinl (__complex__ long double x)
-{
- __complex__ long double res;
-
- if (isnan (__real__ x) || isnan (__imag__ x))
- {
- if (__real__ x == 0.0)
- {
- res = x;
- }
- else if (isinf (__real__ x) || isinf (__imag__ x))
- {
- __real__ res = __nanl ("");
- __imag__ res = __copysignl (HUGE_VALL, __imag__ x);
- }
- else
- {
- __real__ res = __nanl ("");
- __imag__ res = __nanl ("");
- }
- }
- else
- {
- __complex__ long double y;
-
- __real__ y = -__imag__ x;
- __imag__ y = __real__ x;
-
- y = __casinhl (y);
-
- __real__ res = __imag__ y;
- __imag__ res = -__real__ y;
- }
-
- return res;
-}
-weak_alias (__casinl, casinl)
diff --git a/math/s_csin.c b/math/s_csin.c
deleted file mode 100644
index e071aa6..0000000
--- a/math/s_csin.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/* Complex sine function for double.
- 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.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ double
-__csin (__complex__ double x)
-{
- __complex__ double retval;
- int negate = signbit (__real__ x);
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- __real__ x = fabs (__real__ x);
-
- if (__glibc_likely (icls >= FP_ZERO))
- {
- /* Imaginary part is finite. */
- if (__glibc_likely (rcls >= FP_ZERO))
- {
- /* Real part is finite. */
- const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
- double sinix, cosix;
-
- if (__glibc_likely (__real__ x > DBL_MIN))
- {
- __sincos (__real__ x, &sinix, &cosix);
- }
- else
- {
- sinix = __real__ x;
- cosix = 1.0;
- }
-
- if (negate)
- sinix = -sinix;
-
- if (fabs (__imag__ x) > t)
- {
- double exp_t = __ieee754_exp (t);
- double ix = fabs (__imag__ x);
- if (signbit (__imag__ x))
- cosix = -cosix;
- ix -= t;
- sinix *= exp_t / 2.0;
- cosix *= exp_t / 2.0;
- if (ix > t)
- {
- ix -= t;
- sinix *= exp_t;
- cosix *= exp_t;
- }
- if (ix > t)
- {
- /* Overflow (original imaginary part of x > 3t). */
- __real__ retval = DBL_MAX * sinix;
- __imag__ retval = DBL_MAX * cosix;
- }
- else
- {
- double exp_val = __ieee754_exp (ix);
- __real__ retval = exp_val * sinix;
- __imag__ retval = exp_val * cosix;
- }
- }
- else
- {
- __real__ retval = __ieee754_cosh (__imag__ x) * sinix;
- __imag__ retval = __ieee754_sinh (__imag__ x) * cosix;
- }
-
- math_check_force_underflow_complex (retval);
- }
- else
- {
- if (icls == FP_ZERO)
- {
- /* Imaginary part is 0.0. */
- __real__ retval = __nan ("");
- __imag__ retval = __imag__ x;
-
- if (rcls == FP_INFINITE)
- feraiseexcept (FE_INVALID);
- }
- else
- {
- __real__ retval = __nan ("");
- __imag__ retval = __nan ("");
-
- feraiseexcept (FE_INVALID);
- }
- }
- }
- else if (icls == FP_INFINITE)
- {
- /* Imaginary part is infinite. */
- if (rcls == FP_ZERO)
- {
- /* Real part is 0.0. */
- __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
- __imag__ retval = __imag__ x;
- }
- else if (rcls > FP_ZERO)
- {
- /* Real part is finite. */
- double sinix, cosix;
-
- if (__glibc_likely (__real__ x > DBL_MIN))
- {
- __sincos (__real__ x, &sinix, &cosix);
- }
- else
- {
- sinix = __real__ x;
- cosix = 1.0;
- }
-
- __real__ retval = __copysign (HUGE_VAL, sinix);
- __imag__ retval = __copysign (HUGE_VAL, cosix);
-
- if (negate)
- __real__ retval = -__real__ retval;
- if (signbit (__imag__ x))
- __imag__ retval = -__imag__ retval;
- }
- else
- {
- /* The addition raises the invalid exception. */
- __real__ retval = __nan ("");
- __imag__ retval = HUGE_VAL;
-
- if (rcls == FP_INFINITE)
- feraiseexcept (FE_INVALID);
- }
- }
- else
- {
- if (rcls == FP_ZERO)
- __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
- else
- __real__ retval = __nan ("");
- __imag__ retval = __nan ("");
- }
-
- return retval;
-}
-weak_alias (__csin, csin)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__csin, __csinl)
-weak_alias (__csin, csinl)
-#endif
diff --git a/math/s_csin_template.c b/math/s_csin_template.c
index e071aa6..59d8876 100644
--- a/math/s_csin_template.c
+++ b/math/s_csin_template.c
@@ -1,4 +1,4 @@
-/* Complex sine function for double.
+/* Complex sine function 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,15 +23,15 @@
#include <math_private.h>
#include <float.h>
-__complex__ double
-__csin (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__csin) (CFLOAT x)
{
- __complex__ double retval;
+ CFLOAT retval;
int negate = signbit (__real__ x);
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- __real__ x = fabs (__real__ x);
+ __real__ x = M_FABS (__real__ x);
if (__glibc_likely (icls >= FP_ZERO))
{
@@ -39,31 +39,31 @@ __csin (__complex__ double x)
if (__glibc_likely (rcls >= FP_ZERO))
{
/* Real part is finite. */
- const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
- double sinix, cosix;
+ const int t = (int) ((M_MAX_EXP - 1) * M_MLIT (M_LN2));
+ FLOAT sinix, cosix;
- if (__glibc_likely (__real__ x > DBL_MIN))
+ if (__glibc_likely (__real__ x > M_MIN))
{
- __sincos (__real__ x, &sinix, &cosix);
+ M_SINCOS (__real__ x, &sinix, &cosix);
}
else
{
sinix = __real__ x;
- cosix = 1.0;
+ cosix = 1;
}
if (negate)
sinix = -sinix;
- if (fabs (__imag__ x) > t)
+ if (M_FABS (__imag__ x) > t)
{
- double exp_t = __ieee754_exp (t);
- double ix = fabs (__imag__ x);
+ FLOAT exp_t = M_EXP (t);
+ FLOAT ix = M_FABS (__imag__ x);
if (signbit (__imag__ x))
cosix = -cosix;
ix -= t;
- sinix *= exp_t / 2.0;
- cosix *= exp_t / 2.0;
+ sinix *= exp_t / 2;
+ cosix *= exp_t / 2;
if (ix > t)
{
ix -= t;
@@ -73,20 +73,20 @@ __csin (__complex__ double x)
if (ix > t)
{
/* Overflow (original imaginary part of x > 3t). */
- __real__ retval = DBL_MAX * sinix;
- __imag__ retval = DBL_MAX * cosix;
+ __real__ retval = M_MAX * sinix;
+ __imag__ retval = M_MAX * cosix;
}
else
{
- double exp_val = __ieee754_exp (ix);
+ FLOAT exp_val = M_EXP (ix);
__real__ retval = exp_val * sinix;
__imag__ retval = exp_val * cosix;
}
}
else
{
- __real__ retval = __ieee754_cosh (__imag__ x) * sinix;
- __imag__ retval = __ieee754_sinh (__imag__ x) * cosix;
+ __real__ retval = M_COSH (__imag__ x) * sinix;
+ __imag__ retval = M_SINH (__imag__ x) * cosix;
}
math_check_force_underflow_complex (retval);
@@ -96,7 +96,7 @@ __csin (__complex__ double x)
if (icls == FP_ZERO)
{
/* Imaginary part is 0.0. */
- __real__ retval = __nan ("");
+ __real__ retval = M_NAN;
__imag__ retval = __imag__ x;
if (rcls == FP_INFINITE)
@@ -104,8 +104,8 @@ __csin (__complex__ double x)
}
else
{
- __real__ retval = __nan ("");
- __imag__ retval = __nan ("");
+ __real__ retval = M_NAN;
+ __imag__ retval = M_NAN;
feraiseexcept (FE_INVALID);
}
@@ -117,26 +117,26 @@ __csin (__complex__ double x)
if (rcls == FP_ZERO)
{
/* Real part is 0.0. */
- __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+ __real__ retval = M_COPYSIGN (0, negate ? -1 : 1);
__imag__ retval = __imag__ x;
}
else if (rcls > FP_ZERO)
{
/* Real part is finite. */
- double sinix, cosix;
+ FLOAT sinix, cosix;
- if (__glibc_likely (__real__ x > DBL_MIN))
+ if (__glibc_likely (__real__ x > M_MIN))
{
- __sincos (__real__ x, &sinix, &cosix);
+ M_SINCOS (__real__ x, &sinix, &cosix);
}
else
{
sinix = __real__ x;
- cosix = 1.0;
+ cosix = 1;
}
- __real__ retval = __copysign (HUGE_VAL, sinix);
- __imag__ retval = __copysign (HUGE_VAL, cosix);
+ __real__ retval = M_COPYSIGN (M_HUGE_VAL, sinix);
+ __imag__ retval = M_COPYSIGN (M_HUGE_VAL, cosix);
if (negate)
__real__ retval = -__real__ retval;
@@ -146,8 +146,8 @@ __csin (__complex__ double x)
else
{
/* The addition raises the invalid exception. */
- __real__ retval = __nan ("");
- __imag__ retval = HUGE_VAL;
+ __real__ retval = M_NAN;
+ __imag__ retval = M_HUGE_VAL;
if (rcls == FP_INFINITE)
feraiseexcept (FE_INVALID);
@@ -156,16 +156,17 @@ __csin (__complex__ double x)
else
{
if (rcls == FP_ZERO)
- __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
+ __real__ retval = M_COPYSIGN (0, negate ? -1 : 1);
else
- __real__ retval = __nan ("");
- __imag__ retval = __nan ("");
+ __real__ retval = M_NAN;
+ __imag__ retval = M_NAN;
}
return retval;
}
-weak_alias (__csin, csin)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__csin, __csinl)
-weak_alias (__csin, csinl)
+
+declare_mgen_alias (__csin, csin)
+
+#if M_LIBM_NEED_COMPAT (csin)
+declare_mgen_libm_compat (__csin, csin)
#endif
diff --git a/math/s_csinf.c b/math/s_csinf.c
deleted file mode 100644
index 1256abc..0000000
--- a/math/s_csinf.c
+++ /dev/null
@@ -1,169 +0,0 @@
-/* Complex sine function for float.
- 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.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ float
-__csinf (__complex__ float x)
-{
- __complex__ float retval;
- int negate = signbit (__real__ x);
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- __real__ x = fabsf (__real__ x);
-
- if (__glibc_likely (icls >= FP_ZERO))
- {
- /* Imaginary part is finite. */
- if (__glibc_likely (rcls >= FP_ZERO))
- {
- /* Real part is finite. */
- const int t = (int) ((FLT_MAX_EXP - 1) * M_LN2);
- float sinix, cosix;
-
- if (__glibc_likely (__real__ x > FLT_MIN))
- {
- __sincosf (__real__ x, &sinix, &cosix);
- }
- else
- {
- sinix = __real__ x;
- cosix = 1.0f;
- }
-
- if (negate)
- sinix = -sinix;
-
- if (fabsf (__imag__ x) > t)
- {
- float exp_t = __ieee754_expf (t);
- float ix = fabsf (__imag__ x);
- if (signbit (__imag__ x))
- cosix = -cosix;
- ix -= t;
- sinix *= exp_t / 2.0f;
- cosix *= exp_t / 2.0f;
- if (ix > t)
- {
- ix -= t;
- sinix *= exp_t;
- cosix *= exp_t;
- }
- if (ix > t)
- {
- /* Overflow (original imaginary part of x > 3t). */
- __real__ retval = FLT_MAX * sinix;
- __imag__ retval = FLT_MAX * cosix;
- }
- else
- {
- float exp_val = __ieee754_expf (ix);
- __real__ retval = exp_val * sinix;
- __imag__ retval = exp_val * cosix;
- }
- }
- else
- {
- __real__ retval = __ieee754_coshf (__imag__ x) * sinix;
- __imag__ retval = __ieee754_sinhf (__imag__ x) * cosix;
- }
-
- math_check_force_underflow_complex (retval);
- }
- else
- {
- if (icls == FP_ZERO)
- {
- /* Imaginary part is 0.0. */
- __real__ retval = __nanf ("");
- __imag__ retval = __imag__ x;
-
- if (rcls == FP_INFINITE)
- feraiseexcept (FE_INVALID);
- }
- else
- {
- __real__ retval = __nanf ("");
- __imag__ retval = __nanf ("");
-
- feraiseexcept (FE_INVALID);
- }
- }
- }
- else if (icls == FP_INFINITE)
- {
- /* Imaginary part is infinite. */
- if (rcls == FP_ZERO)
- {
- /* Real part is 0.0. */
- __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
- __imag__ retval = __imag__ x;
- }
- else if (rcls > FP_ZERO)
- {
- /* Real part is finite. */
- float sinix, cosix;
-
- if (__glibc_likely (__real__ x > FLT_MIN))
- {
- __sincosf (__real__ x, &sinix, &cosix);
- }
- else
- {
- sinix = __real__ x;
- cosix = 1.0f;
- }
-
- __real__ retval = __copysignf (HUGE_VALF, sinix);
- __imag__ retval = __copysignf (HUGE_VALF, cosix);
-
- if (negate)
- __real__ retval = -__real__ retval;
- if (signbit (__imag__ x))
- __imag__ retval = -__imag__ retval;
- }
- else
- {
- /* The addition raises the invalid exception. */
- __real__ retval = __nanf ("");
- __imag__ retval = HUGE_VALF;
-
- if (rcls == FP_INFINITE)
- feraiseexcept (FE_INVALID);
- }
- }
- else
- {
- if (rcls == FP_ZERO)
- __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
- else
- __real__ retval = __nanf ("");
- __imag__ retval = __nanf ("");
- }
-
- return retval;
-}
-#ifndef __csinf
-weak_alias (__csinf, csinf)
-#endif
diff --git a/math/s_csinh.c b/math/s_csinh.c
deleted file mode 100644
index 5fb60ed..0000000
--- a/math/s_csinh.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* Complex sine hyperbole function for double.
- 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.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ double
-__csinh (__complex__ double x)
-{
- __complex__ double retval;
- int negate = signbit (__real__ x);
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- __real__ x = fabs (__real__ x);
-
- if (__glibc_likely (rcls >= FP_ZERO))
- {
- /* Real part is finite. */
- if (__glibc_likely (icls >= FP_ZERO))
- {
- /* Imaginary part is finite. */
- const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
- double sinix, cosix;
-
- if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
- {
- __sincos (__imag__ x, &sinix, &cosix);
- }
- else
- {
- sinix = __imag__ x;
- cosix = 1.0;
- }
-
- if (negate)
- cosix = -cosix;
-
- if (fabs (__real__ x) > t)
- {
- double exp_t = __ieee754_exp (t);
- double rx = fabs (__real__ x);
- if (signbit (__real__ x))
- cosix = -cosix;
- rx -= t;
- sinix *= exp_t / 2.0;
- cosix *= exp_t / 2.0;
- if (rx > t)
- {
- rx -= t;
- sinix *= exp_t;
- cosix *= exp_t;
- }
- if (rx > t)
- {
- /* Overflow (original real part of x > 3t). */
- __real__ retval = DBL_MAX * cosix;
- __imag__ retval = DBL_MAX * sinix;
- }
- else
- {
- double exp_val = __ieee754_exp (rx);
- __real__ retval = exp_val * cosix;
- __imag__ retval = exp_val * sinix;
- }
- }
- else
- {
- __real__ retval = __ieee754_sinh (__real__ x) * cosix;
- __imag__ retval = __ieee754_cosh (__real__ x) * sinix;
- }
-
- math_check_force_underflow_complex (retval);
- }
- else
- {
- if (rcls == FP_ZERO)
- {
- /* Real part is 0.0. */
- __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
- __imag__ retval = __nan ("") + __nan ("");
-
- if (icls == FP_INFINITE)
- feraiseexcept (FE_INVALID);
- }
- else
- {
- __real__ retval = __nan ("");
- __imag__ retval = __nan ("");
-
- feraiseexcept (FE_INVALID);
- }
- }
- }
- else if (rcls == FP_INFINITE)
- {
- /* Real part is infinite. */
- if (__glibc_likely (icls > FP_ZERO))
- {
- /* Imaginary part is finite. */
- double sinix, cosix;
-
- if (__glibc_likely (fabs (__imag__ x) > DBL_MIN))
- {
- __sincos (__imag__ x, &sinix, &cosix);
- }
- else
- {
- sinix = __imag__ x;
- cosix = 1.0;
- }
-
- __real__ retval = __copysign (HUGE_VAL, cosix);
- __imag__ retval = __copysign (HUGE_VAL, sinix);
-
- if (negate)
- __real__ retval = -__real__ retval;
- }
- else if (icls == FP_ZERO)
- {
- /* Imaginary part is 0.0. */
- __real__ retval = negate ? -HUGE_VAL : HUGE_VAL;
- __imag__ retval = __imag__ x;
- }
- else
- {
- /* The addition raises the invalid exception. */
- __real__ retval = HUGE_VAL;
- __imag__ retval = __nan ("") + __nan ("");
-
- if (icls == FP_INFINITE)
- feraiseexcept (FE_INVALID);
- }
- }
- else
- {
- __real__ retval = __nan ("");
- __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
- }
-
- return retval;
-}
-weak_alias (__csinh, csinh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__csinh, __csinhl)
-weak_alias (__csinh, csinhl)
-#endif
diff --git a/math/s_csinh_template.c b/math/s_csinh_template.c
index 5fb60ed..22c0c31 100644
--- a/math/s_csinh_template.c
+++ b/math/s_csinh_template.c
@@ -1,4 +1,4 @@
-/* Complex sine hyperbole function for double.
+/* Complex sine hyperbole function 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,15 +23,15 @@
#include <math_private.h>
#include <float.h>
-__complex__ double
-__csinh (__complex__ double x)
+CFLOAT
+M_DECL_FUNC (__csinh) (CFLOAT x)
{
- __complex__ double retval;
+ CFLOAT retval;
int negate = signbit (__real__ x);
int rcls = fpclassify (__real__ x);
int icls = fpclassify (__imag__ x);
- __real__ x = fabs (__real__ x);
+ __real__ x = M_FABS (__real__ x);
if (__glibc_likely (rcls >= FP_ZERO))
{
@@ -39,31 +39,31 @@ __csinh (__complex__ double x)
if (__glibc_likely (icls >= FP_ZERO))
{
/* Imaginary part is finite. */
- const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2);
- double sinix, cosix;
+ const int t = (int) ((M_MAX_EXP - 1) * M_MLIT (M_LN2));
+ FLOAT sinix, cosix;
- 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 (negate)
cosix = -cosix;
- if (fabs (__real__ x) > t)
+ if (M_FABS (__real__ x) > t)
{
- double exp_t = __ieee754_exp (t);
- double rx = fabs (__real__ x);
+ FLOAT exp_t = M_EXP (t);
+ FLOAT rx = M_FABS (__real__ x);
if (signbit (__real__ x))
cosix = -cosix;
rx -= t;
- sinix *= exp_t / 2.0;
- cosix *= exp_t / 2.0;
+ sinix *= exp_t / 2;
+ cosix *= exp_t / 2;
if (rx > t)
{
rx -= t;
@@ -73,20 +73,20 @@ __csinh (__complex__ double x)
if (rx > t)
{
/* Overflow (original real part of x > 3t). */
- __real__ retval = DBL_MAX * cosix;
- __imag__ retval = DBL_MAX * sinix;
+ __real__ retval = M_MAX * cosix;
+ __imag__ retval = M_MAX * sinix;
}
else
{
- double exp_val = __ieee754_exp (rx);
+ FLOAT exp_val = M_EXP (rx);
__real__ retval = exp_val * cosix;
__imag__ retval = exp_val * sinix;
}
}
else
{
- __real__ retval = __ieee754_sinh (__real__ x) * cosix;
- __imag__ retval = __ieee754_cosh (__real__ x) * sinix;
+ __real__ retval = M_SINH (__real__ x) * cosix;
+ __imag__ retval = M_COSH (__real__ x) * sinix;
}
math_check_force_underflow_complex (retval);
@@ -96,16 +96,16 @@ __csinh (__complex__ double x)
if (rcls == FP_ZERO)
{
/* Real part is 0.0. */
- __real__ retval = __copysign (0.0, negate ? -1.0 : 1.0);
- __imag__ retval = __nan ("") + __nan ("");
+ __real__ retval = M_COPYSIGN (0, negate ? -1 : 1);
+ __imag__ retval = M_NAN + M_NAN;
if (icls == FP_INFINITE)
feraiseexcept (FE_INVALID);
}
else
{
- __real__ retval = __nan ("");
- __imag__ retval = __nan ("");
+ __real__ retval = M_NAN;
+ __imag__ retval = M_NAN;
feraiseexcept (FE_INVALID);
}
@@ -117,20 +117,20 @@ __csinh (__complex__ double x)
if (__glibc_likely (icls > FP_ZERO))
{
/* Imaginary part is finite. */
- double sinix, cosix;
+ FLOAT sinix, cosix;
- 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;
}
- __real__ retval = __copysign (HUGE_VAL, cosix);
- __imag__ retval = __copysign (HUGE_VAL, sinix);
+ __real__ retval = M_COPYSIGN (M_HUGE_VAL, cosix);
+ __imag__ retval = M_COPYSIGN (M_HUGE_VAL, sinix);
if (negate)
__real__ retval = -__real__ retval;
@@ -138,14 +138,14 @@ __csinh (__complex__ double x)
else if (icls == FP_ZERO)
{
/* Imaginary part is 0.0. */
- __real__ retval = negate ? -HUGE_VAL : HUGE_VAL;
+ __real__ retval = negate ? -M_HUGE_VAL : M_HUGE_VAL;
__imag__ retval = __imag__ x;
}
else
{
/* The addition raises the invalid exception. */
- __real__ retval = HUGE_VAL;
- __imag__ retval = __nan ("") + __nan ("");
+ __real__ retval = M_HUGE_VAL;
+ __imag__ retval = M_NAN + M_NAN;
if (icls == FP_INFINITE)
feraiseexcept (FE_INVALID);
@@ -153,14 +153,15 @@ __csinh (__complex__ double x)
}
else
{
- __real__ retval = __nan ("");
- __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nan ("");
+ __real__ retval = M_NAN;
+ __imag__ retval = __imag__ x == 0 ? __imag__ x : M_NAN;
}
return retval;
}
-weak_alias (__csinh, csinh)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__csinh, __csinhl)
-weak_alias (__csinh, csinhl)
+
+declare_mgen_alias (__csinh, csinh)
+
+#if M_LIBM_NEED_COMPAT (csinh)
+declare_mgen_libm_compat (__csinh, csinh)
#endif
diff --git a/math/s_csinhf.c b/math/s_csinhf.c
deleted file mode 100644
index 36b42ca..0000000
--- a/math/s_csinhf.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Complex sine hyperbole function for float.
- 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.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ float
-__csinhf (__complex__ float x)
-{
- __complex__ float retval;
- int negate = signbit (__real__ x);
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- __real__ x = fabsf (__real__ x);
-
- if (__glibc_likely (rcls >= FP_ZERO))
- {
- /* Real part is finite. */
- if (__glibc_likely (icls >= FP_ZERO))
- {
- /* Imaginary part is finite. */
- const int t = (int) ((FLT_MAX_EXP - 1) * M_LN2);
- float sinix, cosix;
-
- if (__glibc_likely (fabsf (__imag__ x) > FLT_MIN))
- {
- __sincosf (__imag__ x, &sinix, &cosix);
- }
- else
- {
- sinix = __imag__ x;
- cosix = 1.0f;
- }
-
- if (negate)
- cosix = -cosix;
-
- if (fabsf (__real__ x) > t)
- {
- float exp_t = __ieee754_expf (t);
- float rx = fabsf (__real__ x);
- if (signbit (__real__ x))
- cosix = -cosix;
- rx -= t;
- sinix *= exp_t / 2.0f;
- cosix *= exp_t / 2.0f;
- if (rx > t)
- {
- rx -= t;
- sinix *= exp_t;
- cosix *= exp_t;
- }
- if (rx > t)
- {
- /* Overflow (original real part of x > 3t). */
- __real__ retval = FLT_MAX * cosix;
- __imag__ retval = FLT_MAX * sinix;
- }
- else
- {
- float exp_val = __ieee754_expf (rx);
- __real__ retval = exp_val * cosix;
- __imag__ retval = exp_val * sinix;
- }
- }
- else
- {
- __real__ retval = __ieee754_sinhf (__real__ x) * cosix;
- __imag__ retval = __ieee754_coshf (__real__ x) * sinix;
- }
-
- math_check_force_underflow_complex (retval);
- }
- else
- {
- if (rcls == FP_ZERO)
- {
- /* Real part is 0.0. */
- __real__ retval = __copysignf (0.0, negate ? -1.0 : 1.0);
- __imag__ retval = __nanf ("") + __nanf ("");
-
- if (icls == FP_INFINITE)
- feraiseexcept (FE_INVALID);
- }
- else
- {
- __real__ retval = __nanf ("");
- __imag__ retval = __nanf ("");
-
- feraiseexcept (FE_INVALID);
- }
- }
- }
- else if (rcls == FP_INFINITE)
- {
- /* Real part is infinite. */
- if (__glibc_likely (icls > FP_ZERO))
- {
- /* Imaginary part is finite. */
- float sinix, cosix;
-
- if (__glibc_likely (fabsf (__imag__ x) > FLT_MIN))
- {
- __sincosf (__imag__ x, &sinix, &cosix);
- }
- else
- {
- sinix = __imag__ x;
- cosix = 1.0f;
- }
-
- __real__ retval = __copysignf (HUGE_VALF, cosix);
- __imag__ retval = __copysignf (HUGE_VALF, sinix);
-
- if (negate)
- __real__ retval = -__real__ retval;
- }
- else if (icls == FP_ZERO)
- {
- /* Imaginary part is 0.0. */
- __real__ retval = negate ? -HUGE_VALF : HUGE_VALF;
- __imag__ retval = __imag__ x;
- }
- else
- {
- /* The addition raises the invalid exception. */
- __real__ retval = HUGE_VALF;
- __imag__ retval = __nanf ("") + __nanf ("");
-
- if (icls == FP_INFINITE)
- feraiseexcept (FE_INVALID);
- }
- }
- else
- {
- __real__ retval = __nanf ("");
- __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanf ("");
- }
-
- return retval;
-}
-#ifndef __csinhf
-weak_alias (__csinhf, csinhf)
-#endif
diff --git a/math/s_csinhl.c b/math/s_csinhl.c
deleted file mode 100644
index c231d7b..0000000
--- a/math/s_csinhl.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/* Complex sine hyperbole function for long double.
- 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.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ long double
-__csinhl (__complex__ long double x)
-{
- __complex__ long double retval;
- int negate = signbit (__real__ x);
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- __real__ x = fabsl (__real__ x);
-
- if (__glibc_likely (rcls >= FP_ZERO))
- {
- /* Real part is finite. */
- if (__glibc_likely (icls >= FP_ZERO))
- {
- /* Imaginary part is finite. */
- const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l);
- long double sinix, cosix;
-
- if (__glibc_likely (fabsl (__imag__ x) > LDBL_MIN))
- {
- __sincosl (__imag__ x, &sinix, &cosix);
- }
- else
- {
- sinix = __imag__ x;
- cosix = 1.0;
- }
-
- if (negate)
- cosix = -cosix;
-
- if (fabsl (__real__ x) > t)
- {
- long double exp_t = __ieee754_expl (t);
- long double rx = fabsl (__real__ x);
- if (signbit (__real__ x))
- cosix = -cosix;
- rx -= t;
- sinix *= exp_t / 2.0L;
- cosix *= exp_t / 2.0L;
- if (rx > t)
- {
- rx -= t;
- sinix *= exp_t;
- cosix *= exp_t;
- }
- if (rx > t)
- {
- /* Overflow (original real part of x > 3t). */
- __real__ retval = LDBL_MAX * cosix;
- __imag__ retval = LDBL_MAX * sinix;
- }
- else
- {
- long double exp_val = __ieee754_expl (rx);
- __real__ retval = exp_val * cosix;
- __imag__ retval = exp_val * sinix;
- }
- }
- else
- {
- __real__ retval = __ieee754_sinhl (__real__ x) * cosix;
- __imag__ retval = __ieee754_coshl (__real__ x) * sinix;
- }
-
- math_check_force_underflow_complex (retval);
- }
- else
- {
- if (rcls == FP_ZERO)
- {
- /* Real part is 0.0. */
- __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
- __imag__ retval = __nanl ("") + __nanl ("");
-
- if (icls == FP_INFINITE)
- feraiseexcept (FE_INVALID);
- }
- else
- {
- __real__ retval = __nanl ("");
- __imag__ retval = __nanl ("");
-
- feraiseexcept (FE_INVALID);
- }
- }
- }
- else if (rcls == FP_INFINITE)
- {
- /* Real part is infinite. */
- if (__glibc_likely (icls > FP_ZERO))
- {
- /* Imaginary part is finite. */
- long double sinix, cosix;
-
- if (__glibc_likely (fabsl (__imag__ x) > LDBL_MIN))
- {
- __sincosl (__imag__ x, &sinix, &cosix);
- }
- else
- {
- sinix = __imag__ x;
- cosix = 1.0;
- }
-
- __real__ retval = __copysignl (HUGE_VALL, cosix);
- __imag__ retval = __copysignl (HUGE_VALL, sinix);
-
- if (negate)
- __real__ retval = -__real__ retval;
- }
- else if (icls == FP_ZERO)
- {
- /* Imaginary part is 0.0. */
- __real__ retval = negate ? -HUGE_VALL : HUGE_VALL;
- __imag__ retval = __imag__ x;
- }
- else
- {
- /* The addition raises the invalid exception. */
- __real__ retval = HUGE_VALL;
- __imag__ retval = __nanl ("") + __nanl ("");
-
- if (icls == FP_INFINITE)
- feraiseexcept (FE_INVALID);
- }
- }
- else
- {
- __real__ retval = __nanl ("");
- __imag__ retval = __imag__ x == 0.0 ? __imag__ x : __nanl ("");
- }
-
- return retval;
-}
-weak_alias (__csinhl, csinhl)
diff --git a/math/s_csinl.c b/math/s_csinl.c
deleted file mode 100644
index 9742a31..0000000
--- a/math/s_csinl.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/* Complex sine function for long double.
- 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.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <complex.h>
-#include <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ long double
-__csinl (__complex__ long double x)
-{
- __complex__ long double retval;
- int negate = signbit (__real__ x);
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- __real__ x = fabsl (__real__ x);
-
- if (__glibc_likely (icls >= FP_ZERO))
- {
- /* Imaginary part is finite. */
- if (__glibc_likely (rcls >= FP_ZERO))
- {
- /* Real part is finite. */
- const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l);
- long double sinix, cosix;
-
- if (__glibc_likely (__real__ x > LDBL_MIN))
- {
- __sincosl (__real__ x, &sinix, &cosix);
- }
- else
- {
- sinix = __real__ x;
- cosix = 1.0;
- }
-
- if (negate)
- sinix = -sinix;
-
- if (fabsl (__imag__ x) > t)
- {
- long double exp_t = __ieee754_expl (t);
- long double ix = fabsl (__imag__ x);
- if (signbit (__imag__ x))
- cosix = -cosix;
- ix -= t;
- sinix *= exp_t / 2.0L;
- cosix *= exp_t / 2.0L;
- if (ix > t)
- {
- ix -= t;
- sinix *= exp_t;
- cosix *= exp_t;
- }
- if (ix > t)
- {
- /* Overflow (original imaginary part of x > 3t). */
- __real__ retval = LDBL_MAX * sinix;
- __imag__ retval = LDBL_MAX * cosix;
- }
- else
- {
- long double exp_val = __ieee754_expl (ix);
- __real__ retval = exp_val * sinix;
- __imag__ retval = exp_val * cosix;
- }
- }
- else
- {
- __real__ retval = __ieee754_coshl (__imag__ x) * sinix;
- __imag__ retval = __ieee754_sinhl (__imag__ x) * cosix;
- }
-
- math_check_force_underflow_complex (retval);
- }
- else
- {
- if (icls == FP_ZERO)
- {
- /* Imaginary part is 0.0. */
- __real__ retval = __nanl ("");
- __imag__ retval = __imag__ x;
-
- if (rcls == FP_INFINITE)
- feraiseexcept (FE_INVALID);
- }
- else
- {
- __real__ retval = __nanl ("");
- __imag__ retval = __nanl ("");
-
- feraiseexcept (FE_INVALID);
- }
- }
- }
- else if (icls == FP_INFINITE)
- {
- /* Imaginary part is infinite. */
- if (rcls == FP_ZERO)
- {
- /* Real part is 0.0. */
- __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
- __imag__ retval = __imag__ x;
- }
- else if (rcls > FP_ZERO)
- {
- /* Real part is finite. */
- long double sinix, cosix;
-
- if (__glibc_likely (__real__ x > LDBL_MIN))
- {
- __sincosl (__real__ x, &sinix, &cosix);
- }
- else
- {
- sinix = __real__ x;
- cosix = 1.0;
- }
-
- __real__ retval = __copysignl (HUGE_VALL, sinix);
- __imag__ retval = __copysignl (HUGE_VALL, cosix);
-
- if (negate)
- __real__ retval = -__real__ retval;
- if (signbit (__imag__ x))
- __imag__ retval = -__imag__ retval;
- }
- else
- {
- /* The addition raises the invalid exception. */
- __real__ retval = __nanl ("");
- __imag__ retval = HUGE_VALL;
-
- if (rcls == FP_INFINITE)
- feraiseexcept (FE_INVALID);
- }
- }
- else
- {
- if (rcls == FP_ZERO)
- __real__ retval = __copysignl (0.0, negate ? -1.0 : 1.0);
- else
- __real__ retval = __nanl ("");
- __imag__ retval = __nanl ("");
- }
-
- return retval;
-}
-weak_alias (__csinl, csinl)
diff --git a/sysdeps/alpha/fpu/s_casinf.c b/sysdeps/alpha/fpu/s_casinf.c
index f85f524..08d0a6d 100644
--- a/sysdeps/alpha/fpu/s_casinf.c
+++ b/sysdeps/alpha/fpu/s_casinf.c
@@ -24,14 +24,18 @@
#undef __casinf
#undef casinf
-#define __casinf internal_casinf
static _Complex float internal_casinf (_Complex float x);
-#include <math/s_casinf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_casinf
+#include <math-type-macros-float.h>
-#undef __casinf
+/* Disable any aliasing from base template. */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_casin_template.c>
+#include "cfloat-compat.h"
c1_cfloat_rettype
__c1_casinf (c1_cfloat_decl (x))
diff --git a/sysdeps/alpha/fpu/s_casinhf.c b/sysdeps/alpha/fpu/s_casinhf.c
index 720294e..11faf9a 100644
--- a/sysdeps/alpha/fpu/s_casinhf.c
+++ b/sysdeps/alpha/fpu/s_casinhf.c
@@ -24,14 +24,18 @@
#undef __casinhf
#undef casinhf
-#define __casinhf internal_casinhf
static _Complex float internal_casinhf (_Complex float x);
-#include <math/s_casinhf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_casinhf
+#include <math-type-macros-float.h>
-#undef __casinhf
+/* Disable any aliasing from base template. */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_casinh_template.c>
+#include "cfloat-compat.h"
c1_cfloat_rettype
__c1_casinhf (c1_cfloat_decl (x))
diff --git a/sysdeps/alpha/fpu/s_csinf.c b/sysdeps/alpha/fpu/s_csinf.c
index abe2d3a..fc49244 100644
--- a/sysdeps/alpha/fpu/s_csinf.c
+++ b/sysdeps/alpha/fpu/s_csinf.c
@@ -24,14 +24,18 @@
#undef __csinf
#undef csinf
-#define __csinf internal_csinf
static _Complex float internal_csinf (_Complex float x);
-#include <math/s_csinf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_csinf
+#include <math-type-macros-float.h>
-#undef __csinf
+/* Disable any aliasing from base template. */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_csin_template.c>
+#include "cfloat-compat.h"
c1_cfloat_rettype
__c1_csinf (c1_cfloat_decl (x))
diff --git a/sysdeps/alpha/fpu/s_csinhf.c b/sysdeps/alpha/fpu/s_csinhf.c
index a6d470a..6263cd0 100644
--- a/sysdeps/alpha/fpu/s_csinhf.c
+++ b/sysdeps/alpha/fpu/s_csinhf.c
@@ -24,14 +24,18 @@
#undef __csinhf
#undef csinhf
-#define __csinhf internal_csinhf
static _Complex float internal_csinhf (_Complex float x);
-#include <math/s_csinhf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_csinhf
+#include <math-type-macros-float.h>
-#undef __csinhf
+/* Disable any aliasing from base template. */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/s_csinh_template.c>
+#include "cfloat-compat.h"
c1_cfloat_rettype
__c1_csinhf (c1_cfloat_decl (x))
diff --git a/sysdeps/ieee754/ldbl-opt/s_casin.c b/sysdeps/ieee754/ldbl-opt/s_casin.c
deleted file mode 100644
index 04c47ca..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_casin.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_casin.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __casin, casinl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_casinh.c b/sysdeps/ieee754/ldbl-opt/s_casinh.c
deleted file mode 100644
index 19c4fa3..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_casinh.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_casinh.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __casinh, casinhl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_casinhl.c b/sysdeps/ieee754/ldbl-opt/s_casinhl.c
deleted file mode 100644
index 976fa8e..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_casinhl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_casinhl.c>
-long_double_symbol (libm, __casinhl, casinhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_casinl.c b/sysdeps/ieee754/ldbl-opt/s_casinl.c
deleted file mode 100644
index 7afb77c..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_casinl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_casinl.c>
-long_double_symbol (libm, __casinl, casinl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_csin.c b/sysdeps/ieee754/ldbl-opt/s_csin.c
deleted file mode 100644
index 7017c95..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_csin.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_csin.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __csin, csinl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_csinh.c b/sysdeps/ieee754/ldbl-opt/s_csinh.c
deleted file mode 100644
index a1fa667..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_csinh.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_csinh.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __csinh, csinhl, GLIBC_2_1);
-#endif
diff --git a/sysdeps/ieee754/ldbl-opt/s_csinhl.c b/sysdeps/ieee754/ldbl-opt/s_csinhl.c
deleted file mode 100644
index 484d466..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_csinhl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_csinhl.c>
-long_double_symbol (libm, __csinhl, csinhl);
diff --git a/sysdeps/ieee754/ldbl-opt/s_csinl.c b/sysdeps/ieee754/ldbl-opt/s_csinl.c
deleted file mode 100644
index f71642e..0000000
--- a/sysdeps/ieee754/ldbl-opt/s_csinl.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_csinl.c>
-long_double_symbol (libm, __csinl, csinl);
diff --git a/sysdeps/m68k/m680x0/fpu/s_csin.c b/sysdeps/m68k/m680x0/fpu/s_csin_template.c
index b8419be..628d0d5 100644
--- a/sysdeps/m68k/m680x0/fpu/s_csin.c
+++ b/sysdeps/m68k/m680x0/fpu/s_csin_template.c
@@ -21,27 +21,19 @@
#include <math.h>
#include "mathimpl.h"
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
-#define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
+#define s(name) M_SUF (name)
#define m81(func) __m81_u(s(func))
-__complex__ float_type
-s(__csin) (__complex__ float_type x)
+CFLOAT
+s(__csin) (CFLOAT x)
{
- __complex__ float_type retval;
+ CFLOAT retval;
unsigned long rx_cond = __m81_test (__real__ x);
if ((rx_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0)
{
/* Real part is finite. */
- float_type sin_rx, cos_rx;
+ FLOAT sin_rx, cos_rx;
__asm ("fsincos%.x %2,%1:%0" : "=f" (sin_rx), "=f" (cos_rx)
: "f" (__real__ x));
diff --git a/sysdeps/m68k/m680x0/fpu/s_csinf.c b/sysdeps/m68k/m680x0/fpu/s_csinf.c
deleted file mode 100644
index b760e19..0000000
--- a/sysdeps/m68k/m680x0/fpu/s_csinf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <s_csin.c>
diff --git a/sysdeps/m68k/m680x0/fpu/s_csinh.c b/sysdeps/m68k/m680x0/fpu/s_csinh_template.c
index c633cd8..56f3bab 100644
--- a/sysdeps/m68k/m680x0/fpu/s_csinh.c
+++ b/sysdeps/m68k/m680x0/fpu/s_csinh_template.c
@@ -21,21 +21,14 @@
#include <math.h>
#include "mathimpl.h"
-#ifndef SUFF
-#define SUFF
-#endif
-#ifndef float_type
-#define float_type double
-#endif
-
#define CONCATX(a,b) __CONCAT(a,b)
-#define s(name) CONCATX(name,SUFF)
+#define s(name) M_SUF (name)
#define m81(func) __m81_u(s(func))
-__complex__ float_type
-s(__csinh) (__complex__ float_type x)
+CFLOAT
+s(__csinh) (CFLOAT x)
{
- __complex__ float_type retval;
+ CFLOAT retval;
unsigned long ix_cond;
ix_cond = __m81_test (__imag__ x);
@@ -43,7 +36,7 @@ s(__csinh) (__complex__ float_type x)
if ((ix_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0)
{
/* Imaginary part is finite. */
- float_type sin_ix, cos_ix;
+ FLOAT sin_ix, cos_ix;
__asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix)
: "f" (__imag__ x));
diff --git a/sysdeps/m68k/m680x0/fpu/s_csinhf.c b/sysdeps/m68k/m680x0/fpu/s_csinhf.c
deleted file mode 100644
index 2f7a43e..0000000
--- a/sysdeps/m68k/m680x0/fpu/s_csinhf.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <s_csinh.c>
diff --git a/sysdeps/m68k/m680x0/fpu/s_csinhl.c b/sysdeps/m68k/m680x0/fpu/s_csinhl.c
deleted file mode 100644
index 026a20e..0000000
--- a/sysdeps/m68k/m680x0/fpu/s_csinhl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <s_csinh.c>
diff --git a/sysdeps/m68k/m680x0/fpu/s_csinl.c b/sysdeps/m68k/m680x0/fpu/s_csinl.c
deleted file mode 100644
index ea2dad0..0000000
--- a/sysdeps/m68k/m680x0/fpu/s_csinl.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <s_csin.c>