@@ -55,7 +55,8 @@ libm-support = s_lib_version s_matherr s_signgam \
# will match the name s_<func><type suffix>
gen-libm-calls = g_carg_F g_conj_F g_cimag_F g_creal_F g_cabs_F g_cacos_F \
g_cacosh_F g_ccos_F g_ccosh_F g_casin_F g_csin_F g_casinh_F \
- g_k_casinh_F g_csinh_F g_catanh_F g_catan_F g_ctan_F g_ctanh_F
+ g_k_casinh_F g_csinh_F g_catanh_F g_catan_F g_ctan_F g_ctanh_F \
+ g_cexp_F g_clog_F g_cproj_F g_csqrt_F g_cpow_F g_clog10_F
libm-calls = \
e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \
@@ -73,8 +74,6 @@ 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_clogF \
- 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 \
gamma_productF lgamma_negF lgamma_productF \
new file mode 100644
@@ -0,0 +1,157 @@
+/* Return value of complex exponential function for a 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.
+
+ 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 M_LIT (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>
+
+CFLOAT
+M_DECL_FUNC (__cexp) (CFLOAT x)
+{
+ CFLOAT retval;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ 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) ((M_MAX_EXP - 1) * M_MLIT (M_LN2));
+ FLOAT sinix, cosix;
+
+ if (__glibc_likely (M_FABS (__imag__ x) > M_MIN))
+ {
+ M_SINCOS (__imag__ x, &sinix, &cosix);
+ }
+ else
+ {
+ sinix = __imag__ x;
+ cosix = M_LIT (1.0);
+ }
+
+ if (__real__ x > t)
+ {
+ FLOAT exp_t = M_EXP (t);
+ __real__ x -= t;
+ sinix *= exp_t;
+ cosix *= exp_t;
+ if (__real__ x > t)
+ {
+ __real__ x -= t;
+ sinix *= exp_t;
+ cosix *= exp_t;
+ }
+ }
+ if (__real__ x > t)
+ {
+ /* Overflow (original real part of x > 3t). */
+ __real__ retval = M_MAX * cosix;
+ __imag__ retval = M_MAX * sinix;
+ }
+ else
+ {
+ FLOAT exp_val = M_EXP (__real__ x);
+ __real__ retval = exp_val * cosix;
+ __imag__ retval = exp_val * sinix;
+ }
+ math_check_force_underflow_complex (retval);
+ }
+ else
+ {
+ /* If the imaginary part is +-inf or NaN and the real part
+ is not +-inf the result is NaN + iNaN. */
+ __real__ retval = M_NAN;
+ __imag__ retval = M_NAN;
+
+ feraiseexcept (FE_INVALID);
+ }
+ }
+ else if (__glibc_likely (rcls == FP_INFINITE))
+ {
+ /* Real part is infinite. */
+ if (__glibc_likely (icls >= FP_ZERO))
+ {
+ /* Imaginary part is finite. */
+ FLOAT value = signbit (__real__ x) ? M_LIT (0.0) : M_HUGE_VAL;
+
+ if (icls == FP_ZERO)
+ {
+ /* Imaginary part is M_LIT (0.0). */
+ __real__ retval = value;
+ __imag__ retval = __imag__ x;
+ }
+ else
+ {
+ FLOAT sinix, cosix;
+
+ if (__glibc_likely (M_FABS (__imag__ x) > M_MIN))
+ {
+ M_SINCOS (__imag__ x, &sinix, &cosix);
+ }
+ else
+ {
+ sinix = __imag__ x;
+ cosix = M_LIT (1.0);
+ }
+
+ __real__ retval = M_COPYSIGN (value, cosix);
+ __imag__ retval = M_COPYSIGN (value, sinix);
+ }
+ }
+ else if (signbit (__real__ x) == 0)
+ {
+ __real__ retval = M_HUGE_VAL;
+ __imag__ retval = M_NAN;
+
+ if (icls == FP_INFINITE)
+ feraiseexcept (FE_INVALID);
+ }
+ else
+ {
+ __real__ retval = M_LIT (0.0);
+ __imag__ retval = M_COPYSIGN (M_LIT (0.0), __imag__ x);
+ }
+ }
+ else
+ {
+ /* If the real part is NaN the result is NaN + iNaN unless the
+ imaginary part is zero. */
+ __real__ retval = M_NAN;
+ if (icls == FP_ZERO)
+ __imag__ retval = __imag__ x;
+ else
+ {
+ __imag__ retval = M_NAN;
+
+ if (rcls != FP_NAN || icls != FP_NAN)
+ feraiseexcept (FE_INVALID);
+ }
+ }
+
+ return retval;
+}
+declare_mgen_alias (__cexp, cexp)
+
+#if M_LIBM_NEED_COMPAT (cexp)
+ declare_mgen_libm_compat (__cexp, cexp)
+#endif
new file mode 100644
@@ -0,0 +1,122 @@
+/* Compute complex natural logarithm.
+ 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 M_LIT (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>
+
+CFLOAT
+M_DECL_FUNC (__clog) (CFLOAT x)
+{
+ CFLOAT result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
+ {
+ /* Real and imaginary part are M_LIT (0.0). */
+ __imag__ result = signbit (__real__ x) ? (FLOAT) M_MLIT (M_PI)
+ : M_LIT (0.0);
+ __imag__ result = M_COPYSIGN (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -M_LIT (1.0) / M_FABS (__real__ x);
+ }
+ else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
+ {
+ /* Neither real nor imaginary part is NaN. */
+ FLOAT absx = M_FABS (__real__ x), absy = M_FABS (__imag__ x);
+ int scale = 0;
+
+ if (absx < absy)
+ {
+ FLOAT t = absx;
+ absx = absy;
+ absy = t;
+ }
+
+ if (absx > M_MAX / M_LIT (2.0))
+ {
+ scale = -1;
+ absx = M_SCALBN (absx, scale);
+ absy = (absy >= M_MIN * M_LIT (2.0) ? M_SCALBN (absy, scale)
+ : M_LIT (0.0));
+ }
+ else if (absx < M_MIN && absy < M_MIN)
+ {
+ scale = M_MANT_DIG;
+ absx = M_SCALBN (absx, scale);
+ absy = M_SCALBN (absy, scale);
+ }
+
+ if (absx == M_LIT (1.0) && scale == 0)
+ {
+ __real__ result = M_LOG1P (absy * absy) / M_LIT (2.0);
+ math_check_force_underflow_nonneg (__real__ result);
+ }
+ else if (absx > M_LIT (1.0) && absx < M_LIT (2.0)
+ && absy < M_LIT (1.0) && scale == 0)
+ {
+ FLOAT d2m1 = (absx - M_LIT (1.0)) * (absx + M_LIT (1.0));
+ if (absy >= M_EPSILON)
+ d2m1 += absy * absy;
+ __real__ result = M_LOG1P (d2m1) / M_LIT (2.0);
+ }
+ else if (absx < M_LIT (1.0)
+ && absx >= M_LIT (0.5)
+ && absy < M_EPSILON / M_LIT (2.0)
+ && scale == 0)
+ {
+ FLOAT d2m1 = (absx - M_LIT (1.0)) * (absx + M_LIT (1.0));
+ __real__ result = M_LOG1P (d2m1) / M_LIT (2.0);
+ }
+ else if (absx < M_LIT (1.0)
+ && absx >= M_LIT (0.5)
+ && scale == 0
+ && absx * absx + absy * absy >= M_LIT (0.5))
+ {
+ FLOAT d2m1 = M_FUNC (__x2y2m1) (absx, absy);
+ __real__ result = M_LOG1P (d2m1) / M_LIT (2.0);
+ }
+ else
+ {
+ FLOAT d = M_HYPOT (absx, absy);
+ __real__ result = M_LOG (d) - scale * (FLOAT) M_MLIT (M_LN2);
+ }
+
+ __imag__ result = M_ATAN2 (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = __nan ("");
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = HUGE_VAL;
+ else
+ __real__ result = __nan ("");
+ }
+
+ return result;
+}
+
+declare_mgen_alias (__clog, clog)
+
+#if M_LIBM_NEED_COMPAT (clog)
+ declare_mgen_libm_compat (__clog, clog)
+#endif
new file mode 100644
@@ -0,0 +1,146 @@
+/* Compute complex base 10 logarithm.
+ 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 M_LIT (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>
+
+/* log_10 (2). */
+#define LOG10_2 M_LIT (0.3010299956639811952137388947244930267682)
+
+/* pi * log10 (e). */
+#define PI_LOG10E M_LIT (1.364376353841841347485783625431355770210)
+
+#if !defined (M_DISABLE_ALIASING) \
+ && defined (LONG_DOUBLE_COMPAT_VERSION) && M_TYPE == M_LDOUBLE
+# undef M_DECL_FUNC
+# define M_DECL_FUNC(x) __clog10l_internal
+#endif
+
+CFLOAT
+M_DECL_FUNC (__clog10) (CFLOAT x)
+{
+ CFLOAT result;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
+ {
+ /* Real and imaginary part are 0.0. */
+ __imag__ result = signbit (__real__ x) ? PI_LOG10E : M_LIT (0.0);
+ __imag__ result = M_COPYSIGN (__imag__ result, __imag__ x);
+ /* Yes, the following line raises an exception. */
+ __real__ result = -M_LIT (1.0) / M_FABS (__real__ x);
+ }
+ else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
+ {
+ /* Neither real nor imaginary part is NaN. */
+ FLOAT absx = M_FABS (__real__ x), absy = M_FABS (__imag__ x);
+ int scale = 0;
+
+ if (absx < absy)
+ {
+ FLOAT t = absx;
+ absx = absy;
+ absy = t;
+ }
+
+ if (absx > M_MAX / M_LIT (2.0))
+ {
+ scale = -1;
+ absx = M_SCALBN (absx, scale);
+ absy = (absy >= M_MIN * M_LIT (2.0) ? M_SCALBN (absy, scale)
+ : M_LIT (0.0));
+ }
+ else if (absx < M_MIN && absy < M_MIN)
+ {
+ scale = M_MANT_DIG;
+ absx = M_SCALBN (absx, scale);
+ absy = M_SCALBN (absy, scale);
+ }
+
+ if (absx == M_LIT (1.0) && scale == 0)
+ {
+ __real__ result = M_LOG1P (absy * absy) *
+ ((FLOAT) M_MLIT (M_LOG10E) / M_LIT (2.0));
+ math_check_force_underflow_nonneg (__real__ result);
+ }
+ else if (absx > M_LIT (1.0) && absx < M_LIT (2.0)
+ && absy < M_LIT (1.0) && scale == 0)
+ {
+ FLOAT d2m1 = (absx - M_LIT (1.0)) * (absx + M_LIT (1.0));
+ if (absy >= M_EPSILON)
+ d2m1 += absy * absy;
+ __real__ result = M_LOG1P (d2m1)
+ * ((FLOAT) M_MLIT (M_LOG10E) / M_LIT (2.0));
+ }
+ else if (absx < M_LIT (1.0)
+ && absx >= M_LIT (0.5)
+ && absy < M_EPSILON / M_LIT (2.0)
+ && scale == 0)
+ {
+ FLOAT d2m1 = (absx - M_LIT (1.0)) * (absx + M_LIT (1.0));
+ __real__ result = M_LOG1P (d2m1)
+ * ((FLOAT) M_MLIT (M_LOG10E) / M_LIT (2.0));
+ }
+ else if (absx < M_LIT (1.0)
+ && absx >= M_LIT (0.5)
+ && scale == 0
+ && absx * absx + absy * absy >= M_LIT (0.5))
+ {
+ FLOAT d2m1 = M_FUNC (__x2y2m1) (absx, absy);
+ __real__ result = M_LOG1P (d2m1)
+ * ((FLOAT) M_MLIT (M_LOG10E) / M_LIT (2.0));
+ }
+ else
+ {
+ FLOAT d = M_HYPOT (absx, absy);
+ __real__ result = M_FUNC (__ieee754_log10) (d) - scale * LOG10_2;
+ }
+
+ __imag__ result = M_MLIT (M_LOG10E) * M_ATAN2 (__imag__ x, __real__ x);
+ }
+ else
+ {
+ __imag__ result = M_NAN;
+ if (rcls == FP_INFINITE || icls == FP_INFINITE)
+ /* Real or imaginary part is infinite. */
+ __real__ result = M_HUGE_VAL;
+ else
+ __real__ result = M_NAN;
+ }
+
+ return result;
+}
+
+/* The aliasing for long double is a bit more complicated
+ since some private symbols leaked out in the past. */
+#if defined (LONG_DOUBLE_COMPAT_VERSION) && M_TYPE == M_LDOUBLE \
+ && !defined (M_INHIBIT_ALIASING)
+ strong_alias (__clog10l_internal, __clog10l__internal)
+ long_double_symbol (libm, __clog10l_internal, __clog10l);
+ long_double_symbol (libm, __clog10l__internal, clog10l);
+#else
+ declare_mgen_alias (__clog10, clog10)
+#endif
+
+#if M_LIBM_NEED_COMPAT (clog10)
+ declare_mgen_libm_compat (__clog10, __clog10)
+ declare_mgen_libm_compat (clog10, clog10)
+#endif
new file mode 100644
@@ -0,0 +1,33 @@
+/* Complex power of 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.
+
+ 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 M_LIT (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>
+
+CFLOAT
+M_DECL_FUNC (__cpow) (CFLOAT x, CFLOAT c)
+{
+ return M_FUNC (__cexp) (c * M_FUNC (__clog) (x));
+}
+
+declare_mgen_alias (__cpow, cpow)
+
+#if M_LIBM_NEED_COMPAT (cpow)
+ declare_mgen_libm_compat (__cpow, cpow)
+#endif
new file mode 100644
@@ -0,0 +1,45 @@
+/* Compute projection of complex float type value to Riemann sphere.
+ 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 M_LIT (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>
+
+
+CFLOAT
+M_DECL_FUNC (__cproj) (CFLOAT x)
+{
+ if (isinf (__real__ x) || isinf (__imag__ x))
+ {
+ CFLOAT res;
+
+ __real__ res = INFINITY;
+ __imag__ res = M_COPYSIGN (M_LIT (0.0), __imag__ x);
+
+ return res;
+ }
+
+ return x;
+}
+
+declare_mgen_alias (__cproj, cproj)
+
+#if M_LIBM_NEED_COMPAT (cproj)
+ declare_mgen_libm_compat (__cproj, cproj)
+#endif
new file mode 100644
@@ -0,0 +1,165 @@
+/* Complex square root of a float type.
+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
+ 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 M_LIT (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>
+
+CFLOAT
+M_DECL_FUNC (__csqrt) (CFLOAT x)
+{
+ CFLOAT res;
+ int rcls = fpclassify (__real__ x);
+ int icls = fpclassify (__imag__ x);
+
+ if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
+ {
+ if (icls == FP_INFINITE)
+ {
+ __real__ res = M_HUGE_VAL;
+ __imag__ res = __imag__ x;
+ }
+ else if (rcls == FP_INFINITE)
+ {
+ if (__real__ x < M_LIT (0.0))
+ {
+ __real__ res = icls == FP_NAN ? M_NAN : 0;
+ __imag__ res = M_COPYSIGN (M_HUGE_VAL, __imag__ x);
+ }
+ else
+ {
+ __real__ res = __real__ x;
+ __imag__ res = (icls == FP_NAN
+ ? M_NAN : M_COPYSIGN (M_LIT (0.0), __imag__ x));
+ }
+ }
+ else
+ {
+ __real__ res = M_NAN;
+ __imag__ res = M_NAN;
+ }
+ }
+ else
+ {
+ if (__glibc_unlikely (icls == FP_ZERO))
+ {
+ if (__real__ x < M_LIT (0.0))
+ {
+ __real__ res = M_LIT (0.0);
+ __imag__ res = M_COPYSIGN (M_SQRT (-__real__ x),
+ __imag__ x);
+ }
+ else
+ {
+ __real__ res = M_FABS (M_SQRT (__real__ x));
+ __imag__ res = M_COPYSIGN (M_LIT (0.0), __imag__ x);
+ }
+ }
+ else if (__glibc_unlikely (rcls == FP_ZERO))
+ {
+ FLOAT r;
+ if (M_FABS (__imag__ x) >= M_LIT (2.0) * M_MIN)
+ r = M_SQRT (M_LIT (0.5) * M_FABS (__imag__ x));
+ else
+ r = M_LIT (0.5) * M_SQRT (M_LIT (2.0) * M_FABS (__imag__ x));
+
+ __real__ res = r;
+ __imag__ res = M_COPYSIGN (r, __imag__ x);
+ }
+ else
+ {
+ FLOAT d, r, s;
+ int scale = 0;
+
+ if (M_FABS (__real__ x) > M_MAX / M_LIT (4.0))
+ {
+ scale = 1;
+ __real__ x = M_SCALBN (__real__ x, -2 * scale);
+ __imag__ x = M_SCALBN (__imag__ x, -2 * scale);
+ }
+ else if (M_FABS (__imag__ x) > M_MAX / M_LIT (4.0))
+ {
+ scale = 1;
+ if (M_FABS (__real__ x) >= M_LIT (4.0) * M_MIN)
+ __real__ x = M_SCALBN (__real__ x, -2 * scale);
+ else
+ __real__ x = M_LIT (0.0);
+ __imag__ x = M_SCALBN (__imag__ x, -2 * scale);
+ }
+ else if (M_FABS (__real__ x) < M_LIT (2.0) * M_MIN
+ && M_FABS (__imag__ x) < M_LIT (2.0) * M_MIN)
+ {
+ scale = -((M_MANT_DIG + 1) / 2);
+ __real__ x = M_SCALBN (__real__ x, -2 * scale);
+ __imag__ x = M_SCALBN (__imag__ x, -2 * scale);
+ }
+
+ d = M_HYPOT (__real__ x, __imag__ x);
+ /* Use the identity 2 Re res Im res = Im x
+ to avoid cancellation error in d +/- Re x. */
+ if (__real__ x > M_LIT (0.0))
+ {
+ r = M_SQRT (M_LIT (0.5) * (d + __real__ x));
+ if (scale == 1 && M_FABS (__imag__ x) < M_LIT (1.0))
+ {
+ /* Avoid possible intermediate underflow. */
+ s = __imag__ x / r;
+ r = M_SCALBN (r, scale);
+ scale = 0;
+ }
+ else
+ s = M_LIT (0.5) * (__imag__ x / r);
+ }
+ else
+ {
+ s = M_SQRT (M_LIT (0.5) * (d - __real__ x));
+ if (scale == 1 && M_FABS (__imag__ x) < M_LIT (1.0))
+ {
+ /* Avoid possible intermediate underflow. */
+ r = M_FABS (__imag__ x / s);
+ s = M_SCALBN (s, scale);
+ scale = 0;
+ }
+ else
+ r = M_FABS (M_LIT (0.5) * (__imag__ x / s));
+ }
+
+ if (scale)
+ {
+ r = M_SCALBN (r, scale);
+ s = M_SCALBN (s, scale);
+ }
+
+ math_check_force_underflow (r);
+ math_check_force_underflow (s);
+
+ __real__ res = r;
+ __imag__ res = M_COPYSIGN (s, __imag__ x);
+ }
+ }
+
+ return res;
+}
+declare_mgen_alias (__csqrt, csqrt)
+
+#if M_LIBM_NEED_COMPAT (csqrt)
+ declare_mgen_libm_compat (__csqrt, csqrt)
+#endif
deleted file mode 100644
@@ -1,157 +0,0 @@
-/* Return value of complex exponential function for double complex 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 <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ double
-__cexp (__complex__ double x)
-{
- __complex__ double retval;
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ 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 (__real__ x > t)
- {
- double exp_t = __ieee754_exp (t);
- __real__ x -= t;
- sinix *= exp_t;
- cosix *= exp_t;
- if (__real__ x > t)
- {
- __real__ x -= t;
- sinix *= exp_t;
- cosix *= exp_t;
- }
- }
- if (__real__ x > t)
- {
- /* Overflow (original real part of x > 3t). */
- __real__ retval = DBL_MAX * cosix;
- __imag__ retval = DBL_MAX * sinix;
- }
- else
- {
- double exp_val = __ieee754_exp (__real__ x);
- __real__ retval = exp_val * cosix;
- __imag__ retval = exp_val * sinix;
- }
- math_check_force_underflow_complex (retval);
- }
- else
- {
- /* If the imaginary part is +-inf or NaN and the real part
- is not +-inf the result is NaN + iNaN. */
- __real__ retval = __nan ("");
- __imag__ retval = __nan ("");
-
- feraiseexcept (FE_INVALID);
- }
- }
- else if (__glibc_likely (rcls == FP_INFINITE))
- {
- /* Real part is infinite. */
- if (__glibc_likely (icls >= FP_ZERO))
- {
- /* Imaginary part is finite. */
- double value = signbit (__real__ x) ? 0.0 : HUGE_VAL;
-
- if (icls == FP_ZERO)
- {
- /* Imaginary part is 0.0. */
- __real__ retval = value;
- __imag__ retval = __imag__ x;
- }
- else
- {
- 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 (value, cosix);
- __imag__ retval = __copysign (value, sinix);
- }
- }
- else if (signbit (__real__ x) == 0)
- {
- __real__ retval = HUGE_VAL;
- __imag__ retval = __nan ("");
-
- if (icls == FP_INFINITE)
- feraiseexcept (FE_INVALID);
- }
- else
- {
- __real__ retval = 0.0;
- __imag__ retval = __copysign (0.0, __imag__ x);
- }
- }
- else
- {
- /* If the real part is NaN the result is NaN + iNaN unless the
- imaginary part is zero. */
- __real__ retval = __nan ("");
- if (icls == FP_ZERO)
- __imag__ retval = __imag__ x;
- else
- {
- __imag__ retval = __nan ("");
-
- if (rcls != FP_NAN || icls != FP_NAN)
- feraiseexcept (FE_INVALID);
- }
- }
-
- return retval;
-}
-weak_alias (__cexp, cexp)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cexp, __cexpl)
-weak_alias (__cexp, cexpl)
-#endif
deleted file mode 100644
@@ -1,155 +0,0 @@
-/* Return value of complex exponential function for float complex 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 <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ float
-__cexpf (__complex__ float x)
-{
- __complex__ float retval;
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ 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 (__real__ x > t)
- {
- float exp_t = __ieee754_expf (t);
- __real__ x -= t;
- sinix *= exp_t;
- cosix *= exp_t;
- if (__real__ x > t)
- {
- __real__ x -= t;
- sinix *= exp_t;
- cosix *= exp_t;
- }
- }
- if (__real__ x > t)
- {
- /* Overflow (original real part of x > 3t). */
- __real__ retval = FLT_MAX * cosix;
- __imag__ retval = FLT_MAX * sinix;
- }
- else
- {
- float exp_val = __ieee754_expf (__real__ x);
- __real__ retval = exp_val * cosix;
- __imag__ retval = exp_val * sinix;
- }
- math_check_force_underflow_complex (retval);
- }
- else
- {
- /* If the imaginary part is +-inf or NaN and the real part
- is not +-inf the result is NaN + iNaN. */
- __real__ retval = __nanf ("");
- __imag__ retval = __nanf ("");
-
- feraiseexcept (FE_INVALID);
- }
- }
- else if (__glibc_likely (rcls == FP_INFINITE))
- {
- /* Real part is infinite. */
- if (__glibc_likely (icls >= FP_ZERO))
- {
- /* Imaginary part is finite. */
- float value = signbit (__real__ x) ? 0.0 : HUGE_VALF;
-
- if (icls == FP_ZERO)
- {
- /* Imaginary part is 0.0. */
- __real__ retval = value;
- __imag__ retval = __imag__ x;
- }
- else
- {
- 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 (value, cosix);
- __imag__ retval = __copysignf (value, sinix);
- }
- }
- else if (signbit (__real__ x) == 0)
- {
- __real__ retval = HUGE_VALF;
- __imag__ retval = __nanf ("");
-
- if (icls == FP_INFINITE)
- feraiseexcept (FE_INVALID);
- }
- else
- {
- __real__ retval = 0.0;
- __imag__ retval = __copysignf (0.0, __imag__ x);
- }
- }
- else
- {
- /* If the real part is NaN the result is NaN + iNaN unless the
- imaginary part is zero. */
- __real__ retval = __nanf ("");
- if (icls == FP_ZERO)
- __imag__ retval = __imag__ x;
- else
- {
- __imag__ retval = __nanf ("");
-
- if (rcls != FP_NAN || icls != FP_NAN)
- feraiseexcept (FE_INVALID);
- }
- }
-
- return retval;
-}
-#ifndef __cexpf
-weak_alias (__cexpf, cexpf)
-#endif
deleted file mode 100644
@@ -1,153 +0,0 @@
-/* Return value of complex exponential function for long double complex 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 <fenv.h>
-#include <math.h>
-#include <math_private.h>
-#include <float.h>
-
-__complex__ long double
-__cexpl (__complex__ long double x)
-{
- __complex__ long double retval;
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ 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 (__real__ x > t)
- {
- long double exp_t = __ieee754_expl (t);
- __real__ x -= t;
- sinix *= exp_t;
- cosix *= exp_t;
- if (__real__ x > t)
- {
- __real__ x -= t;
- sinix *= exp_t;
- cosix *= exp_t;
- }
- }
- if (__real__ x > 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 (__real__ x);
- __real__ retval = exp_val * cosix;
- __imag__ retval = exp_val * sinix;
- }
- math_check_force_underflow_complex (retval);
- }
- else
- {
- /* If the imaginary part is +-inf or NaN and the real part
- is not +-inf the result is NaN + iNaN. */
- __real__ retval = __nanl ("");
- __imag__ retval = __nanl ("");
-
- feraiseexcept (FE_INVALID);
- }
- }
- else if (__glibc_likely (rcls == FP_INFINITE))
- {
- /* Real part is infinite. */
- if (__glibc_likely (icls >= FP_ZERO))
- {
- /* Imaginary part is finite. */
- long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL;
-
- if (icls == FP_ZERO)
- {
- /* Imaginary part is 0.0. */
- __real__ retval = value;
- __imag__ retval = __imag__ x;
- }
- else
- {
- 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 (value, cosix);
- __imag__ retval = __copysignl (value, sinix);
- }
- }
- else if (signbit (__real__ x) == 0)
- {
- __real__ retval = HUGE_VALL;
- __imag__ retval = __nanl ("");
-
- if (icls == FP_INFINITE)
- feraiseexcept (FE_INVALID);
- }
- else
- {
- __real__ retval = 0.0;
- __imag__ retval = __copysignl (0.0, __imag__ x);
- }
- }
- else
- {
- /* If the real part is NaN the result is NaN + iNaN unless the
- imaginary part is zero. */
- __real__ retval = __nanl ("");
- if (icls == FP_ZERO)
- __imag__ retval = __imag__ x;
- else
- {
- __imag__ retval = __nanl ("");
-
- if (rcls != FP_NAN || icls != FP_NAN)
- feraiseexcept (FE_INVALID);
- }
- }
-
- return retval;
-}
-weak_alias (__cexpl, cexpl)
deleted file mode 100644
@@ -1,118 +0,0 @@
-/* Compute complex natural logarithm.
- 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>
-#include <float.h>
-
-__complex__ double
-__clog (__complex__ double x)
-{
- __complex__ double result;
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
- {
- /* Real and imaginary part are 0.0. */
- __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
- __imag__ result = __copysign (__imag__ result, __imag__ x);
- /* Yes, the following line raises an exception. */
- __real__ result = -1.0 / fabs (__real__ x);
- }
- else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
- {
- /* Neither real nor imaginary part is NaN. */
- double absx = fabs (__real__ x), absy = fabs (__imag__ x);
- int scale = 0;
-
- if (absx < absy)
- {
- double t = absx;
- absx = absy;
- absy = t;
- }
-
- if (absx > DBL_MAX / 2.0)
- {
- scale = -1;
- absx = __scalbn (absx, scale);
- absy = (absy >= DBL_MIN * 2.0 ? __scalbn (absy, scale) : 0.0);
- }
- else if (absx < DBL_MIN && absy < DBL_MIN)
- {
- scale = DBL_MANT_DIG;
- absx = __scalbn (absx, scale);
- absy = __scalbn (absy, scale);
- }
-
- if (absx == 1.0 && scale == 0)
- {
- __real__ result = __log1p (absy * absy) / 2.0;
- math_check_force_underflow_nonneg (__real__ result);
- }
- else if (absx > 1.0 && absx < 2.0 && absy < 1.0 && scale == 0)
- {
- double d2m1 = (absx - 1.0) * (absx + 1.0);
- if (absy >= DBL_EPSILON)
- d2m1 += absy * absy;
- __real__ result = __log1p (d2m1) / 2.0;
- }
- else if (absx < 1.0
- && absx >= 0.5
- && absy < DBL_EPSILON / 2.0
- && scale == 0)
- {
- double d2m1 = (absx - 1.0) * (absx + 1.0);
- __real__ result = __log1p (d2m1) / 2.0;
- }
- else if (absx < 1.0
- && absx >= 0.5
- && scale == 0
- && absx * absx + absy * absy >= 0.5)
- {
- double d2m1 = __x2y2m1 (absx, absy);
- __real__ result = __log1p (d2m1) / 2.0;
- }
- else
- {
- double d = __ieee754_hypot (absx, absy);
- __real__ result = __ieee754_log (d) - scale * M_LN2;
- }
-
- __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x);
- }
- else
- {
- __imag__ result = __nan ("");
- if (rcls == FP_INFINITE || icls == FP_INFINITE)
- /* Real or imaginary part is infinite. */
- __real__ result = HUGE_VAL;
- else
- __real__ result = __nan ("");
- }
-
- return result;
-}
-weak_alias (__clog, clog)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__clog, __clogl)
-weak_alias (__clog, clogl)
-#endif
deleted file mode 100644
@@ -1,124 +0,0 @@
-/* Compute complex base 10 logarithm.
- 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>
-#include <float.h>
-
-/* log_10 (2). */
-#define M_LOG10_2 0.3010299956639811952137388947244930267682
-
-/* pi * log10 (e). */
-#define M_PI_LOG10E 1.364376353841841347485783625431355770210
-
-__complex__ double
-__clog10 (__complex__ double x)
-{
- __complex__ double result;
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
- {
- /* Real and imaginary part are 0.0. */
- __imag__ result = signbit (__real__ x) ? M_PI_LOG10E : 0.0;
- __imag__ result = __copysign (__imag__ result, __imag__ x);
- /* Yes, the following line raises an exception. */
- __real__ result = -1.0 / fabs (__real__ x);
- }
- else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
- {
- /* Neither real nor imaginary part is NaN. */
- double absx = fabs (__real__ x), absy = fabs (__imag__ x);
- int scale = 0;
-
- if (absx < absy)
- {
- double t = absx;
- absx = absy;
- absy = t;
- }
-
- if (absx > DBL_MAX / 2.0)
- {
- scale = -1;
- absx = __scalbn (absx, scale);
- absy = (absy >= DBL_MIN * 2.0 ? __scalbn (absy, scale) : 0.0);
- }
- else if (absx < DBL_MIN && absy < DBL_MIN)
- {
- scale = DBL_MANT_DIG;
- absx = __scalbn (absx, scale);
- absy = __scalbn (absy, scale);
- }
-
- if (absx == 1.0 && scale == 0)
- {
- __real__ result = __log1p (absy * absy) * (M_LOG10E / 2.0);
- math_check_force_underflow_nonneg (__real__ result);
- }
- else if (absx > 1.0 && absx < 2.0 && absy < 1.0 && scale == 0)
- {
- double d2m1 = (absx - 1.0) * (absx + 1.0);
- if (absy >= DBL_EPSILON)
- d2m1 += absy * absy;
- __real__ result = __log1p (d2m1) * (M_LOG10E / 2.0);
- }
- else if (absx < 1.0
- && absx >= 0.5
- && absy < DBL_EPSILON / 2.0
- && scale == 0)
- {
- double d2m1 = (absx - 1.0) * (absx + 1.0);
- __real__ result = __log1p (d2m1) * (M_LOG10E / 2.0);
- }
- else if (absx < 1.0
- && absx >= 0.5
- && scale == 0
- && absx * absx + absy * absy >= 0.5)
- {
- double d2m1 = __x2y2m1 (absx, absy);
- __real__ result = __log1p (d2m1) * (M_LOG10E / 2.0);
- }
- else
- {
- double d = __ieee754_hypot (absx, absy);
- __real__ result = __ieee754_log10 (d) - scale * M_LOG10_2;
- }
-
- __imag__ result = M_LOG10E * __ieee754_atan2 (__imag__ x, __real__ x);
- }
- else
- {
- __imag__ result = __nan ("");
- if (rcls == FP_INFINITE || icls == FP_INFINITE)
- /* Real or imaginary part is infinite. */
- __real__ result = HUGE_VAL;
- else
- __real__ result = __nan ("");
- }
-
- return result;
-}
-weak_alias (__clog10, clog10)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__clog10, __clog10l)
-weak_alias (__clog10, clog10l)
-#endif
deleted file mode 100644
@@ -1,122 +0,0 @@
-/* Compute complex base 10 logarithm.
- 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>
-#include <float.h>
-
-/* log_10 (2). */
-#define M_LOG10_2f 0.3010299956639811952137388947244930267682f
-
-/* pi * log10 (e). */
-#define M_PI_LOG10Ef 1.364376353841841347485783625431355770210f
-
-__complex__ float
-__clog10f (__complex__ float x)
-{
- __complex__ float result;
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
- {
- /* Real and imaginary part are 0.0. */
- __imag__ result = signbit (__real__ x) ? M_PI_LOG10Ef : 0.0;
- __imag__ result = __copysignf (__imag__ result, __imag__ x);
- /* Yes, the following line raises an exception. */
- __real__ result = -1.0 / fabsf (__real__ x);
- }
- else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
- {
- /* Neither real nor imaginary part is NaN. */
- float absx = fabsf (__real__ x), absy = fabsf (__imag__ x);
- int scale = 0;
-
- if (absx < absy)
- {
- float t = absx;
- absx = absy;
- absy = t;
- }
-
- if (absx > FLT_MAX / 2.0f)
- {
- scale = -1;
- absx = __scalbnf (absx, scale);
- absy = (absy >= FLT_MIN * 2.0f ? __scalbnf (absy, scale) : 0.0f);
- }
- else if (absx < FLT_MIN && absy < FLT_MIN)
- {
- scale = FLT_MANT_DIG;
- absx = __scalbnf (absx, scale);
- absy = __scalbnf (absy, scale);
- }
-
- if (absx == 1.0f && scale == 0)
- {
- __real__ result = __log1pf (absy * absy) * ((float) M_LOG10E / 2.0f);
- math_check_force_underflow_nonneg (__real__ result);
- }
- else if (absx > 1.0f && absx < 2.0f && absy < 1.0f && scale == 0)
- {
- float d2m1 = (absx - 1.0f) * (absx + 1.0f);
- if (absy >= FLT_EPSILON)
- d2m1 += absy * absy;
- __real__ result = __log1pf (d2m1) * ((float) M_LOG10E / 2.0f);
- }
- else if (absx < 1.0f
- && absx >= 0.5f
- && absy < FLT_EPSILON / 2.0f
- && scale == 0)
- {
- float d2m1 = (absx - 1.0f) * (absx + 1.0f);
- __real__ result = __log1pf (d2m1) * ((float) M_LOG10E / 2.0f);
- }
- else if (absx < 1.0f
- && absx >= 0.5f
- && scale == 0
- && absx * absx + absy * absy >= 0.5f)
- {
- float d2m1 = __x2y2m1f (absx, absy);
- __real__ result = __log1pf (d2m1) * ((float) M_LOG10E / 2.0f);
- }
- else
- {
- float d = __ieee754_hypotf (absx, absy);
- __real__ result = __ieee754_log10f (d) - scale * M_LOG10_2f;
- }
-
- __imag__ result = M_LOG10E * __ieee754_atan2f (__imag__ x, __real__ x);
- }
- else
- {
- __imag__ result = __nanf ("");
- if (rcls == FP_INFINITE || icls == FP_INFINITE)
- /* Real or imaginary part is infinite. */
- __real__ result = HUGE_VALF;
- else
- __real__ result = __nanf ("");
- }
-
- return result;
-}
-#ifndef __clog10f
-weak_alias (__clog10f, clog10f)
-#endif
deleted file mode 100644
@@ -1,127 +0,0 @@
-/* Compute complex base 10 logarithm.
- 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>
-#include <float.h>
-
-/* To avoid spurious underflows, 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
-
-/* log_10 (2). */
-#define M_LOG10_2l 0.3010299956639811952137388947244930267682L
-
-/* pi * log10 (e). */
-#define M_PI_LOG10El 1.364376353841841347485783625431355770210L
-
-__complex__ long double
-__clog10l (__complex__ long double x)
-{
- __complex__ long double result;
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
- {
- /* Real and imaginary part are 0.0. */
- __imag__ result = signbit (__real__ x) ? M_PI_LOG10El : 0.0;
- __imag__ result = __copysignl (__imag__ result, __imag__ x);
- /* Yes, the following line raises an exception. */
- __real__ result = -1.0 / fabsl (__real__ x);
- }
- else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
- {
- /* Neither real nor imaginary part is NaN. */
- long double absx = fabsl (__real__ x), absy = fabsl (__imag__ x);
- int scale = 0;
-
- if (absx < absy)
- {
- long double t = absx;
- absx = absy;
- absy = t;
- }
-
- if (absx > LDBL_MAX / 2.0L)
- {
- scale = -1;
- absx = __scalbnl (absx, scale);
- absy = (absy >= LDBL_MIN * 2.0L ? __scalbnl (absy, scale) : 0.0L);
- }
- else if (absx < LDBL_MIN && absy < LDBL_MIN)
- {
- scale = LDBL_MANT_DIG;
- absx = __scalbnl (absx, scale);
- absy = __scalbnl (absy, scale);
- }
-
- if (absx == 1.0L && scale == 0)
- {
- __real__ result = __log1pl (absy * absy) * (M_LOG10El / 2.0L);
- math_check_force_underflow_nonneg (__real__ result);
- }
- else if (absx > 1.0L && absx < 2.0L && absy < 1.0L && scale == 0)
- {
- long double d2m1 = (absx - 1.0L) * (absx + 1.0L);
- if (absy >= LDBL_EPSILON)
- d2m1 += absy * absy;
- __real__ result = __log1pl (d2m1) * (M_LOG10El / 2.0L);
- }
- else if (absx < 1.0L
- && absx >= 0.5L
- && absy < LDBL_EPSILON / 2.0L
- && scale == 0)
- {
- long double d2m1 = (absx - 1.0L) * (absx + 1.0L);
- __real__ result = __log1pl (d2m1) * (M_LOG10El / 2.0L);
- }
- else if (absx < 1.0L
- && absx >= 0.5L
- && scale == 0
- && absx * absx + absy * absy >= 0.5L)
- {
- long double d2m1 = __x2y2m1l (absx, absy);
- __real__ result = __log1pl (d2m1) * (M_LOG10El / 2.0L);
- }
- else
- {
- long double d = __ieee754_hypotl (absx, absy);
- __real__ result = __ieee754_log10l (d) - scale * M_LOG10_2l;
- }
-
- __imag__ result = M_LOG10El * __ieee754_atan2l (__imag__ x, __real__ x);
- }
- else
- {
- __imag__ result = __nanl ("");
- if (rcls == FP_INFINITE || icls == FP_INFINITE)
- /* Real or imaginary part is infinite. */
- __real__ result = HUGE_VALL;
- else
- __real__ result = __nanl ("");
- }
-
- return result;
-}
-weak_alias (__clog10l, clog10l)
deleted file mode 100644
@@ -1,116 +0,0 @@
-/* Compute complex natural logarithm.
- 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>
-#include <float.h>
-
-__complex__ float
-__clogf (__complex__ float x)
-{
- __complex__ float result;
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
- {
- /* Real and imaginary part are 0.0. */
- __imag__ result = signbit (__real__ x) ? M_PI : 0.0;
- __imag__ result = __copysignf (__imag__ result, __imag__ x);
- /* Yes, the following line raises an exception. */
- __real__ result = -1.0 / fabsf (__real__ x);
- }
- else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
- {
- /* Neither real nor imaginary part is NaN. */
- float absx = fabsf (__real__ x), absy = fabsf (__imag__ x);
- int scale = 0;
-
- if (absx < absy)
- {
- float t = absx;
- absx = absy;
- absy = t;
- }
-
- if (absx > FLT_MAX / 2.0f)
- {
- scale = -1;
- absx = __scalbnf (absx, scale);
- absy = (absy >= FLT_MIN * 2.0f ? __scalbnf (absy, scale) : 0.0f);
- }
- else if (absx < FLT_MIN && absy < FLT_MIN)
- {
- scale = FLT_MANT_DIG;
- absx = __scalbnf (absx, scale);
- absy = __scalbnf (absy, scale);
- }
-
- if (absx == 1.0f && scale == 0)
- {
- __real__ result = __log1pf (absy * absy) / 2.0f;
- math_check_force_underflow_nonneg (__real__ result);
- }
- else if (absx > 1.0f && absx < 2.0f && absy < 1.0f && scale == 0)
- {
- float d2m1 = (absx - 1.0f) * (absx + 1.0f);
- if (absy >= FLT_EPSILON)
- d2m1 += absy * absy;
- __real__ result = __log1pf (d2m1) / 2.0f;
- }
- else if (absx < 1.0f
- && absx >= 0.5f
- && absy < FLT_EPSILON / 2.0f
- && scale == 0)
- {
- float d2m1 = (absx - 1.0f) * (absx + 1.0f);
- __real__ result = __log1pf (d2m1) / 2.0f;
- }
- else if (absx < 1.0f
- && absx >= 0.5f
- && scale == 0
- && absx * absx + absy * absy >= 0.5f)
- {
- float d2m1 = __x2y2m1f (absx, absy);
- __real__ result = __log1pf (d2m1) / 2.0f;
- }
- else
- {
- float d = __ieee754_hypotf (absx, absy);
- __real__ result = __ieee754_logf (d) - scale * (float) M_LN2;
- }
-
- __imag__ result = __ieee754_atan2f (__imag__ x, __real__ x);
- }
- else
- {
- __imag__ result = __nanf ("");
- if (rcls == FP_INFINITE || icls == FP_INFINITE)
- /* Real or imaginary part is infinite. */
- __real__ result = HUGE_VALF;
- else
- __real__ result = __nanf ("");
- }
-
- return result;
-}
-#ifndef __clogf
-weak_alias (__clogf, clogf)
-#endif
deleted file mode 100644
@@ -1,121 +0,0 @@
-/* Compute complex natural logarithm.
- 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>
-#include <float.h>
-
-/* To avoid spurious underflows, 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
-
-__complex__ long double
-__clogl (__complex__ long double x)
-{
- __complex__ long double result;
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO))
- {
- /* Real and imaginary part are 0.0. */
- __imag__ result = signbit (__real__ x) ? M_PIl : 0.0;
- __imag__ result = __copysignl (__imag__ result, __imag__ x);
- /* Yes, the following line raises an exception. */
- __real__ result = -1.0 / fabsl (__real__ x);
- }
- else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN))
- {
- /* Neither real nor imaginary part is NaN. */
- long double absx = fabsl (__real__ x), absy = fabsl (__imag__ x);
- int scale = 0;
-
- if (absx < absy)
- {
- long double t = absx;
- absx = absy;
- absy = t;
- }
-
- if (absx > LDBL_MAX / 2.0L)
- {
- scale = -1;
- absx = __scalbnl (absx, scale);
- absy = (absy >= LDBL_MIN * 2.0L ? __scalbnl (absy, scale) : 0.0L);
- }
- else if (absx < LDBL_MIN && absy < LDBL_MIN)
- {
- scale = LDBL_MANT_DIG;
- absx = __scalbnl (absx, scale);
- absy = __scalbnl (absy, scale);
- }
-
- if (absx == 1.0L && scale == 0)
- {
- __real__ result = __log1pl (absy * absy) / 2.0L;
- math_check_force_underflow_nonneg (__real__ result);
- }
- else if (absx > 1.0L && absx < 2.0L && absy < 1.0L && scale == 0)
- {
- long double d2m1 = (absx - 1.0L) * (absx + 1.0L);
- if (absy >= LDBL_EPSILON)
- d2m1 += absy * absy;
- __real__ result = __log1pl (d2m1) / 2.0L;
- }
- else if (absx < 1.0L
- && absx >= 0.5L
- && absy < LDBL_EPSILON / 2.0L
- && scale == 0)
- {
- long double d2m1 = (absx - 1.0L) * (absx + 1.0L);
- __real__ result = __log1pl (d2m1) / 2.0L;
- }
- else if (absx < 1.0L
- && absx >= 0.5L
- && scale == 0
- && absx * absx + absy * absy >= 0.5L)
- {
- long double d2m1 = __x2y2m1l (absx, absy);
- __real__ result = __log1pl (d2m1) / 2.0L;
- }
- else
- {
- long double d = __ieee754_hypotl (absx, absy);
- __real__ result = __ieee754_logl (d) - scale * M_LN2l;
- }
-
- __imag__ result = __ieee754_atan2l (__imag__ x, __real__ x);
- }
- else
- {
- __imag__ result = __nanl ("");
- if (rcls == FP_INFINITE || icls == FP_INFINITE)
- /* Real or imaginary part is infinite. */
- __real__ result = HUGE_VALL;
- else
- __real__ result = __nanl ("");
- }
-
- return result;
-}
-weak_alias (__clogl, clogl)
deleted file mode 100644
@@ -1,33 +0,0 @@
-/* Complex power of double values.
- 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>
-
-
-__complex__ double
-__cpow (__complex__ double x, __complex__ double c)
-{
- return __cexp (c * __clog (x));
-}
-weak_alias (__cpow, cpow)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cpow, __cpowl)
-weak_alias (__cpow, cpowl)
-#endif
deleted file mode 100644
@@ -1,31 +0,0 @@
-/* Complex power of float values.
- 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>
-
-
-__complex__ float
-__cpowf (__complex__ float x, __complex__ float c)
-{
- return __cexpf (c * __clogf (x));
-}
-#ifndef __cpowf
-weak_alias (__cpowf, cpowf)
-#endif
deleted file mode 100644
@@ -1,29 +0,0 @@
-/* Complex power of long double values.
- 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>
-
-
-__complex__ long double
-__cpowl (__complex__ long double x, __complex__ long double c)
-{
- return __cexpl (c * __clogl (x));
-}
-weak_alias (__cpowl, cpowl)
deleted file mode 100644
@@ -1,44 +0,0 @@
-/* Compute projection of complex double value to Riemann sphere.
- 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
-__cproj (__complex__ double x)
-{
- if (isinf (__real__ x) || isinf (__imag__ x))
- {
- __complex__ double res;
-
- __real__ res = INFINITY;
- __imag__ res = __copysign (0.0, __imag__ x);
-
- return res;
- }
-
- return x;
-}
-weak_alias (__cproj, cproj)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__cproj, __cprojl)
-weak_alias (__cproj, cprojl)
-#endif
deleted file mode 100644
@@ -1,42 +0,0 @@
-/* Compute projection of complex float value to Riemann sphere.
- 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
-__cprojf (__complex__ float x)
-{
- if (isinf (__real__ x) || isinf (__imag__ x))
- {
- __complex__ float res;
-
- __real__ res = INFINITY;
- __imag__ res = __copysignf (0.0, __imag__ x);
-
- return res;
- }
-
- return x;
-}
-#ifndef __cprojf
-weak_alias (__cprojf, cprojf)
-#endif
deleted file mode 100644
@@ -1,40 +0,0 @@
-/* Compute projection of complex long double value to Riemann sphere.
- 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
-__cprojl (__complex__ long double x)
-{
- if (isinf (__real__ x) || isinf (__imag__ x))
- {
- __complex__ long double res;
-
- __real__ res = INFINITY;
- __imag__ res = __copysignl (0.0, __imag__ x);
-
- return res;
- }
-
- return x;
-}
-weak_alias (__cprojl, cprojl)
deleted file mode 100644
@@ -1,165 +0,0 @@
-/* Complex square root of double value.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
- 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>
-#include <float.h>
-
-__complex__ double
-__csqrt (__complex__ double x)
-{
- __complex__ double res;
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
- {
- if (icls == FP_INFINITE)
- {
- __real__ res = HUGE_VAL;
- __imag__ res = __imag__ x;
- }
- else if (rcls == FP_INFINITE)
- {
- if (__real__ x < 0.0)
- {
- __real__ res = icls == FP_NAN ? __nan ("") : 0;
- __imag__ res = __copysign (HUGE_VAL, __imag__ x);
- }
- else
- {
- __real__ res = __real__ x;
- __imag__ res = (icls == FP_NAN
- ? __nan ("") : __copysign (0.0, __imag__ x));
- }
- }
- else
- {
- __real__ res = __nan ("");
- __imag__ res = __nan ("");
- }
- }
- else
- {
- if (__glibc_unlikely (icls == FP_ZERO))
- {
- if (__real__ x < 0.0)
- {
- __real__ res = 0.0;
- __imag__ res = __copysign (__ieee754_sqrt (-__real__ x),
- __imag__ x);
- }
- else
- {
- __real__ res = fabs (__ieee754_sqrt (__real__ x));
- __imag__ res = __copysign (0.0, __imag__ x);
- }
- }
- else if (__glibc_unlikely (rcls == FP_ZERO))
- {
- double r;
- if (fabs (__imag__ x) >= 2.0 * DBL_MIN)
- r = __ieee754_sqrt (0.5 * fabs (__imag__ x));
- else
- r = 0.5 * __ieee754_sqrt (2.0 * fabs (__imag__ x));
-
- __real__ res = r;
- __imag__ res = __copysign (r, __imag__ x);
- }
- else
- {
- double d, r, s;
- int scale = 0;
-
- if (fabs (__real__ x) > DBL_MAX / 4.0)
- {
- scale = 1;
- __real__ x = __scalbn (__real__ x, -2 * scale);
- __imag__ x = __scalbn (__imag__ x, -2 * scale);
- }
- else if (fabs (__imag__ x) > DBL_MAX / 4.0)
- {
- scale = 1;
- if (fabs (__real__ x) >= 4.0 * DBL_MIN)
- __real__ x = __scalbn (__real__ x, -2 * scale);
- else
- __real__ x = 0.0;
- __imag__ x = __scalbn (__imag__ x, -2 * scale);
- }
- else if (fabs (__real__ x) < 2.0 * DBL_MIN
- && fabs (__imag__ x) < 2.0 * DBL_MIN)
- {
- scale = -((DBL_MANT_DIG + 1) / 2);
- __real__ x = __scalbn (__real__ x, -2 * scale);
- __imag__ x = __scalbn (__imag__ x, -2 * scale);
- }
-
- d = __ieee754_hypot (__real__ x, __imag__ x);
- /* Use the identity 2 Re res Im res = Im x
- to avoid cancellation error in d +/- Re x. */
- if (__real__ x > 0)
- {
- r = __ieee754_sqrt (0.5 * (d + __real__ x));
- if (scale == 1 && fabs (__imag__ x) < 1.0)
- {
- /* Avoid possible intermediate underflow. */
- s = __imag__ x / r;
- r = __scalbn (r, scale);
- scale = 0;
- }
- else
- s = 0.5 * (__imag__ x / r);
- }
- else
- {
- s = __ieee754_sqrt (0.5 * (d - __real__ x));
- if (scale == 1 && fabs (__imag__ x) < 1.0)
- {
- /* Avoid possible intermediate underflow. */
- r = fabs (__imag__ x / s);
- s = __scalbn (s, scale);
- scale = 0;
- }
- else
- r = fabs (0.5 * (__imag__ x / s));
- }
-
- if (scale)
- {
- r = __scalbn (r, scale);
- s = __scalbn (s, scale);
- }
-
- math_check_force_underflow (r);
- math_check_force_underflow (s);
-
- __real__ res = r;
- __imag__ res = __copysign (s, __imag__ x);
- }
- }
-
- return res;
-}
-weak_alias (__csqrt, csqrt)
-#ifdef NO_LONG_DOUBLE
-strong_alias (__csqrt, __csqrtl)
-weak_alias (__csqrt, csqrtl)
-#endif
deleted file mode 100644
@@ -1,163 +0,0 @@
-/* Complex square root of float value.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
- 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>
-#include <float.h>
-
-__complex__ float
-__csqrtf (__complex__ float x)
-{
- __complex__ float res;
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
- {
- if (icls == FP_INFINITE)
- {
- __real__ res = HUGE_VALF;
- __imag__ res = __imag__ x;
- }
- else if (rcls == FP_INFINITE)
- {
- if (__real__ x < 0.0)
- {
- __real__ res = icls == FP_NAN ? __nanf ("") : 0;
- __imag__ res = __copysignf (HUGE_VALF, __imag__ x);
- }
- else
- {
- __real__ res = __real__ x;
- __imag__ res = (icls == FP_NAN
- ? __nanf ("") : __copysignf (0.0, __imag__ x));
- }
- }
- else
- {
- __real__ res = __nanf ("");
- __imag__ res = __nanf ("");
- }
- }
- else
- {
- if (__glibc_unlikely (icls == FP_ZERO))
- {
- if (__real__ x < 0.0)
- {
- __real__ res = 0.0;
- __imag__ res = __copysignf (__ieee754_sqrtf (-__real__ x),
- __imag__ x);
- }
- else
- {
- __real__ res = fabsf (__ieee754_sqrtf (__real__ x));
- __imag__ res = __copysignf (0.0, __imag__ x);
- }
- }
- else if (__glibc_unlikely (rcls == FP_ZERO))
- {
- float r;
- if (fabsf (__imag__ x) >= 2.0f * FLT_MIN)
- r = __ieee754_sqrtf (0.5f * fabsf (__imag__ x));
- else
- r = 0.5f * __ieee754_sqrtf (2.0f * fabsf (__imag__ x));
-
- __real__ res = r;
- __imag__ res = __copysignf (r, __imag__ x);
- }
- else
- {
- float d, r, s;
- int scale = 0;
-
- if (fabsf (__real__ x) > FLT_MAX / 4.0f)
- {
- scale = 1;
- __real__ x = __scalbnf (__real__ x, -2 * scale);
- __imag__ x = __scalbnf (__imag__ x, -2 * scale);
- }
- else if (fabsf (__imag__ x) > FLT_MAX / 4.0f)
- {
- scale = 1;
- if (fabsf (__real__ x) >= 4.0f * FLT_MIN)
- __real__ x = __scalbnf (__real__ x, -2 * scale);
- else
- __real__ x = 0.0f;
- __imag__ x = __scalbnf (__imag__ x, -2 * scale);
- }
- else if (fabsf (__real__ x) < 2.0f * FLT_MIN
- && fabsf (__imag__ x) < 2.0f * FLT_MIN)
- {
- scale = -((FLT_MANT_DIG + 1) / 2);
- __real__ x = __scalbnf (__real__ x, -2 * scale);
- __imag__ x = __scalbnf (__imag__ x, -2 * scale);
- }
-
- d = __ieee754_hypotf (__real__ x, __imag__ x);
- /* Use the identity 2 Re res Im res = Im x
- to avoid cancellation error in d +/- Re x. */
- if (__real__ x > 0)
- {
- r = __ieee754_sqrtf (0.5f * (d + __real__ x));
- if (scale == 1 && fabsf (__imag__ x) < 1.0f)
- {
- /* Avoid possible intermediate underflow. */
- s = __imag__ x / r;
- r = __scalbnf (r, scale);
- scale = 0;
- }
- else
- s = 0.5f * (__imag__ x / r);
- }
- else
- {
- s = __ieee754_sqrtf (0.5f * (d - __real__ x));
- if (scale == 1 && fabsf (__imag__ x) < 1.0f)
- {
- /* Avoid possible intermediate underflow. */
- r = fabsf (__imag__ x / s);
- s = __scalbnf (s, scale);
- scale = 0;
- }
- else
- r = fabsf (0.5f * (__imag__ x / s));
- }
-
- if (scale)
- {
- r = __scalbnf (r, scale);
- s = __scalbnf (s, scale);
- }
-
- math_check_force_underflow (r);
- math_check_force_underflow (s);
-
- __real__ res = r;
- __imag__ res = __copysignf (s, __imag__ x);
- }
- }
-
- return res;
-}
-#ifndef __csqrtf
-weak_alias (__csqrtf, csqrtf)
-#endif
deleted file mode 100644
@@ -1,161 +0,0 @@
-/* Complex square root of long double value.
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Based on an algorithm by Stephen L. Moshier <moshier@world.std.com>.
- 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>
-#include <float.h>
-
-__complex__ long double
-__csqrtl (__complex__ long double x)
-{
- __complex__ long double res;
- int rcls = fpclassify (__real__ x);
- int icls = fpclassify (__imag__ x);
-
- if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE))
- {
- if (icls == FP_INFINITE)
- {
- __real__ res = HUGE_VALL;
- __imag__ res = __imag__ x;
- }
- else if (rcls == FP_INFINITE)
- {
- if (__real__ x < 0.0)
- {
- __real__ res = icls == FP_NAN ? __nanl ("") : 0;
- __imag__ res = __copysignl (HUGE_VALL, __imag__ x);
- }
- else
- {
- __real__ res = __real__ x;
- __imag__ res = (icls == FP_NAN
- ? __nanl ("") : __copysignl (0.0, __imag__ x));
- }
- }
- else
- {
- __real__ res = __nanl ("");
- __imag__ res = __nanl ("");
- }
- }
- else
- {
- if (__glibc_unlikely (icls == FP_ZERO))
- {
- if (__real__ x < 0.0)
- {
- __real__ res = 0.0;
- __imag__ res = __copysignl (__ieee754_sqrtl (-__real__ x),
- __imag__ x);
- }
- else
- {
- __real__ res = fabsl (__ieee754_sqrtl (__real__ x));
- __imag__ res = __copysignl (0.0, __imag__ x);
- }
- }
- else if (__glibc_unlikely (rcls == FP_ZERO))
- {
- long double r;
- if (fabsl (__imag__ x) >= 2.0L * LDBL_MIN)
- r = __ieee754_sqrtl (0.5L * fabsl (__imag__ x));
- else
- r = 0.5L * __ieee754_sqrtl (2.0L * fabsl (__imag__ x));
-
- __real__ res = r;
- __imag__ res = __copysignl (r, __imag__ x);
- }
- else
- {
- long double d, r, s;
- int scale = 0;
-
- if (fabsl (__real__ x) > LDBL_MAX / 4.0L)
- {
- scale = 1;
- __real__ x = __scalbnl (__real__ x, -2 * scale);
- __imag__ x = __scalbnl (__imag__ x, -2 * scale);
- }
- else if (fabsl (__imag__ x) > LDBL_MAX / 4.0L)
- {
- scale = 1;
- if (fabsl (__real__ x) >= 4.0L * LDBL_MIN)
- __real__ x = __scalbnl (__real__ x, -2 * scale);
- else
- __real__ x = 0.0L;
- __imag__ x = __scalbnl (__imag__ x, -2 * scale);
- }
- else if (fabsl (__real__ x) < 2.0L * LDBL_MIN
- && fabsl (__imag__ x) < 2.0L * LDBL_MIN)
- {
- scale = -((LDBL_MANT_DIG + 1) / 2);
- __real__ x = __scalbnl (__real__ x, -2 * scale);
- __imag__ x = __scalbnl (__imag__ x, -2 * scale);
- }
-
- d = __ieee754_hypotl (__real__ x, __imag__ x);
- /* Use the identity 2 Re res Im res = Im x
- to avoid cancellation error in d +/- Re x. */
- if (__real__ x > 0)
- {
- r = __ieee754_sqrtl (0.5L * (d + __real__ x));
- if (scale == 1 && fabsl (__imag__ x) < 1.0L)
- {
- /* Avoid possible intermediate underflow. */
- s = __imag__ x / r;
- r = __scalbnl (r, scale);
- scale = 0;
- }
- else
- s = 0.5L * (__imag__ x / r);
- }
- else
- {
- s = __ieee754_sqrtl (0.5L * (d - __real__ x));
- if (scale == 1 && fabsl (__imag__ x) < 1.0L)
- {
- /* Avoid possible intermediate underflow. */
- r = fabsl (__imag__ x / s);
- s = __scalbnl (s, scale);
- scale = 0;
- }
- else
- r = fabsl (0.5L * (__imag__ x / s));
- }
-
- if (scale)
- {
- r = __scalbnl (r, scale);
- s = __scalbnl (s, scale);
- }
-
- math_check_force_underflow (r);
- math_check_force_underflow (s);
-
- __real__ res = r;
- __imag__ res = __copysignl (s, __imag__ x);
- }
- }
-
- return res;
-}
-weak_alias (__csqrtl, csqrtl)
@@ -2,7 +2,9 @@
# the respectic s_*.c versions here.
libm-gen-calls-override = g_cabs_f g_carg_f g_cimag_f g_creal_f g_conj_f \
g_cacos_f g_cacosh_f g_ccos_f g_ccosh_f g_casin_f g_csin_f \
- g_casinh_f g_csinh_f g_catan_f g_catanh_f g_ctan_f g_ctanh_f
+ g_casinh_f g_csinh_f g_catan_f g_catanh_f g_ctan_f g_ctanh_f \
+ g_cexp_f g_clog_f g_cproj_f g_csqrt_f g_cpow_f g_clog10_f
libm-gen-replacement-calls = cabsf cargf cimagf crealf conjf \
s_cacosf s_cacoshf s_ccosf s_ccoshf s_casinf s_csinf \
- s_casinhf s_csinhf s_catanf s_catanhf s_ctanf s_ctanhf
+ s_casinhf s_csinhf s_catanf s_catanhf s_ctanf s_ctanhf \
+ s_cexpf s_clogf s_cprojf s_csqrtf s_cpowf s_clog10f
@@ -24,14 +24,19 @@
#undef __cexpf
#undef cexpf
-#define __cexpf internal_cexpf
static _Complex float internal_cexpf (_Complex float x);
-#include <math/s_cexpf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_cexpf
+#define M_TYPE M_FLOAT
+#include <math-type-macros.h>
-#undef __cexpf
+/* Disable any aliasing from base template. */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/b_cexp.c>
+#include "cfloat-compat.h"
c1_cfloat_rettype
__c1_cexpf (c1_cfloat_decl (x))
@@ -24,14 +24,21 @@
#undef __clog10f
#undef clog10f
-#define __clog10f internal_clog10f
static _Complex float internal_clog10f (_Complex float x);
-#include <math/s_clog10f.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_clog10f
+#define M_TYPE M_FLOAT
+/* Disable any non-standard aliasing. */
+#define M_INHIBIT_ALIASING 1
+#include <math-type-macros.h>
-#undef __clog10f
+/* Disable any aliasing from base template. */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/b_clog10.c>
+#include "cfloat-compat.h"
c1_cfloat_rettype
__c1_clog10f (c1_cfloat_decl (x))
@@ -24,14 +24,19 @@
#undef __clogf
#undef clogf
-#define __clogf internal_clogf
static _Complex float internal_clogf (_Complex float x);
-#include <math/s_clogf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_clogf
+#define M_TYPE M_FLOAT
+#include <math-type-macros.h>
-#undef __clogf
+/* Disable any aliasing from base template. */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/b_clog.c>
+#include "cfloat-compat.h"
c1_cfloat_rettype
__c1_clogf (c1_cfloat_decl (x))
@@ -24,14 +24,19 @@
#undef __cpowf
#undef cpowf
-#define __cpowf internal_cpowf
static _Complex float internal_cpowf (_Complex float x, _Complex float c);
-#include <math/s_cpowf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_cpowf
+#define M_TYPE M_FLOAT
+#include <math-type-macros.h>
-#undef __cpowf
+/* Disable any aliasing from base template. */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/b_cpow.c>
+#include "cfloat-compat.h"
c1_cfloat_rettype
__c1_cpowf (c1_cfloat_decl (x), c1_cfloat_decl (c))
@@ -24,14 +24,19 @@
#undef __cprojf
#undef cprojf
-#define __cprojf internal_cprojf
static _Complex float internal_cprojf (_Complex float x);
-#include <math/s_cprojf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_cprojf
+#define M_TYPE M_FLOAT
+#include <math-type-macros.h>
-#undef __cprojf
+/* Disable any aliasing from base template. */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/b_cproj.c>
+#include "cfloat-compat.h"
c1_cfloat_rettype
__c1_cprojf (c1_cfloat_decl (x))
@@ -24,14 +24,19 @@
#undef __csqrtf
#undef csqrtf
-#define __csqrtf internal_csqrtf
static _Complex float internal_csqrtf (_Complex float x);
-#include <math/s_csqrtf.c>
-#include "cfloat-compat.h"
+#define M_DECL_FUNC(f) internal_csqrtf
+#define M_TYPE M_FLOAT
+#include <math-type-macros.h>
-#undef __csqrtf
+/* Disable any aliasing from base template. */
+#undef declare_mgen_alias
+#define declare_mgen_alias(__to, __from)
+
+#include <math/b_csqrt.c>
+#include "cfloat-compat.h"
c1_cfloat_rettype
__c1_csqrtf (c1_cfloat_decl (x))
@@ -19,5 +19,12 @@
#define LDOUBLE_catanhl_libm_version GLIBC_2_1
#define LDOUBLE_ctanl_libm_version GLIBC_2_1
#define LDOUBLE_ctanhl_libm_version GLIBC_2_1
+#define LDOUBLE_cexpl_libm_version GLIBC_2_1
+#define LDOUBLE_clogl_libm_version GLIBC_2_1
+#define LDOUBLE_cprojl_libm_version GLIBC_2_1
+#define LDOUBLE_csqrtl_libm_version GLIBC_2_1
+#define LDOUBLE_cpowl_libm_version GLIBC_2_1
+#define LDOUBLE_clog10l_libm_version GLIBC_2_1
+#define LDOUBLE___clog10l_libm_version GLIBC_2_1
#include_next <math-type-macros.h>
deleted file mode 100644
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_cexp.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __cexp, cexpl, GLIBC_2_1);
-#endif
deleted file mode 100644
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_cexpl.c>
-long_double_symbol (libm, __cexpl, cexpl);
deleted file mode 100644
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_clog.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __clog, clogl, GLIBC_2_1);
-#endif
deleted file mode 100644
@@ -1,7 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_clog10.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __clog10, __clog10l, GLIBC_2_1);
-compat_symbol (libm, clog10, clog10l, GLIBC_2_1);
-#endif
deleted file mode 100644
@@ -1,10 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#define __clog10l __clog10l_internal
-#include <math/s_clog10l.c>
-#undef __clog10l
-strong_alias (__clog10l_internal, __clog10l__internal)
-long_double_symbol (libm, __clog10l_internal, __clog10l);
-long_double_symbol (libm, __clog10l__internal, clog10l);
deleted file mode 100644
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_clogl.c>
-long_double_symbol (libm, __clogl, clogl);
deleted file mode 100644
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_cpow.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __cpow, cpowl, GLIBC_2_1);
-#endif
deleted file mode 100644
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_cpowl.c>
-long_double_symbol (libm, __cpowl, cpowl);
deleted file mode 100644
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_cproj.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __cproj, cprojl, GLIBC_2_1);
-#endif
deleted file mode 100644
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_cprojl.c>
-long_double_symbol (libm, __cprojl, cprojl);
deleted file mode 100644
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#include <math/s_csqrt.c>
-#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1)
-compat_symbol (libm, __csqrt, csqrtl, GLIBC_2_1);
-#endif
deleted file mode 100644
@@ -1,6 +0,0 @@
-#include <complex.h>
-#include <math_ldbl_opt.h>
-#undef weak_alias
-#define weak_alias(n,a)
-#include <math/s_csqrtl.c>
-long_double_symbol (libm, __csqrtl, csqrtl);
new file mode 100644
@@ -0,0 +1,129 @@
+/* Complex exponential function. m68k fpu version
+ Copyright (C) 1997-2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ 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 <float.h>
+#include <complex.h>
+#include <math.h>
+#include "mathimpl.h"
+
+#define CONCATX(a,b) __CONCAT(a,b)
+#define s(name) M_FUNC (name)
+#define m81(func) __m81_u(s(func))
+
+CFLOAT
+s(__cexp) (CFLOAT x)
+{
+ CFLOAT retval;
+ unsigned long ix_cond;
+
+ ix_cond = __m81_test (__imag__ x);
+
+ if ((ix_cond & (__M81_COND_NAN|__M81_COND_INF)) == 0)
+ {
+ /* Imaginary part is finite. */
+ unsigned long rx_cond = __m81_test (__real__ x);
+
+ if ((rx_cond & (__M81_COND_NAN|__M81_COND_INF)) == 0)
+ {
+ const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l);
+ long double sin_ix, cos_ix, exp_val;
+
+ __m81_u (__sincosl) (__imag__ x, &sin_ix, &cos_ix);
+
+ if (__real__ x > t)
+ {
+ long double exp_t = __m81_u(__ieee754_expl) (t);
+ __real__ x -= t;
+ sin_ix *= exp_t;
+ cos_ix *= exp_t;
+ if (__real__ x > t)
+ {
+ __real__ x -= t;
+ sin_ix *= exp_t;
+ cos_ix *= exp_t;
+ }
+ }
+
+ exp_val = __m81_u(__ieee754_expl) (__real__ x);
+ __real__ retval = exp_val * cos_ix;
+ if (ix_cond & __M81_COND_ZERO)
+ __imag__ retval = __imag__ x;
+ else
+ __imag__ retval = exp_val * sin_ix;
+ }
+ else
+ {
+ /* Compute the sign of the result. */
+ long double remainder, pi_2;
+ int quadrant;
+
+ if ((rx_cond & (__M81_COND_NAN|__M81_COND_NEG)) == __M81_COND_NEG)
+ __real__ retval = __imag__ retval = 0.0;
+ else
+ __real__ retval = __imag__ retval = __real__ x;
+ __asm ("fmovecr %#0,%0\n\tfscale%.w %#-1,%0" : "=f" (pi_2));
+ __asm ("fmod%.x %2,%0\n\tfmove%.l %/fpsr,%1"
+ : "=f" (remainder), "=dm" (quadrant)
+ : "f" (pi_2), "0" (__imag__ x));
+ quadrant = (quadrant >> 16) & 0x83;
+ if (quadrant & 0x80)
+ quadrant ^= 0x83;
+ switch (quadrant)
+ {
+ default:
+ break;
+ case 1:
+ __real__ retval = -__real__ retval;
+ break;
+ case 2:
+ __real__ retval = -__real__ retval;
+ case 3:
+ __imag__ retval = -__imag__ retval;
+ break;
+ }
+ if (ix_cond & __M81_COND_ZERO && (rx_cond & __M81_COND_NAN) == 0)
+ __imag__ retval = __imag__ x;
+ }
+ }
+ else
+ {
+ unsigned long rx_cond = __m81_test (__real__ x);
+
+ if (rx_cond & __M81_COND_INF)
+ {
+ /* Real part is infinite. */
+ if (rx_cond & __M81_COND_NEG)
+ {
+ __real__ retval = __imag__ retval = 0.0;
+ if (ix_cond & __M81_COND_NEG)
+ __imag__ retval = -__imag__ retval;
+ }
+ else
+ {
+ __real__ retval = __real__ x;
+ __imag__ retval = __imag__ x - __imag__ x;
+ }
+ }
+ else
+ __real__ retval = __imag__ retval = __imag__ x - __imag__ x;
+ }
+
+ return retval;
+}
+weak_alias (s(__cexp), s(cexp))
deleted file mode 100644
@@ -1,136 +0,0 @@
-/* Complex exponential function. m68k fpu version
- Copyright (C) 1997-2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
-
- 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 <float.h>
-#include <complex.h>
-#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 m81(func) __m81_u(s(func))
-
-__complex__ float_type
-s(__cexp) (__complex__ float_type x)
-{
- __complex__ float_type retval;
- unsigned long ix_cond;
-
- ix_cond = __m81_test (__imag__ x);
-
- if ((ix_cond & (__M81_COND_NAN|__M81_COND_INF)) == 0)
- {
- /* Imaginary part is finite. */
- unsigned long rx_cond = __m81_test (__real__ x);
-
- if ((rx_cond & (__M81_COND_NAN|__M81_COND_INF)) == 0)
- {
- const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l);
- long double sin_ix, cos_ix, exp_val;
-
- __m81_u (__sincosl) (__imag__ x, &sin_ix, &cos_ix);
-
- if (__real__ x > t)
- {
- long double exp_t = __m81_u(__ieee754_expl) (t);
- __real__ x -= t;
- sin_ix *= exp_t;
- cos_ix *= exp_t;
- if (__real__ x > t)
- {
- __real__ x -= t;
- sin_ix *= exp_t;
- cos_ix *= exp_t;
- }
- }
-
- exp_val = __m81_u(__ieee754_expl) (__real__ x);
- __real__ retval = exp_val * cos_ix;
- if (ix_cond & __M81_COND_ZERO)
- __imag__ retval = __imag__ x;
- else
- __imag__ retval = exp_val * sin_ix;
- }
- else
- {
- /* Compute the sign of the result. */
- long double remainder, pi_2;
- int quadrant;
-
- if ((rx_cond & (__M81_COND_NAN|__M81_COND_NEG)) == __M81_COND_NEG)
- __real__ retval = __imag__ retval = 0.0;
- else
- __real__ retval = __imag__ retval = __real__ x;
- __asm ("fmovecr %#0,%0\n\tfscale%.w %#-1,%0" : "=f" (pi_2));
- __asm ("fmod%.x %2,%0\n\tfmove%.l %/fpsr,%1"
- : "=f" (remainder), "=dm" (quadrant)
- : "f" (pi_2), "0" (__imag__ x));
- quadrant = (quadrant >> 16) & 0x83;
- if (quadrant & 0x80)
- quadrant ^= 0x83;
- switch (quadrant)
- {
- default:
- break;
- case 1:
- __real__ retval = -__real__ retval;
- break;
- case 2:
- __real__ retval = -__real__ retval;
- case 3:
- __imag__ retval = -__imag__ retval;
- break;
- }
- if (ix_cond & __M81_COND_ZERO && (rx_cond & __M81_COND_NAN) == 0)
- __imag__ retval = __imag__ x;
- }
- }
- else
- {
- unsigned long rx_cond = __m81_test (__real__ x);
-
- if (rx_cond & __M81_COND_INF)
- {
- /* Real part is infinite. */
- if (rx_cond & __M81_COND_NEG)
- {
- __real__ retval = __imag__ retval = 0.0;
- if (ix_cond & __M81_COND_NEG)
- __imag__ retval = -__imag__ retval;
- }
- else
- {
- __real__ retval = __real__ x;
- __imag__ retval = __imag__ x - __imag__ x;
- }
- }
- else
- __real__ retval = __imag__ retval = __imag__ x - __imag__ x;
- }
-
- return retval;
-}
-weak_alias (s(__cexp), s(cexp))
deleted file mode 100644
@@ -1,3 +0,0 @@
-#define SUFF f
-#define float_type float
-#include <s_cexp.c>
deleted file mode 100644
@@ -1,3 +0,0 @@
-#define SUFF l
-#define float_type long double
-#include <s_cexp.c>