From patchwork Thu Jun 30 22:20:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul E. Murphy" X-Patchwork-Id: 13538 Received: (qmail 36298 invoked by alias); 30 Jun 2016 22:21:14 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 36204 invoked by uid 89); 30 Jun 2016 22:21:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=171, preserved, quadrant, UD:float.h X-HELO: mx0a-001b2d01.pphosted.com X-IBM-Helo: d03dlp03.boulder.ibm.com X-IBM-MailFrom: murphyp@linux.vnet.ibm.com From: "Paul E. Murphy" To: libc-alpha@sourceware.org Subject: [PATCH 4/6] Convert _Complex sine functions to generated code Date: Thu, 30 Jun 2016 17:20:40 -0500 In-Reply-To: References: In-Reply-To: References: X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16063022-0012-0000-0000-00001010AF56 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16063022-0013-0000-0000-0000433FC52E Message-Id: <570ba32eb8eba05e38a33e6f439dbd7493724e9c.1467323999.git.murphyp@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-06-30_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=4 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1606300211 Refactor s_c{,a}sin{,h}{f,,l} into a single templated macro. Note, the csinh variants have also drifted slightly. I have preserved the existing behavior, otherwise the code generation changes. * math/Makefile (gen-libm-calls): Move casin, casinh, csin, csinh here. (libm-calls): Remove the above. * math/s_casin.c: Refactor into * math/b_casin.c: New file * math/s_casinf.c: Removed * math/s_casinl.c: Removed * math/s_casinh.c: Refactor into * math/b_casinh.c: New file * math/s_casinhf.c: Removed * math/s_casinhl.c: Removed * math/s_csin.c: Refactor into * math/b_csin.c: New file * math/s_csinf.c: Removed * math/s_csinl.c: Removed * math/s_csinh.c: Refactor into * math/b_csinh.c: New file * math/s_csinhf.c: Removed * math/s_csinhl.c: Removed * math/k_casinh.c: Refactor into * math/b_k_casinh.c: New file * math/k_casinhf.c: Removed * math/k_casinhl.c: Removed * sysdeps/alpha/fpu/Makefile: Add overrides for _Complex float variants. * 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/math-type-macros.h: Add versioning info for compat symbols. * 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/b_csin.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/b_csinh.c: New file * sysdeps/m68k/m680x0/fpu/s_csinhf.c: Removed * sysdeps/m68k/m680x0/fpu/s_csinhl.c: Removed --- math/Makefile | 11 +- math/b_casin.c | 67 +++++++++ math/b_casinh.c | 76 ++++++++++ math/b_csin.c | 172 ++++++++++++++++++++++ math/b_csinh.c | 173 ++++++++++++++++++++++ math/b_k_casinh.c | 213 +++++++++++++++++++++++++++ math/k_casinh.c | 210 -------------------------- math/k_casinhf.c | 212 --------------------------- math/k_casinhl.c | 219 ---------------------------- math/s_casin.c | 66 --------- math/s_casinf.c | 64 -------- math/s_casinh.c | 73 ---------- math/s_casinhf.c | 71 --------- math/s_casinhl.c | 69 --------- math/s_casinl.c | 62 -------- math/s_csin.c | 171 ---------------------- math/s_csinf.c | 169 --------------------- math/s_csinh.c | 166 --------------------- math/s_csinhf.c | 166 --------------------- math/s_csinhl.c | 164 --------------------- math/s_csinl.c | 167 --------------------- sysdeps/alpha/fpu/Makefile | 6 +- sysdeps/alpha/fpu/s_casinf.c | 13 +- sysdeps/alpha/fpu/s_casinhf.c | 13 +- sysdeps/alpha/fpu/s_csinf.c | 13 +- sysdeps/alpha/fpu/s_csinhf.c | 13 +- sysdeps/ieee754/ldbl-opt/math-type-macros.h | 4 + sysdeps/ieee754/ldbl-opt/s_casin.c | 6 - sysdeps/ieee754/ldbl-opt/s_casinh.c | 6 - sysdeps/ieee754/ldbl-opt/s_casinhl.c | 6 - sysdeps/ieee754/ldbl-opt/s_casinl.c | 6 - sysdeps/ieee754/ldbl-opt/s_csin.c | 6 - sysdeps/ieee754/ldbl-opt/s_csinh.c | 6 - sysdeps/ieee754/ldbl-opt/s_csinhl.c | 6 - sysdeps/ieee754/ldbl-opt/s_csinl.c | 6 - sysdeps/m68k/m680x0/fpu/b_csin.c | 59 ++++++++ sysdeps/m68k/m680x0/fpu/b_csinh.c | 62 ++++++++ sysdeps/m68k/m680x0/fpu/s_csin.c | 67 --------- sysdeps/m68k/m680x0/fpu/s_csinf.c | 3 - sysdeps/m68k/m680x0/fpu/s_csinh.c | 69 --------- sysdeps/m68k/m680x0/fpu/s_csinhf.c | 3 - sysdeps/m68k/m680x0/fpu/s_csinhl.c | 3 - sysdeps/m68k/m680x0/fpu/s_csinl.c | 3 - 43 files changed, 872 insertions(+), 2268 deletions(-) create mode 100644 math/b_casin.c create mode 100644 math/b_casinh.c create mode 100644 math/b_csin.c create mode 100644 math/b_csinh.c create mode 100644 math/b_k_casinh.c delete mode 100644 math/k_casinh.c delete mode 100644 math/k_casinhf.c delete mode 100644 math/k_casinhl.c delete mode 100644 math/s_casin.c delete mode 100644 math/s_casinf.c delete mode 100644 math/s_casinh.c delete mode 100644 math/s_casinhf.c delete mode 100644 math/s_casinhl.c delete mode 100644 math/s_casinl.c delete mode 100644 math/s_csin.c delete mode 100644 math/s_csinf.c delete mode 100644 math/s_csinh.c delete mode 100644 math/s_csinhf.c delete mode 100644 math/s_csinhl.c delete mode 100644 math/s_csinl.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_casin.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_casinh.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_casinhl.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_casinl.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_csin.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_csinh.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_csinhl.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_csinl.c create mode 100644 sysdeps/m68k/m680x0/fpu/b_csin.c create mode 100644 sysdeps/m68k/m680x0/fpu/b_csinh.c delete mode 100644 sysdeps/m68k/m680x0/fpu/s_csin.c delete mode 100644 sysdeps/m68k/m680x0/fpu/s_csinf.c delete mode 100644 sysdeps/m68k/m680x0/fpu/s_csinh.c delete mode 100644 sysdeps/m68k/m680x0/fpu/s_csinhf.c delete mode 100644 sysdeps/m68k/m680x0/fpu/s_csinhl.c delete mode 100644 sysdeps/m68k/m680x0/fpu/s_csinl.c diff --git a/math/Makefile b/math/Makefile index b621996..ac91a84 100644 --- a/math/Makefile +++ b/math/Makefile @@ -54,7 +54,8 @@ libm-support = s_lib_version s_matherr s_signgam \ # not use the default version. If declared, it is assumed the target # will match the name s_ 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_cacosh_F g_ccos_F g_ccosh_F g_casin_F g_csin_F g_casinh_F \ + g_k_casinh_F g_csinh_F libm-calls = \ e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \ @@ -72,11 +73,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/b_casin.c b/math/b_casin.c new file mode 100644 index 0000000..a03f414 --- /dev/null +++ b/math/b_casin.c @@ -0,0 +1,67 @@ +/* Return arc sine of complex float type. + Copyright (C) 1997-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 + . */ + +#include +#include +#include + + +CFLOAT +M_DECL_FUNC (__casin) (CFLOAT x) +{ + CFLOAT 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 = M_NAN; + __imag__ res = M_COPYSIGN (M_HUGE_VAL, __imag__ x); + } + else + { + __real__ res = M_NAN; + __imag__ res = M_NAN; + } + } + else + { + CFLOAT y; + + __real__ y = -__imag__ x; + __imag__ y = __real__ x; + + y = M_FUNC (__casinh) (y); + + __real__ res = __imag__ y; + __imag__ res = -__real__ y; + } + + return res; +} + +declare_mgen_alias (__casin, casin) + +#if M_LIBM_NEED_COMPAT (casin) + declare_mgen_libm_compat (__casin, casin) +#endif diff --git a/math/b_casinh.c b/math/b_casinh.c new file mode 100644 index 0000000..3863147 --- /dev/null +++ b/math/b_casinh.c @@ -0,0 +1,76 @@ +/* Return arc hyperbole sine 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 , 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 + . */ + +#include +#include +#include + +CFLOAT +M_DECL_FUNC (__casinh) (CFLOAT x) +{ + CFLOAT res; + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + if (rcls <= FP_INFINITE || icls <= FP_INFINITE) + { + if (icls == FP_INFINITE) + { + __real__ res = M_COPYSIGN (M_HUGE_VAL, __real__ x); + + if (rcls == FP_NAN) + __imag__ res = M_NAN; + else + __imag__ res = M_COPYSIGN (rcls >= FP_ZERO + ? M_MLIT (M_PI_2) + : M_MLIT (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 = M_COPYSIGN (0.0, __imag__ x); + else + __imag__ res = M_NAN; + } + else + { + __real__ res = M_NAN; + __imag__ res = M_NAN; + } + } + else if (rcls == FP_ZERO && icls == FP_ZERO) + { + res = x; + } + else + { + res = M_FUNC (__kernel_casinh) (x, 0); + } + + return res; +} + +declare_mgen_alias (__casinh, casinh) + +#if M_LIBM_NEED_COMPAT (casinh) + declare_mgen_libm_compat (__casinh, casinh) +#endif diff --git a/math/b_csin.c b/math/b_csin.c new file mode 100644 index 0000000..d8387fd --- /dev/null +++ b/math/b_csin.c @@ -0,0 +1,172 @@ +/* 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 , 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 + . */ + +#include +#include +#include +#include +#include + +CFLOAT +M_DECL_FUNC (__csin) (CFLOAT x) +{ + CFLOAT retval; + int negate = signbit (__real__ x); + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + __real__ x = M_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) ((M_MAX_EXP - 1) * M_MLIT (M_LN2)); + FLOAT sinix, cosix; + + if (__glibc_likely (__real__ x > M_MIN)) + { + M_SINCOS (__real__ x, &sinix, &cosix); + } + else + { + sinix = __real__ x; + cosix = 1.0; + } + + if (negate) + sinix = -sinix; + + if (M_FABS (__imag__ x) > t) + { + FLOAT exp_t = M_EXP (t); + FLOAT ix = M_FABS (__imag__ x); + if (signbit (__imag__ x)) + cosix = -cosix; + ix -= t; + sinix *= exp_t / M_LIT (2.0); + cosix *= exp_t / M_LIT (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 = M_MAX * sinix; + __imag__ retval = M_MAX * cosix; + } + else + { + FLOAT exp_val = M_EXP (ix); + __real__ retval = exp_val * sinix; + __imag__ retval = exp_val * cosix; + } + } + else + { + __real__ retval = M_COSH (__imag__ x) * sinix; + __imag__ retval = M_SINH (__imag__ x) * cosix; + } + + math_check_force_underflow_complex (retval); + } + else + { + if (icls == FP_ZERO) + { + /* Imaginary part is 0.0. */ + __real__ retval = M_NAN; + __imag__ retval = __imag__ x; + + if (rcls == FP_INFINITE) + feraiseexcept (FE_INVALID); + } + else + { + __real__ retval = M_NAN; + __imag__ retval = M_NAN; + + feraiseexcept (FE_INVALID); + } + } + } + else if (icls == FP_INFINITE) + { + /* Imaginary part is infinite. */ + if (rcls == FP_ZERO) + { + /* Real part is 0.0. */ + __real__ retval = M_COPYSIGN (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 > M_MIN)) + { + M_SINCOS (__real__ x, &sinix, &cosix); + } + else + { + sinix = __real__ x; + cosix = 1.0; + } + + __real__ retval = M_COPYSIGN (M_HUGE_VAL, sinix); + __imag__ retval = M_COPYSIGN (M_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 = M_NAN; + __imag__ retval = M_HUGE_VAL; + + if (rcls == FP_INFINITE) + feraiseexcept (FE_INVALID); + } + } + else + { + if (rcls == FP_ZERO) + __real__ retval = M_COPYSIGN (0.0, negate ? -1.0 : 1.0); + else + __real__ retval = M_NAN; + __imag__ retval = M_NAN; + } + + return retval; +} + +declare_mgen_alias (__csin, csin) + +#if M_LIBM_NEED_COMPAT (csin) + declare_mgen_libm_compat (__csin, csin) +#endif diff --git a/math/b_csinh.c b/math/b_csinh.c new file mode 100644 index 0000000..4837e48 --- /dev/null +++ b/math/b_csinh.c @@ -0,0 +1,173 @@ +/* Complex sine hyperbole function for complex float type. + Copyright (C) 1997-2016 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , 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 + . */ + +#include +#include +#include +#include +#include + +CFLOAT +M_DECL_FUNC (__csinh) (CFLOAT x) +{ + CFLOAT retval; + int negate = signbit (__real__ x); + int rcls = fpclassify (__real__ x); + int icls = fpclassify (__imag__ x); + + __real__ x = M_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) ((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 = 1.0; + } + + if (negate) + cosix = -cosix; + + if (M_FABS (__real__ x) > t) + { + FLOAT exp_t = M_EXP (t); + FLOAT rx = M_FABS (__real__ x); + if (signbit (__real__ x)) + cosix = -cosix; + rx -= t; + sinix *= exp_t / M_LIT (2.0); + cosix *= exp_t / M_LIT (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 = M_MAX * cosix; + __imag__ retval = M_MAX * sinix; + } + else + { + FLOAT exp_val = M_EXP (rx); + __real__ retval = exp_val * cosix; + __imag__ retval = exp_val * sinix; + } + } + else + { + __real__ retval = M_SINH (__real__ x) * cosix; + __imag__ retval = M_COSH (__real__ x) * sinix; + } + + math_check_force_underflow_complex (retval); + } + else + { + if (rcls == FP_ZERO) + { + /* Real part is 0.0. */ + __real__ retval = M_COPYSIGN (0.0, negate ? -1.0 : 1.0); + __imag__ retval = M_NAN + M_NAN; + + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); + } + else + { + __real__ retval = M_NAN; + __imag__ retval = M_NAN; + + feraiseexcept (FE_INVALID); + } + } + } +#if M_TYPE == M_DOUBLE + else if (rcls == FP_INFINITE) +#else + else if (__glibc_likely (rcls == FP_INFINITE)) +#endif + { + /* Real part is infinite. */ + if (__glibc_likely (icls > FP_ZERO)) + { + /* Imaginary part is finite. */ + FLOAT sinix, cosix; + + if (__glibc_likely (M_FABS (__imag__ x) > M_MIN)) + { + M_SINCOS (__imag__ x, &sinix, &cosix); + } + else + { + sinix = __imag__ x; + cosix = 1.0; + } + + __real__ retval = M_COPYSIGN (M_HUGE_VAL, cosix); + __imag__ retval = M_COPYSIGN (M_HUGE_VAL, sinix); + + if (negate) + __real__ retval = -__real__ retval; + } + else if (icls == FP_ZERO) + { + /* Imaginary part is 0.0. */ + __real__ retval = negate ? -M_HUGE_VAL : M_HUGE_VAL; + __imag__ retval = __imag__ x; + } + else + { + /* The addition raises the invalid exception. */ + __real__ retval = M_HUGE_VAL; + __imag__ retval = M_NAN + M_NAN; + +#if M_TYPE != M_FLOAT || defined (FE_INVALID) + if (icls == FP_INFINITE) + feraiseexcept (FE_INVALID); +#endif + } + } + else + { + __real__ retval = M_NAN; + __imag__ retval = __imag__ x == 0.0 ? __imag__ x : M_NAN; + } + + return retval; +} + +declare_mgen_alias (__csinh, csinh) + +#if M_LIBM_NEED_COMPAT (csinh) + declare_mgen_libm_compat (__csinh, csinh) +#endif diff --git a/math/b_k_casinh.c b/math/b_k_casinh.c new file mode 100644 index 0000000..51b57a4 --- /dev/null +++ b/math/b_k_casinh.c @@ -0,0 +1,213 @@ +/* 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 + . */ + +#include +#include +#include +#include + +/* 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. */ + +CFLOAT +M_DECL_FUNC (__kernel_casinh) (CFLOAT x, int adj) +{ + CFLOAT res; + FLOAT rx, ix; + CFLOAT y; + + /* Avoid cancellation by reducing to the first quadrant. */ + rx = M_FABS (__real__ x); + ix = M_FABS (__imag__ x); + + if (rx >= M_LIT (1.0) / M_EPSILON || ix >= M_LIT (1.0) / M_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 = M_COPYSIGN (__imag__ y, __imag__ x); + __imag__ y = t; + } + + res = M_FUNC (__clog) (y); + __real__ res += (FLOAT) M_MLIT (M_LN2); + } + else if (rx >= M_LIT (0.5) && ix < M_EPSILON / M_LIT (8.0)) + { + FLOAT s = M_HYPOT (1.0, rx); + + __real__ res = M_LOG (rx + s); + if (adj) + __imag__ res = M_ATAN2 (s, __imag__ x); + else + __imag__ res = M_ATAN2 (ix, s); + } + else if (rx < M_EPSILON / M_LIT (8.0) && ix >= M_LIT (1.5)) + { + FLOAT s = M_SQRT ((ix + M_LIT (1.0)) * (ix - M_LIT (1.0))); + + __real__ res = M_LOG (ix + s); + if (adj) + __imag__ res = M_ATAN2 + (rx, M_COPYSIGN (s, __imag__ x)); + else + __imag__ res = M_ATAN2 (s, rx); + } + else if (ix > M_LIT (1.0) && ix < M_LIT (1.5) && rx < M_LIT (0.5)) + { + if (rx < M_EPSILON * M_EPSILON) + { + FLOAT ix2m1 = (ix + M_LIT (1.0)) * (ix - M_LIT (1.0)); + FLOAT s = M_SQRT (ix2m1); + + __real__ res = M_LOG1P (2.0 * (ix2m1 + ix * s)) / M_LIT (2.0); + if (adj) + __imag__ res = M_ATAN2 + (rx, M_COPYSIGN (s, __imag__ x)); + else + __imag__ res = M_ATAN2 (s, rx); + } + else + { + FLOAT ix2m1 = (ix + M_LIT (1.0)) * (ix - M_LIT (1.0)); + FLOAT rx2 = rx * rx; + FLOAT f = rx2 * (M_LIT (2.0) + rx2 + M_LIT (2.0) * ix * ix); + FLOAT d = M_SQRT (ix2m1 * ix2m1 + f); + FLOAT dp = d + ix2m1; + FLOAT dm = f / dp; + FLOAT r1 = M_SQRT ((dm + rx2) / M_LIT (2.0)); + FLOAT r2 = rx * ix / r1; + + __real__ res = M_LOG1P + (rx2 + dp + M_LIT (2.0) * (rx * r1 + ix * r2)) / M_LIT (2.0); + if (adj) + __imag__ res = M_ATAN2 + (rx + r1, M_COPYSIGN (ix + r2, __imag__ x)); + else + __imag__ res = M_ATAN2 (ix + r2, rx + r1); + } + } + else if (ix == M_LIT (1.0) && rx < M_LIT (0.5)) + { + if (rx < M_EPSILON / M_LIT (8.0)) + { + __real__ res = M_LOG1P + (M_LIT (2.0) * (rx + M_SQRT (rx))) / M_LIT (2.0); + if (adj) + __imag__ res = M_ATAN2 (M_SQRT (rx), M_COPYSIGN (1.0, __imag__ x)); + else + __imag__ res = M_ATAN2 (1.0, M_SQRT (rx)); + } + else + { + FLOAT d = rx * M_SQRT (M_LIT (4.0) + rx * rx); + FLOAT s1 = M_SQRT ((d + rx * rx) / M_LIT (2.0)); + FLOAT s2 = M_SQRT ((d - rx * rx) / M_LIT (2.0)); + + __real__ res = M_LOG1P (rx * rx + d + M_LIT (2.0) * (rx * s1 + s2)) + / M_LIT (2.0); + if (adj) + __imag__ res = M_ATAN2 (rx + s1, M_COPYSIGN (M_LIT (1.0) + s2, + __imag__ x)); + else + __imag__ res = M_ATAN2 (M_LIT (1.0) + s2, rx + s1); + } + } + else if (ix < M_LIT (1.0) && rx < M_LIT (0.5)) + { + if (ix >= M_EPSILON) + { + if (rx < M_EPSILON * M_EPSILON) + { + FLOAT onemix2 = (M_LIT (1.0) + ix) * (M_LIT (1.0) - ix); + FLOAT s = M_SQRT (onemix2); + + __real__ res = M_LOG1P (M_LIT (2.0) * rx / s) / M_LIT (2.0); + if (adj) + __imag__ res = M_ATAN2 (s, __imag__ x); + else + __imag__ res = M_ATAN2 (ix, s); + } + else + { + FLOAT onemix2 = (M_LIT (1.0) + ix) * (M_LIT (1.0) - ix); + FLOAT rx2 = rx * rx; + FLOAT f = rx2 * (M_LIT (2.0) + rx2 + M_LIT (2.0) * ix * ix); + FLOAT d = M_SQRT (onemix2 * onemix2 + f); + FLOAT dp = d + onemix2; + FLOAT dm = f / dp; + FLOAT r1 = M_SQRT ((dp + rx2) / M_LIT (2.0)); + FLOAT r2 = rx * ix / r1; + + __real__ res = M_LOG1P (rx2 + dm + M_LIT (2.0) + * (rx * r1 + ix * r2)) / M_LIT (2.0); + if (adj) + __imag__ res = M_ATAN2 (rx + r1, M_COPYSIGN (ix + r2, + __imag__ x)); + else + __imag__ res = M_ATAN2 (ix + r2, rx + r1); + } + } + else + { + FLOAT s = M_HYPOT (1.0, rx); + + __real__ res = M_LOG1P (M_LIT (2.0) * rx * (rx + s)) / M_LIT (2.0); + if (adj) + __imag__ res = M_ATAN2 (s, __imag__ x); + else + __imag__ res = M_ATAN2 (ix, s); + } + math_check_force_underflow_nonneg (__real__ res); + } + else + { + __real__ y = (rx - ix) * (rx + ix) + M_LIT (1.0); + __imag__ y = M_LIT (2.0) * rx * ix; + + y = M_FUNC (__csqrt) (y); + + __real__ y += rx; + __imag__ y += ix; + + if (adj) + { + FLOAT t = __real__ y; + __real__ y = M_COPYSIGN (__imag__ y, __imag__ x); + __imag__ y = t; + } + + res = M_FUNC (__clog) (y); + } + + /* Give results the correct sign for the original argument. */ + __real__ res = M_COPYSIGN (__real__ res, __real__ x); + __imag__ res = M_COPYSIGN (__imag__ res, (adj ? 1.0 : __imag__ x)); + + return res; +} 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 - . */ - -#include -#include -#include -#include - -/* 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_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 - . */ - -#include -#include -#include -#include - -/* 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 - . */ - -#include -#include -#include -#include - -/* 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 , 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 - . */ - -#include -#include -#include - - -__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_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 , 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 - . */ - -#include -#include -#include - - -__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 , 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 - . */ - -#include -#include -#include - -__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_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 , 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 - . */ - -#include -#include -#include - -__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 , 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 - . */ - -#include -#include -#include - -__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 , 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 - . */ - -#include -#include -#include - - -__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 , 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 - . */ - -#include -#include -#include -#include -#include - -__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_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 , 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 - . */ - -#include -#include -#include -#include -#include - -__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 , 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 - . */ - -#include -#include -#include -#include -#include - -__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_csinhf.c b/math/s_csinhf.c deleted file mode 100644 index a0458cf..0000000 --- a/math/s_csinhf.c +++ /dev/null @@ -1,166 +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 , 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 - . */ - -#include -#include -#include -#include -#include - -__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 (__glibc_likely (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 (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - 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 d7f03fa..0000000 --- a/math/s_csinhl.c +++ /dev/null @@ -1,164 +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 , 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 - . */ - -#include -#include -#include -#include -#include - -__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 (__glibc_likely (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 (""); - -#ifdef FE_INVALID - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); -#endif - } - } - 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 , 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 - . */ - -#include -#include -#include -#include -#include - -__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/Makefile b/sysdeps/alpha/fpu/Makefile index ddd86ba..3ae1451 100644 --- a/sysdeps/alpha/fpu/Makefile +++ b/sysdeps/alpha/fpu/Makefile @@ -1,6 +1,8 @@ # Inhibit generation of these math files as they are supplied via # 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_cacos_f g_cacosh_f g_ccos_f g_ccosh_f g_casin_f g_csin_f \ + g_casinh_f g_csinh_f libm-gen-replacement-calls = cabsf cargf cimagf crealf conjf \ - s_cacosf s_cacoshf s_ccosf s_ccoshf + s_cacosf s_cacoshf s_ccosf s_ccoshf s_casinf s_csinf \ + s_casinhf s_csinhf diff --git a/sysdeps/alpha/fpu/s_casinf.c b/sysdeps/alpha/fpu/s_casinf.c index f85f524..396c0a1 100644 --- a/sysdeps/alpha/fpu/s_casinf.c +++ b/sysdeps/alpha/fpu/s_casinf.c @@ -24,14 +24,19 @@ #undef __casinf #undef casinf -#define __casinf internal_casinf static _Complex float internal_casinf (_Complex float x); -#include -#include "cfloat-compat.h" +#define M_DECL_FUNC(f) internal_casinf +#define M_TYPE M_FLOAT +#include -#undef __casinf +/* Disable any aliasing from base template. */ +#undef declare_mgen_alias +#define declare_mgen_alias(__to, __from) + +#include +#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..045fcb4 100644 --- a/sysdeps/alpha/fpu/s_casinhf.c +++ b/sysdeps/alpha/fpu/s_casinhf.c @@ -24,14 +24,19 @@ #undef __casinhf #undef casinhf -#define __casinhf internal_casinhf static _Complex float internal_casinhf (_Complex float x); -#include -#include "cfloat-compat.h" +#define M_DECL_FUNC(f) internal_casinhf +#define M_TYPE M_FLOAT +#include -#undef __casinhf +/* Disable any aliasing from base template. */ +#undef declare_mgen_alias +#define declare_mgen_alias(__to, __from) + +#include +#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..d836db8 100644 --- a/sysdeps/alpha/fpu/s_csinf.c +++ b/sysdeps/alpha/fpu/s_csinf.c @@ -24,14 +24,19 @@ #undef __csinf #undef csinf -#define __csinf internal_csinf static _Complex float internal_csinf (_Complex float x); -#include -#include "cfloat-compat.h" +#define M_DECL_FUNC(f) internal_csinf +#define M_TYPE M_FLOAT +#include -#undef __csinf +/* Disable any aliasing from base template. */ +#undef declare_mgen_alias +#define declare_mgen_alias(__to, __from) + +#include +#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..d845ad9 100644 --- a/sysdeps/alpha/fpu/s_csinhf.c +++ b/sysdeps/alpha/fpu/s_csinhf.c @@ -24,14 +24,19 @@ #undef __csinhf #undef csinhf -#define __csinhf internal_csinhf static _Complex float internal_csinhf (_Complex float x); -#include -#include "cfloat-compat.h" +#define M_DECL_FUNC(f) internal_csinhf +#define M_TYPE M_FLOAT +#include -#undef __csinhf +/* Disable any aliasing from base template. */ +#undef declare_mgen_alias +#define declare_mgen_alias(__to, __from) + +#include +#include "cfloat-compat.h" c1_cfloat_rettype __c1_csinhf (c1_cfloat_decl (x)) diff --git a/sysdeps/ieee754/ldbl-opt/math-type-macros.h b/sysdeps/ieee754/ldbl-opt/math-type-macros.h index 3e3b9f7..061ba33 100644 --- a/sysdeps/ieee754/ldbl-opt/math-type-macros.h +++ b/sysdeps/ieee754/ldbl-opt/math-type-macros.h @@ -11,5 +11,9 @@ #define LDOUBLE_cacoshl_libm_version GLIBC_2_1 #define LDOUBLE_ccosl_libm_version GLIBC_2_1 #define LDOUBLE_ccoshl_libm_version GLIBC_2_1 +#define LDOUBLE_casinl_libm_version GLIBC_2_1 +#define LDOUBLE_csinl_libm_version GLIBC_2_1 +#define LDOUBLE_casinhl_libm_version GLIBC_2_1 +#define LDOUBLE_csinhl_libm_version GLIBC_2_1 #include_next 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 -#include -#include -#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 -#include -#include -#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 -#include -#undef weak_alias -#define weak_alias(n,a) -#include -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 -#include -#undef weak_alias -#define weak_alias(n,a) -#include -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 -#include -#include -#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 -#include -#include -#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 -#include -#undef weak_alias -#define weak_alias(n,a) -#include -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 -#include -#undef weak_alias -#define weak_alias(n,a) -#include -long_double_symbol (libm, __csinl, csinl); diff --git a/sysdeps/m68k/m680x0/fpu/b_csin.c b/sysdeps/m68k/m680x0/fpu/b_csin.c new file mode 100644 index 0000000..42499f6 --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/b_csin.c @@ -0,0 +1,59 @@ +/* Complex sine 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 . + + 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 + . */ + +#include +#include +#include "mathimpl.h" + +#define s(name) M_FUNC (name) +#define m81(func) __m81_u(s(func)) + +CFLOAT +s(__csin) (CFLOAT x) +{ + 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 sin_rx, cos_rx; + + __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_rx), "=f" (cos_rx) + : "f" (__real__ x)); + if (rx_cond & __M81_COND_ZERO) + __real__ retval = __real__ x; + else + __real__ retval = sin_rx * m81(__ieee754_cosh) (__imag__ x); + __imag__ retval = cos_rx * m81(__ieee754_sinh) (__imag__ x); + } + else + { + unsigned long ix_cond = __m81_test (__imag__ x); + + __real__ retval = __real__ x - __real__ x; + if (ix_cond & (__M81_COND_ZERO|__M81_COND_INF|__M81_COND_NAN)) + __imag__ retval = __imag__ x; + else + __imag__ retval = __real__ retval; + } + + return retval; +} +weak_alias (s(__csin), s(csin)) diff --git a/sysdeps/m68k/m680x0/fpu/b_csinh.c b/sysdeps/m68k/m680x0/fpu/b_csinh.c new file mode 100644 index 0000000..1903882 --- /dev/null +++ b/sysdeps/m68k/m680x0/fpu/b_csinh.c @@ -0,0 +1,62 @@ +/* Complex sine hyperbole 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 . + + 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 + . */ + +#include +#include +#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(__csinh) (CFLOAT x) +{ + CFLOAT retval; + unsigned long ix_cond; + + ix_cond = __m81_test (__imag__ x); + + if ((ix_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0) + { + /* Imaginary part is finite. */ + FLOAT sin_ix, cos_ix; + + __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix) + : "f" (__imag__ x)); + __real__ retval = cos_ix * m81(__ieee754_sinh) (__real__ x); + if (ix_cond & __M81_COND_ZERO) + __imag__ retval = __imag__ x; + else + __imag__ retval = sin_ix * m81(__ieee754_cosh) (__real__ x); + } + else + { + unsigned long rx_cond = __m81_test (__real__ x); + + __imag__ retval = __imag__ x - __imag__ x; + if (rx_cond & (__M81_COND_ZERO|__M81_COND_INF|__M81_COND_NAN)) + __real__ retval = __real__ x; + else + __real__ retval = __imag__ retval; + } + + return retval; +} +weak_alias (s(__csinh), s(csinh)) diff --git a/sysdeps/m68k/m680x0/fpu/s_csin.c b/sysdeps/m68k/m680x0/fpu/s_csin.c deleted file mode 100644 index b8419be..0000000 --- a/sysdeps/m68k/m680x0/fpu/s_csin.c +++ /dev/null @@ -1,67 +0,0 @@ -/* Complex sine 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 . - - 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 - . */ - -#include -#include -#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(__csin) (__complex__ float_type x) -{ - __complex__ float_type 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; - - __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_rx), "=f" (cos_rx) - : "f" (__real__ x)); - if (rx_cond & __M81_COND_ZERO) - __real__ retval = __real__ x; - else - __real__ retval = sin_rx * m81(__ieee754_cosh) (__imag__ x); - __imag__ retval = cos_rx * m81(__ieee754_sinh) (__imag__ x); - } - else - { - unsigned long ix_cond = __m81_test (__imag__ x); - - __real__ retval = __real__ x - __real__ x; - if (ix_cond & (__M81_COND_ZERO|__M81_COND_INF|__M81_COND_NAN)) - __imag__ retval = __imag__ x; - else - __imag__ retval = __real__ retval; - } - - return retval; -} -weak_alias (s(__csin), s(csin)) 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 diff --git a/sysdeps/m68k/m680x0/fpu/s_csinh.c b/sysdeps/m68k/m680x0/fpu/s_csinh.c deleted file mode 100644 index c633cd8..0000000 --- a/sysdeps/m68k/m680x0/fpu/s_csinh.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Complex sine hyperbole 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 . - - 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 - . */ - -#include -#include -#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(__csinh) (__complex__ float_type x) -{ - __complex__ float_type retval; - unsigned long ix_cond; - - ix_cond = __m81_test (__imag__ x); - - if ((ix_cond & (__M81_COND_INF|__M81_COND_NAN)) == 0) - { - /* Imaginary part is finite. */ - float_type sin_ix, cos_ix; - - __asm ("fsincos%.x %2,%1:%0" : "=f" (sin_ix), "=f" (cos_ix) - : "f" (__imag__ x)); - __real__ retval = cos_ix * m81(__ieee754_sinh) (__real__ x); - if (ix_cond & __M81_COND_ZERO) - __imag__ retval = __imag__ x; - else - __imag__ retval = sin_ix * m81(__ieee754_cosh) (__real__ x); - } - else - { - unsigned long rx_cond = __m81_test (__real__ x); - - __imag__ retval = __imag__ x - __imag__ x; - if (rx_cond & (__M81_COND_ZERO|__M81_COND_INF|__M81_COND_NAN)) - __real__ retval = __real__ x; - else - __real__ retval = __imag__ retval; - } - - return retval; -} -weak_alias (s(__csinh), s(csinh)) 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 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 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