From patchwork Wed Aug 17 21:02:28 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: 660263 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sF1tl14v8z9t1T for ; Thu, 18 Aug 2016 07:04:14 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=LZ95rjEK; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:in-reply-to:references :in-reply-to:references:message-id; q=dns; s=default; b=tycK5Xjj eQ1p6FadJ2i46anblLyJSCpfsxCHJuZWJNQYhgi4OSgLkwaZz6qJnD3yOD08xPJo kT8NoIQXHTfCp0aJNo9LREZ2xE4X71Ac7XDkBaOJgVhUUZQ4+yEpVbeEFh1ou0Zo 7Gm0GOkDy+4OnIDGpRqYzc+SqPWNYs7YTBs= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:in-reply-to:references :in-reply-to:references:message-id; s=default; bh=3Gxgo0e/7Rvq6X gmtaeMzCTonFk=; b=LZ95rjEK6JvZ+4qJR6Y9mPRyKyyk0MEHxwTFuY1ZxdVDSJ M84kDNJlVOU2W53VwW51gr3+v3d9TGwNnp+XNZCejWGxNEsBrIuaH7+iCCF2pd8w YinJ9zXbvOWNurhGE7f4u2aNC5ws5YVjZ690zbN017E1FlnWvUNb5tiDo/PVc= Received: (qmail 17967 invoked by alias); 17 Aug 2016 21:03:05 -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 17840 invoked by uid 89); 17 Aug 2016 21:03:04 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=1.9 required=5.0 tests=AWL, BAYES_50, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, KAM_LOTSOFHASH, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=2223, cancellation, stephen, Stephen 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: [PATCHv3 8/8] Convert remaining complex function to generated files Date: Wed, 17 Aug 2016 16:02:28 -0500 In-Reply-To: References: In-Reply-To: References: X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16081721-0012-0000-0000-0000106C7FE9 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005609; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000181; SDB=6.00746075; UDB=6.00351700; IPR=6.00518618; BA=6.00004664; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012370; XFM=3.00000011; UTC=2016-08-17 21:02:42 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16081721-0013-0000-0000-000044A38DCB Message-Id: <1b66d5f7536be148e4c34235ab1967e4107251e8.1471467042.git.murphyp@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-08-17_12:, , 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-1608170231 Convert cpow, clog, clog10, cexp, csqrt, and cproj functions into generated templates. Note, ldbl-opt still retains s_clog10l.c as the aliasing rules are non-trivial. * math/Makefile (libm-gen-calls): Add cpow, clog, clog10, cexp, cproj. (libm-calls): Remove the above. * math/s_cexp_template.c: Update using type-generic macros. * math/s_clog10_template.c: Likewise. * math/s_cpow_template.c: Likewise. * math/s_clog_template.c: Likewise. * math/s_cproj_template.c: Likewise. * math/s_csqrt_template.c: Likewise. * math/s_cexp.c: Removed. * math/s_cexpf.c: Removed. * math/s_cexpl.c: Removed. * math/s_clog10.c: Removed. * math/s_clog10f.c: Removed. * math/s_clog10l.c: Removed. * math/s_cpow.c: Removed. * math/s_cpowf.c: Removed. * math/s_cpowl.c: Removed. * math/s_clog.c: Removed. * math/s_clogf.c: Removed. * math/s_clogl.c: Removed. * math/s_cproj.c: Removed. * math/s_cprojf.c: Removed. * math/s_cprojl.c: Removed. * math/s_csqrt.c: Removed. * math/s_csqrtf.c: Removed. * math/s_csqrtl.c: Removed. * sysdeps/alpha/fpu/s_cexpf.c: Update using templated version. * sysdeps/alpha/fpu/s_clog10f.c: Update using templated version. * sysdeps/alpha/fpu/s_clogf.c: Update using templated version. * sysdeps/alpha/fpu/s_cpowf.c: Update using templated version. * sysdeps/alpha/fpu/s_cprojf.c: Update using templated version. * sysdeps/alpha/fpu/s_csqrtf.c: Update using templated version. * sysdeps/ieee754/ldbl-opt/s_cexp.c: Removed. * sysdeps/ieee754/ldbl-opt/s_cexpl.c: Removed. * sysdeps/ieee754/ldbl-opt/s_clog.c: Removed. * sysdeps/ieee754/ldbl-opt/s_clog10.c: Removed. * sysdeps/ieee754/ldbl-opt/s_clog10l.c: Removed. * sysdeps/ieee754/ldbl-opt/s_cpow.c: Removed. * sysdeps/ieee754/ldbl-opt/s_cpowl.c: Removed. * sysdeps/ieee754/ldbl-opt/s_cproj.c: Removed. * sysdeps/ieee754/ldbl-opt/s_cprojl.c: Removed. * sysdeps/ieee754/ldbl-opt/s_csqrt.c: Removed. * sysdeps/ieee754/ldbl-opt/s_csqrtl.c: Removed. * sysdeps/ieee754/ldbl-opt/s_clogl.c: Update using templated version. * sysdeps/m68k/m680x0/fpu/s_cexp.c: Refactor into. * sysdeps/m68k/m680x0/fpu/s_cexp_template.c: New file. * sysdeps/m68k/m680x0/fpu/s_cexpf.c: Removed. * sysdeps/m68k/m680x0/fpu/s_cexpl.c: Removed. --- math/Makefile | 5 +- math/s_cexp.c | 157 -------------------- math/s_cexp_template.c | 64 ++++---- math/s_cexpf.c | 155 ------------------- math/s_cexpl.c | 153 ------------------- math/s_clog.c | 118 --------------- math/s_clog10.c | 124 ---------------- math/s_clog10_template.c | 90 +++++------ math/s_clog10f.c | 122 --------------- math/s_clog10l.c | 127 ---------------- math/s_clog_template.c | 83 ++++++----- math/s_clogf.c | 116 --------------- math/s_clogl.c | 121 --------------- math/s_cpow.c | 33 ----- math/s_cpow_template.c | 18 +-- math/s_cpowf.c | 31 ---- math/s_cpowl.c | 29 ---- math/s_cproj.c | 44 ------ math/s_cproj_template.c | 19 +-- math/s_cprojf.c | 42 ------ math/s_cprojl.c | 40 ----- math/s_csqrt.c | 165 --------------------- math/s_csqrt_template.c | 105 +++++++------ math/s_csqrtf.c | 163 -------------------- math/s_csqrtl.c | 161 -------------------- sysdeps/alpha/fpu/s_cexpf.c | 12 +- sysdeps/alpha/fpu/s_clog10f.c | 12 +- sysdeps/alpha/fpu/s_clogf.c | 12 +- sysdeps/alpha/fpu/s_cpowf.c | 12 +- sysdeps/alpha/fpu/s_cprojf.c | 12 +- sysdeps/alpha/fpu/s_csqrtf.c | 12 +- sysdeps/ieee754/ldbl-opt/s_cexp.c | 6 - sysdeps/ieee754/ldbl-opt/s_cexpl.c | 6 - sysdeps/ieee754/ldbl-opt/s_clog.c | 6 - sysdeps/ieee754/ldbl-opt/s_clog10.c | 7 - sysdeps/ieee754/ldbl-opt/s_clog10l.c | 36 ++++- sysdeps/ieee754/ldbl-opt/s_clogl.c | 6 - sysdeps/ieee754/ldbl-opt/s_cpow.c | 6 - sysdeps/ieee754/ldbl-opt/s_cpowl.c | 6 - sysdeps/ieee754/ldbl-opt/s_cproj.c | 6 - sysdeps/ieee754/ldbl-opt/s_cprojl.c | 6 - sysdeps/ieee754/ldbl-opt/s_csqrt.c | 6 - sysdeps/ieee754/ldbl-opt/s_csqrtl.c | 6 - .../m680x0/fpu/{s_cexp.c => s_cexp_template.c} | 15 +- sysdeps/m68k/m680x0/fpu/s_cexpf.c | 3 - sysdeps/m68k/m680x0/fpu/s_cexpl.c | 3 - 46 files changed, 275 insertions(+), 2206 deletions(-) delete mode 100644 math/s_cexp.c delete mode 100644 math/s_cexpf.c delete mode 100644 math/s_cexpl.c delete mode 100644 math/s_clog.c delete mode 100644 math/s_clog10.c delete mode 100644 math/s_clog10f.c delete mode 100644 math/s_clog10l.c delete mode 100644 math/s_clogf.c delete mode 100644 math/s_clogl.c delete mode 100644 math/s_cpow.c delete mode 100644 math/s_cpowf.c delete mode 100644 math/s_cpowl.c delete mode 100644 math/s_cproj.c delete mode 100644 math/s_cprojf.c delete mode 100644 math/s_cprojl.c delete mode 100644 math/s_csqrt.c delete mode 100644 math/s_csqrtf.c delete mode 100644 math/s_csqrtl.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_cexp.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_cexpl.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_clog.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_clog10.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_clogl.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_cpow.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_cpowl.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_cproj.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_cprojl.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_csqrt.c delete mode 100644 sysdeps/ieee754/ldbl-opt/s_csqrtl.c rename sysdeps/m68k/m680x0/fpu/{s_cexp.c => s_cexp_template.c} (94%) delete mode 100644 sysdeps/m68k/m680x0/fpu/s_cexpf.c delete mode 100644 sysdeps/m68k/m680x0/fpu/s_cexpl.c diff --git a/math/Makefile b/math/Makefile index 03cbd1d..65a6ad8 100644 --- a/math/Makefile +++ b/math/Makefile @@ -48,7 +48,8 @@ libm-support = s_lib_version s_matherr s_signgam \ gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF \ s_cacoshF s_ccosF s_ccoshF s_casinF s_csinF s_casinhF \ k_casinhF s_csinhF k_casinhF s_csinhF s_catanhF s_catanF \ - s_ctanF s_ctanhF + s_ctanF s_ctanhF s_cexpF s_clogF s_cprojF s_csqrtF \ + s_cpowF s_clog10F \ libm-calls = \ e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \ @@ -66,8 +67,6 @@ libm-calls = \ w_ilogbF \ s_fpclassifyF s_fmaxF s_fminF s_fdimF s_nanF s_truncF \ s_remquoF e_log2F e_exp2F s_roundF s_nearbyintF s_sincosF \ - s_cexpF s_clogF \ - s_csqrtF s_cpowF s_cprojF s_clog10F \ s_fmaF s_lrintF s_llrintF s_lroundF s_llroundF e_exp10F w_log2F \ s_issignalingF $(calls:s_%=m_%) x2y2m1F \ gamma_productF lgamma_negF lgamma_productF \ diff --git a/math/s_cexp.c b/math/s_cexp.c deleted file mode 100644 index 3a476bd..0000000 --- a/math/s_cexp.c +++ /dev/null @@ -1,157 +0,0 @@ -/* Return value of complex exponential function for double complex value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -__cexp (__complex__ double x) -{ - __complex__ double retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (__glibc_likely (rcls >= FP_ZERO)) - { - /* Real part is finite. */ - if (__glibc_likely (icls >= FP_ZERO)) - { - /* Imaginary part is finite. */ - const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2); - double sinix, cosix; - - if (__glibc_likely (fabs (__imag__ x) > DBL_MIN)) - { - __sincos (__imag__ x, &sinix, &cosix); - } - else - { - sinix = __imag__ x; - cosix = 1.0; - } - - if (__real__ x > t) - { - double exp_t = __ieee754_exp (t); - __real__ x -= t; - sinix *= exp_t; - cosix *= exp_t; - if (__real__ x > t) - { - __real__ x -= t; - sinix *= exp_t; - cosix *= exp_t; - } - } - if (__real__ x > t) - { - /* Overflow (original real part of x > 3t). */ - __real__ retval = DBL_MAX * cosix; - __imag__ retval = DBL_MAX * sinix; - } - else - { - double exp_val = __ieee754_exp (__real__ x); - __real__ retval = exp_val * cosix; - __imag__ retval = exp_val * sinix; - } - math_check_force_underflow_complex (retval); - } - else - { - /* If the imaginary part is +-inf or NaN and the real part - is not +-inf the result is NaN + iNaN. */ - __real__ retval = __nan (""); - __imag__ retval = __nan (""); - - feraiseexcept (FE_INVALID); - } - } - else if (__glibc_likely (rcls == FP_INFINITE)) - { - /* Real part is infinite. */ - if (__glibc_likely (icls >= FP_ZERO)) - { - /* Imaginary part is finite. */ - double value = signbit (__real__ x) ? 0.0 : HUGE_VAL; - - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = value; - __imag__ retval = __imag__ x; - } - else - { - double sinix, cosix; - - if (__glibc_likely (fabs (__imag__ x) > DBL_MIN)) - { - __sincos (__imag__ x, &sinix, &cosix); - } - else - { - sinix = __imag__ x; - cosix = 1.0; - } - - __real__ retval = __copysign (value, cosix); - __imag__ retval = __copysign (value, sinix); - } - } - else if (signbit (__real__ x) == 0) - { - __real__ retval = HUGE_VAL; - __imag__ retval = __nan (""); - - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); - } - else - { - __real__ retval = 0.0; - __imag__ retval = __copysign (0.0, __imag__ x); - } - } - else - { - /* If the real part is NaN the result is NaN + iNaN unless the - imaginary part is zero. */ - __real__ retval = __nan (""); - if (icls == FP_ZERO) - __imag__ retval = __imag__ x; - else - { - __imag__ retval = __nan (""); - - if (rcls != FP_NAN || icls != FP_NAN) - feraiseexcept (FE_INVALID); - } - } - - return retval; -} -weak_alias (__cexp, cexp) -#ifdef NO_LONG_DOUBLE -strong_alias (__cexp, __cexpl) -weak_alias (__cexp, cexpl) -#endif diff --git a/math/s_cexp_template.c b/math/s_cexp_template.c index 3a476bd..a60afe0 100644 --- a/math/s_cexp_template.c +++ b/math/s_cexp_template.c @@ -1,4 +1,4 @@ -/* Return value of complex exponential function for double complex value. +/* Return value of complex exponential function for a float type. Copyright (C) 1997-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -23,10 +23,10 @@ #include #include -__complex__ double -__cexp (__complex__ double x) +CFLOAT +M_DECL_FUNC (__cexp) (CFLOAT x) { - __complex__ double retval; + CFLOAT retval; int rcls = fpclassify (__real__ x); int icls = fpclassify (__imag__ x); @@ -36,22 +36,22 @@ __cexp (__complex__ double x) if (__glibc_likely (icls >= FP_ZERO)) { /* Imaginary part is finite. */ - const int t = (int) ((DBL_MAX_EXP - 1) * M_LN2); - double sinix, cosix; + const int t = (int) ((M_MAX_EXP - 1) * M_MLIT (M_LN2)); + FLOAT sinix, cosix; - if (__glibc_likely (fabs (__imag__ x) > DBL_MIN)) + if (__glibc_likely (M_FABS (__imag__ x) > M_MIN)) { - __sincos (__imag__ x, &sinix, &cosix); + M_SINCOS (__imag__ x, &sinix, &cosix); } else { sinix = __imag__ x; - cosix = 1.0; + cosix = 1; } if (__real__ x > t) { - double exp_t = __ieee754_exp (t); + FLOAT exp_t = M_EXP (t); __real__ x -= t; sinix *= exp_t; cosix *= exp_t; @@ -65,12 +65,12 @@ __cexp (__complex__ double x) if (__real__ x > t) { /* Overflow (original real part of x > 3t). */ - __real__ retval = DBL_MAX * cosix; - __imag__ retval = DBL_MAX * sinix; + __real__ retval = M_MAX * cosix; + __imag__ retval = M_MAX * sinix; } else { - double exp_val = __ieee754_exp (__real__ x); + FLOAT exp_val = M_EXP (__real__ x); __real__ retval = exp_val * cosix; __imag__ retval = exp_val * sinix; } @@ -80,8 +80,8 @@ __cexp (__complex__ double x) { /* If the imaginary part is +-inf or NaN and the real part is not +-inf the result is NaN + iNaN. */ - __real__ retval = __nan (""); - __imag__ retval = __nan (""); + __real__ retval = M_NAN; + __imag__ retval = M_NAN; feraiseexcept (FE_INVALID); } @@ -92,7 +92,7 @@ __cexp (__complex__ double x) if (__glibc_likely (icls >= FP_ZERO)) { /* Imaginary part is finite. */ - double value = signbit (__real__ x) ? 0.0 : HUGE_VAL; + FLOAT value = signbit (__real__ x) ? 0 : M_HUGE_VAL; if (icls == FP_ZERO) { @@ -102,46 +102,46 @@ __cexp (__complex__ double x) } else { - double sinix, cosix; + FLOAT sinix, cosix; - if (__glibc_likely (fabs (__imag__ x) > DBL_MIN)) + if (__glibc_likely (M_FABS (__imag__ x) > M_MIN)) { - __sincos (__imag__ x, &sinix, &cosix); + M_SINCOS (__imag__ x, &sinix, &cosix); } else { sinix = __imag__ x; - cosix = 1.0; + cosix = 1; } - __real__ retval = __copysign (value, cosix); - __imag__ retval = __copysign (value, sinix); + __real__ retval = M_COPYSIGN (value, cosix); + __imag__ retval = M_COPYSIGN (value, sinix); } } else if (signbit (__real__ x) == 0) { - __real__ retval = HUGE_VAL; - __imag__ retval = __nan (""); + __real__ retval = M_HUGE_VAL; + __imag__ retval = M_NAN; if (icls == FP_INFINITE) feraiseexcept (FE_INVALID); } else { - __real__ retval = 0.0; - __imag__ retval = __copysign (0.0, __imag__ x); + __real__ retval = 0; + __imag__ retval = M_COPYSIGN (0, __imag__ x); } } else { /* If the real part is NaN the result is NaN + iNaN unless the imaginary part is zero. */ - __real__ retval = __nan (""); + __real__ retval = M_NAN; if (icls == FP_ZERO) __imag__ retval = __imag__ x; else { - __imag__ retval = __nan (""); + __imag__ retval = M_NAN; if (rcls != FP_NAN || icls != FP_NAN) feraiseexcept (FE_INVALID); @@ -150,8 +150,8 @@ __cexp (__complex__ double x) return retval; } -weak_alias (__cexp, cexp) -#ifdef NO_LONG_DOUBLE -strong_alias (__cexp, __cexpl) -weak_alias (__cexp, cexpl) +declare_mgen_alias (__cexp, cexp) + +#if M_LIBM_NEED_COMPAT (cexp) +declare_mgen_libm_compat (__cexp, cexp) #endif diff --git a/math/s_cexpf.c b/math/s_cexpf.c deleted file mode 100644 index 001fec2..0000000 --- a/math/s_cexpf.c +++ /dev/null @@ -1,155 +0,0 @@ -/* Return value of complex exponential function for float complex value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -__cexpf (__complex__ float x) -{ - __complex__ float retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (__glibc_likely (rcls >= FP_ZERO)) - { - /* Real part is finite. */ - if (__glibc_likely (icls >= FP_ZERO)) - { - /* Imaginary part is finite. */ - const int t = (int) ((FLT_MAX_EXP - 1) * M_LN2); - float sinix, cosix; - - if (__glibc_likely (fabsf (__imag__ x) > FLT_MIN)) - { - __sincosf (__imag__ x, &sinix, &cosix); - } - else - { - sinix = __imag__ x; - cosix = 1.0f; - } - - if (__real__ x > t) - { - float exp_t = __ieee754_expf (t); - __real__ x -= t; - sinix *= exp_t; - cosix *= exp_t; - if (__real__ x > t) - { - __real__ x -= t; - sinix *= exp_t; - cosix *= exp_t; - } - } - if (__real__ x > t) - { - /* Overflow (original real part of x > 3t). */ - __real__ retval = FLT_MAX * cosix; - __imag__ retval = FLT_MAX * sinix; - } - else - { - float exp_val = __ieee754_expf (__real__ x); - __real__ retval = exp_val * cosix; - __imag__ retval = exp_val * sinix; - } - math_check_force_underflow_complex (retval); - } - else - { - /* If the imaginary part is +-inf or NaN and the real part - is not +-inf the result is NaN + iNaN. */ - __real__ retval = __nanf (""); - __imag__ retval = __nanf (""); - - feraiseexcept (FE_INVALID); - } - } - else if (__glibc_likely (rcls == FP_INFINITE)) - { - /* Real part is infinite. */ - if (__glibc_likely (icls >= FP_ZERO)) - { - /* Imaginary part is finite. */ - float value = signbit (__real__ x) ? 0.0 : HUGE_VALF; - - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = value; - __imag__ retval = __imag__ x; - } - else - { - float sinix, cosix; - - if (__glibc_likely (fabsf (__imag__ x) > FLT_MIN)) - { - __sincosf (__imag__ x, &sinix, &cosix); - } - else - { - sinix = __imag__ x; - cosix = 1.0f; - } - - __real__ retval = __copysignf (value, cosix); - __imag__ retval = __copysignf (value, sinix); - } - } - else if (signbit (__real__ x) == 0) - { - __real__ retval = HUGE_VALF; - __imag__ retval = __nanf (""); - - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); - } - else - { - __real__ retval = 0.0; - __imag__ retval = __copysignf (0.0, __imag__ x); - } - } - else - { - /* If the real part is NaN the result is NaN + iNaN unless the - imaginary part is zero. */ - __real__ retval = __nanf (""); - if (icls == FP_ZERO) - __imag__ retval = __imag__ x; - else - { - __imag__ retval = __nanf (""); - - if (rcls != FP_NAN || icls != FP_NAN) - feraiseexcept (FE_INVALID); - } - } - - return retval; -} -#ifndef __cexpf -weak_alias (__cexpf, cexpf) -#endif diff --git a/math/s_cexpl.c b/math/s_cexpl.c deleted file mode 100644 index 9ab566c..0000000 --- a/math/s_cexpl.c +++ /dev/null @@ -1,153 +0,0 @@ -/* Return value of complex exponential function for long double complex value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -__cexpl (__complex__ long double x) -{ - __complex__ long double retval; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (__glibc_likely (rcls >= FP_ZERO)) - { - /* Real part is finite. */ - if (__glibc_likely (icls >= FP_ZERO)) - { - /* Imaginary part is finite. */ - const int t = (int) ((LDBL_MAX_EXP - 1) * M_LN2l); - long double sinix, cosix; - - if (__glibc_likely (fabsl (__imag__ x) > LDBL_MIN)) - { - __sincosl (__imag__ x, &sinix, &cosix); - } - else - { - sinix = __imag__ x; - cosix = 1.0; - } - - if (__real__ x > t) - { - long double exp_t = __ieee754_expl (t); - __real__ x -= t; - sinix *= exp_t; - cosix *= exp_t; - if (__real__ x > t) - { - __real__ x -= t; - sinix *= exp_t; - cosix *= exp_t; - } - } - if (__real__ x > t) - { - /* Overflow (original real part of x > 3t). */ - __real__ retval = LDBL_MAX * cosix; - __imag__ retval = LDBL_MAX * sinix; - } - else - { - long double exp_val = __ieee754_expl (__real__ x); - __real__ retval = exp_val * cosix; - __imag__ retval = exp_val * sinix; - } - math_check_force_underflow_complex (retval); - } - else - { - /* If the imaginary part is +-inf or NaN and the real part - is not +-inf the result is NaN + iNaN. */ - __real__ retval = __nanl (""); - __imag__ retval = __nanl (""); - - feraiseexcept (FE_INVALID); - } - } - else if (__glibc_likely (rcls == FP_INFINITE)) - { - /* Real part is infinite. */ - if (__glibc_likely (icls >= FP_ZERO)) - { - /* Imaginary part is finite. */ - long double value = signbit (__real__ x) ? 0.0 : HUGE_VALL; - - if (icls == FP_ZERO) - { - /* Imaginary part is 0.0. */ - __real__ retval = value; - __imag__ retval = __imag__ x; - } - else - { - long double sinix, cosix; - - if (__glibc_likely (fabsl (__imag__ x) > LDBL_MIN)) - { - __sincosl (__imag__ x, &sinix, &cosix); - } - else - { - sinix = __imag__ x; - cosix = 1.0; - } - - __real__ retval = __copysignl (value, cosix); - __imag__ retval = __copysignl (value, sinix); - } - } - else if (signbit (__real__ x) == 0) - { - __real__ retval = HUGE_VALL; - __imag__ retval = __nanl (""); - - if (icls == FP_INFINITE) - feraiseexcept (FE_INVALID); - } - else - { - __real__ retval = 0.0; - __imag__ retval = __copysignl (0.0, __imag__ x); - } - } - else - { - /* If the real part is NaN the result is NaN + iNaN unless the - imaginary part is zero. */ - __real__ retval = __nanl (""); - if (icls == FP_ZERO) - __imag__ retval = __imag__ x; - else - { - __imag__ retval = __nanl (""); - - if (rcls != FP_NAN || icls != FP_NAN) - feraiseexcept (FE_INVALID); - } - } - - return retval; -} -weak_alias (__cexpl, cexpl) diff --git a/math/s_clog.c b/math/s_clog.c deleted file mode 100644 index b546030..0000000 --- a/math/s_clog.c +++ /dev/null @@ -1,118 +0,0 @@ -/* Compute complex natural logarithm. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 - -__complex__ double -__clog (__complex__ double x) -{ - __complex__ double result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO)) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PI : 0.0; - __imag__ result = __copysign (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabs (__real__ x); - } - else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN)) - { - /* Neither real nor imaginary part is NaN. */ - double absx = fabs (__real__ x), absy = fabs (__imag__ x); - int scale = 0; - - if (absx < absy) - { - double t = absx; - absx = absy; - absy = t; - } - - if (absx > DBL_MAX / 2.0) - { - scale = -1; - absx = __scalbn (absx, scale); - absy = (absy >= DBL_MIN * 2.0 ? __scalbn (absy, scale) : 0.0); - } - else if (absx < DBL_MIN && absy < DBL_MIN) - { - scale = DBL_MANT_DIG; - absx = __scalbn (absx, scale); - absy = __scalbn (absy, scale); - } - - if (absx == 1.0 && scale == 0) - { - __real__ result = __log1p (absy * absy) / 2.0; - math_check_force_underflow_nonneg (__real__ result); - } - else if (absx > 1.0 && absx < 2.0 && absy < 1.0 && scale == 0) - { - double d2m1 = (absx - 1.0) * (absx + 1.0); - if (absy >= DBL_EPSILON) - d2m1 += absy * absy; - __real__ result = __log1p (d2m1) / 2.0; - } - else if (absx < 1.0 - && absx >= 0.5 - && absy < DBL_EPSILON / 2.0 - && scale == 0) - { - double d2m1 = (absx - 1.0) * (absx + 1.0); - __real__ result = __log1p (d2m1) / 2.0; - } - else if (absx < 1.0 - && absx >= 0.5 - && scale == 0 - && absx * absx + absy * absy >= 0.5) - { - double d2m1 = __x2y2m1 (absx, absy); - __real__ result = __log1p (d2m1) / 2.0; - } - else - { - double d = __ieee754_hypot (absx, absy); - __real__ result = __ieee754_log (d) - scale * M_LN2; - } - - __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nan (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VAL; - else - __real__ result = __nan (""); - } - - return result; -} -weak_alias (__clog, clog) -#ifdef NO_LONG_DOUBLE -strong_alias (__clog, __clogl) -weak_alias (__clog, clogl) -#endif diff --git a/math/s_clog10.c b/math/s_clog10.c deleted file mode 100644 index 8d9245b..0000000 --- a/math/s_clog10.c +++ /dev/null @@ -1,124 +0,0 @@ -/* Compute complex base 10 logarithm. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 - -/* log_10 (2). */ -#define M_LOG10_2 0.3010299956639811952137388947244930267682 - -/* pi * log10 (e). */ -#define M_PI_LOG10E 1.364376353841841347485783625431355770210 - -__complex__ double -__clog10 (__complex__ double x) -{ - __complex__ double result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO)) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PI_LOG10E : 0.0; - __imag__ result = __copysign (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabs (__real__ x); - } - else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN)) - { - /* Neither real nor imaginary part is NaN. */ - double absx = fabs (__real__ x), absy = fabs (__imag__ x); - int scale = 0; - - if (absx < absy) - { - double t = absx; - absx = absy; - absy = t; - } - - if (absx > DBL_MAX / 2.0) - { - scale = -1; - absx = __scalbn (absx, scale); - absy = (absy >= DBL_MIN * 2.0 ? __scalbn (absy, scale) : 0.0); - } - else if (absx < DBL_MIN && absy < DBL_MIN) - { - scale = DBL_MANT_DIG; - absx = __scalbn (absx, scale); - absy = __scalbn (absy, scale); - } - - if (absx == 1.0 && scale == 0) - { - __real__ result = __log1p (absy * absy) * (M_LOG10E / 2.0); - math_check_force_underflow_nonneg (__real__ result); - } - else if (absx > 1.0 && absx < 2.0 && absy < 1.0 && scale == 0) - { - double d2m1 = (absx - 1.0) * (absx + 1.0); - if (absy >= DBL_EPSILON) - d2m1 += absy * absy; - __real__ result = __log1p (d2m1) * (M_LOG10E / 2.0); - } - else if (absx < 1.0 - && absx >= 0.5 - && absy < DBL_EPSILON / 2.0 - && scale == 0) - { - double d2m1 = (absx - 1.0) * (absx + 1.0); - __real__ result = __log1p (d2m1) * (M_LOG10E / 2.0); - } - else if (absx < 1.0 - && absx >= 0.5 - && scale == 0 - && absx * absx + absy * absy >= 0.5) - { - double d2m1 = __x2y2m1 (absx, absy); - __real__ result = __log1p (d2m1) * (M_LOG10E / 2.0); - } - else - { - double d = __ieee754_hypot (absx, absy); - __real__ result = __ieee754_log10 (d) - scale * M_LOG10_2; - } - - __imag__ result = M_LOG10E * __ieee754_atan2 (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nan (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VAL; - else - __real__ result = __nan (""); - } - - return result; -} -weak_alias (__clog10, clog10) -#ifdef NO_LONG_DOUBLE -strong_alias (__clog10, __clog10l) -weak_alias (__clog10, clog10l) -#endif diff --git a/math/s_clog10_template.c b/math/s_clog10_template.c index 8d9245b..2b8d8c0 100644 --- a/math/s_clog10_template.c +++ b/math/s_clog10_template.c @@ -23,102 +23,106 @@ #include /* log_10 (2). */ -#define M_LOG10_2 0.3010299956639811952137388947244930267682 +#define LOG10_2 M_LIT (0.3010299956639811952137388947244930267682) /* pi * log10 (e). */ -#define M_PI_LOG10E 1.364376353841841347485783625431355770210 +#define PI_LOG10E M_LIT (1.364376353841841347485783625431355770210) -__complex__ double -__clog10 (__complex__ double x) +CFLOAT +M_DECL_FUNC (__clog10) (CFLOAT x) { - __complex__ double result; + CFLOAT result; int rcls = fpclassify (__real__ x); int icls = fpclassify (__imag__ x); if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO)) { /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PI_LOG10E : 0.0; - __imag__ result = __copysign (__imag__ result, __imag__ x); + __imag__ result = signbit (__real__ x) ? PI_LOG10E : 0; + __imag__ result = M_COPYSIGN (__imag__ result, __imag__ x); /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabs (__real__ x); + __real__ result = -1 / M_FABS (__real__ x); } else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN)) { /* Neither real nor imaginary part is NaN. */ - double absx = fabs (__real__ x), absy = fabs (__imag__ x); + FLOAT absx = M_FABS (__real__ x), absy = M_FABS (__imag__ x); int scale = 0; if (absx < absy) { - double t = absx; + FLOAT t = absx; absx = absy; absy = t; } - if (absx > DBL_MAX / 2.0) + if (absx > M_MAX / 2) { scale = -1; - absx = __scalbn (absx, scale); - absy = (absy >= DBL_MIN * 2.0 ? __scalbn (absy, scale) : 0.0); + absx = M_SCALBN (absx, scale); + absy = (absy >= M_MIN * 2 ? M_SCALBN (absy, scale) : 0); } - else if (absx < DBL_MIN && absy < DBL_MIN) + else if (absx < M_MIN && absy < M_MIN) { - scale = DBL_MANT_DIG; - absx = __scalbn (absx, scale); - absy = __scalbn (absy, scale); + scale = M_MANT_DIG; + absx = M_SCALBN (absx, scale); + absy = M_SCALBN (absy, scale); } - if (absx == 1.0 && scale == 0) + if (absx == 1 && scale == 0) { - __real__ result = __log1p (absy * absy) * (M_LOG10E / 2.0); + __real__ result = M_LOG1P (absy * absy) + * ((FLOAT) M_MLIT (M_LOG10E) / 2); math_check_force_underflow_nonneg (__real__ result); } - else if (absx > 1.0 && absx < 2.0 && absy < 1.0 && scale == 0) + else if (absx > 1 && absx < 2 && absy < 1 && scale == 0) { - double d2m1 = (absx - 1.0) * (absx + 1.0); - if (absy >= DBL_EPSILON) + FLOAT d2m1 = (absx - 1) * (absx + 1); + if (absy >= M_EPSILON) d2m1 += absy * absy; - __real__ result = __log1p (d2m1) * (M_LOG10E / 2.0); + __real__ result = M_LOG1P (d2m1) * ((FLOAT) M_MLIT (M_LOG10E) / 2); } - else if (absx < 1.0 - && absx >= 0.5 - && absy < DBL_EPSILON / 2.0 + else if (absx < 1 + && absx >= M_LIT (0.5) + && absy < M_EPSILON / 2 && scale == 0) { - double d2m1 = (absx - 1.0) * (absx + 1.0); - __real__ result = __log1p (d2m1) * (M_LOG10E / 2.0); + FLOAT d2m1 = (absx - 1) * (absx + 1); + __real__ result = M_LOG1P (d2m1) * ((FLOAT) M_MLIT (M_LOG10E) / 2); } - else if (absx < 1.0 - && absx >= 0.5 + else if (absx < 1 + && absx >= M_LIT (0.5) && scale == 0 - && absx * absx + absy * absy >= 0.5) + && absx * absx + absy * absy >= M_LIT (0.5)) { - double d2m1 = __x2y2m1 (absx, absy); - __real__ result = __log1p (d2m1) * (M_LOG10E / 2.0); + FLOAT d2m1 = M_SUF (__x2y2m1) (absx, absy); + __real__ result = M_LOG1P (d2m1) * ((FLOAT) M_MLIT (M_LOG10E) / 2); } else { - double d = __ieee754_hypot (absx, absy); - __real__ result = __ieee754_log10 (d) - scale * M_LOG10_2; + FLOAT d = M_HYPOT (absx, absy); + __real__ result = M_SUF (__ieee754_log10) (d) - scale * LOG10_2; } - __imag__ result = M_LOG10E * __ieee754_atan2 (__imag__ x, __real__ x); + __imag__ result = M_MLIT (M_LOG10E) * M_ATAN2 (__imag__ x, __real__ x); } else { - __imag__ result = __nan (""); + __imag__ result = M_NAN; if (rcls == FP_INFINITE || icls == FP_INFINITE) /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VAL; + __real__ result = M_HUGE_VAL; else - __real__ result = __nan (""); + __real__ result = M_NAN; } return result; } -weak_alias (__clog10, clog10) -#ifdef NO_LONG_DOUBLE -strong_alias (__clog10, __clog10l) -weak_alias (__clog10, clog10l) + +declare_mgen_alias (__clog10, clog10) + +#if M_LIBM_NEED_COMPAT (clog10) + /* __clog10 was accidentally exported in past versions. */ +declare_mgen_libm_compat (__clog10, __clog10) +declare_mgen_libm_compat (clog10, clog10) #endif diff --git a/math/s_clog10f.c b/math/s_clog10f.c deleted file mode 100644 index 485625e..0000000 --- a/math/s_clog10f.c +++ /dev/null @@ -1,122 +0,0 @@ -/* Compute complex base 10 logarithm. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 - -/* log_10 (2). */ -#define M_LOG10_2f 0.3010299956639811952137388947244930267682f - -/* pi * log10 (e). */ -#define M_PI_LOG10Ef 1.364376353841841347485783625431355770210f - -__complex__ float -__clog10f (__complex__ float x) -{ - __complex__ float result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO)) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PI_LOG10Ef : 0.0; - __imag__ result = __copysignf (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabsf (__real__ x); - } - else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN)) - { - /* Neither real nor imaginary part is NaN. */ - float absx = fabsf (__real__ x), absy = fabsf (__imag__ x); - int scale = 0; - - if (absx < absy) - { - float t = absx; - absx = absy; - absy = t; - } - - if (absx > FLT_MAX / 2.0f) - { - scale = -1; - absx = __scalbnf (absx, scale); - absy = (absy >= FLT_MIN * 2.0f ? __scalbnf (absy, scale) : 0.0f); - } - else if (absx < FLT_MIN && absy < FLT_MIN) - { - scale = FLT_MANT_DIG; - absx = __scalbnf (absx, scale); - absy = __scalbnf (absy, scale); - } - - if (absx == 1.0f && scale == 0) - { - __real__ result = __log1pf (absy * absy) * ((float) M_LOG10E / 2.0f); - math_check_force_underflow_nonneg (__real__ result); - } - else if (absx > 1.0f && absx < 2.0f && absy < 1.0f && scale == 0) - { - float d2m1 = (absx - 1.0f) * (absx + 1.0f); - if (absy >= FLT_EPSILON) - d2m1 += absy * absy; - __real__ result = __log1pf (d2m1) * ((float) M_LOG10E / 2.0f); - } - else if (absx < 1.0f - && absx >= 0.5f - && absy < FLT_EPSILON / 2.0f - && scale == 0) - { - float d2m1 = (absx - 1.0f) * (absx + 1.0f); - __real__ result = __log1pf (d2m1) * ((float) M_LOG10E / 2.0f); - } - else if (absx < 1.0f - && absx >= 0.5f - && scale == 0 - && absx * absx + absy * absy >= 0.5f) - { - float d2m1 = __x2y2m1f (absx, absy); - __real__ result = __log1pf (d2m1) * ((float) M_LOG10E / 2.0f); - } - else - { - float d = __ieee754_hypotf (absx, absy); - __real__ result = __ieee754_log10f (d) - scale * M_LOG10_2f; - } - - __imag__ result = M_LOG10E * __ieee754_atan2f (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nanf (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VALF; - else - __real__ result = __nanf (""); - } - - return result; -} -#ifndef __clog10f -weak_alias (__clog10f, clog10f) -#endif diff --git a/math/s_clog10l.c b/math/s_clog10l.c deleted file mode 100644 index da40477..0000000 --- a/math/s_clog10l.c +++ /dev/null @@ -1,127 +0,0 @@ -/* Compute complex base 10 logarithm. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 - -/* To avoid spurious underflows, use this definition to treat IBM long - double as approximating an IEEE-style format. */ -#if LDBL_MANT_DIG == 106 -# undef LDBL_EPSILON -# define LDBL_EPSILON 0x1p-106L -#endif - -/* log_10 (2). */ -#define M_LOG10_2l 0.3010299956639811952137388947244930267682L - -/* pi * log10 (e). */ -#define M_PI_LOG10El 1.364376353841841347485783625431355770210L - -__complex__ long double -__clog10l (__complex__ long double x) -{ - __complex__ long double result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO)) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PI_LOG10El : 0.0; - __imag__ result = __copysignl (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabsl (__real__ x); - } - else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN)) - { - /* Neither real nor imaginary part is NaN. */ - long double absx = fabsl (__real__ x), absy = fabsl (__imag__ x); - int scale = 0; - - if (absx < absy) - { - long double t = absx; - absx = absy; - absy = t; - } - - if (absx > LDBL_MAX / 2.0L) - { - scale = -1; - absx = __scalbnl (absx, scale); - absy = (absy >= LDBL_MIN * 2.0L ? __scalbnl (absy, scale) : 0.0L); - } - else if (absx < LDBL_MIN && absy < LDBL_MIN) - { - scale = LDBL_MANT_DIG; - absx = __scalbnl (absx, scale); - absy = __scalbnl (absy, scale); - } - - if (absx == 1.0L && scale == 0) - { - __real__ result = __log1pl (absy * absy) * (M_LOG10El / 2.0L); - math_check_force_underflow_nonneg (__real__ result); - } - else if (absx > 1.0L && absx < 2.0L && absy < 1.0L && scale == 0) - { - long double d2m1 = (absx - 1.0L) * (absx + 1.0L); - if (absy >= LDBL_EPSILON) - d2m1 += absy * absy; - __real__ result = __log1pl (d2m1) * (M_LOG10El / 2.0L); - } - else if (absx < 1.0L - && absx >= 0.5L - && absy < LDBL_EPSILON / 2.0L - && scale == 0) - { - long double d2m1 = (absx - 1.0L) * (absx + 1.0L); - __real__ result = __log1pl (d2m1) * (M_LOG10El / 2.0L); - } - else if (absx < 1.0L - && absx >= 0.5L - && scale == 0 - && absx * absx + absy * absy >= 0.5L) - { - long double d2m1 = __x2y2m1l (absx, absy); - __real__ result = __log1pl (d2m1) * (M_LOG10El / 2.0L); - } - else - { - long double d = __ieee754_hypotl (absx, absy); - __real__ result = __ieee754_log10l (d) - scale * M_LOG10_2l; - } - - __imag__ result = M_LOG10El * __ieee754_atan2l (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nanl (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VALL; - else - __real__ result = __nanl (""); - } - - return result; -} -weak_alias (__clog10l, clog10l) diff --git a/math/s_clog_template.c b/math/s_clog_template.c index b546030..047ac03 100644 --- a/math/s_clog_template.c +++ b/math/s_clog_template.c @@ -22,97 +22,98 @@ #include #include -__complex__ double -__clog (__complex__ double x) +CFLOAT +M_DECL_FUNC (__clog) (CFLOAT x) { - __complex__ double result; + CFLOAT result; int rcls = fpclassify (__real__ x); int icls = fpclassify (__imag__ x); if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO)) { /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PI : 0.0; - __imag__ result = __copysign (__imag__ result, __imag__ x); + __imag__ result = signbit (__real__ x) ? (FLOAT) M_MLIT (M_PI) : 0; + __imag__ result = M_COPYSIGN (__imag__ result, __imag__ x); /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabs (__real__ x); + __real__ result = -1 / M_FABS (__real__ x); } else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN)) { /* Neither real nor imaginary part is NaN. */ - double absx = fabs (__real__ x), absy = fabs (__imag__ x); + FLOAT absx = M_FABS (__real__ x), absy = M_FABS (__imag__ x); int scale = 0; if (absx < absy) { - double t = absx; + FLOAT t = absx; absx = absy; absy = t; } - if (absx > DBL_MAX / 2.0) + if (absx > M_MAX / 2) { scale = -1; - absx = __scalbn (absx, scale); - absy = (absy >= DBL_MIN * 2.0 ? __scalbn (absy, scale) : 0.0); + absx = M_SCALBN (absx, scale); + absy = (absy >= M_MIN * 2 ? M_SCALBN (absy, scale) : 0); } - else if (absx < DBL_MIN && absy < DBL_MIN) + else if (absx < M_MIN && absy < M_MIN) { - scale = DBL_MANT_DIG; - absx = __scalbn (absx, scale); - absy = __scalbn (absy, scale); + scale = M_MANT_DIG; + absx = M_SCALBN (absx, scale); + absy = M_SCALBN (absy, scale); } - if (absx == 1.0 && scale == 0) + if (absx == 1 && scale == 0) { - __real__ result = __log1p (absy * absy) / 2.0; + __real__ result = M_LOG1P (absy * absy) / 2; math_check_force_underflow_nonneg (__real__ result); } - else if (absx > 1.0 && absx < 2.0 && absy < 1.0 && scale == 0) + else if (absx > 1 && absx < 2 && absy < 1 && scale == 0) { - double d2m1 = (absx - 1.0) * (absx + 1.0); - if (absy >= DBL_EPSILON) + FLOAT d2m1 = (absx - 1) * (absx + 1); + if (absy >= M_EPSILON) d2m1 += absy * absy; - __real__ result = __log1p (d2m1) / 2.0; + __real__ result = M_LOG1P (d2m1) / 2; } - else if (absx < 1.0 - && absx >= 0.5 - && absy < DBL_EPSILON / 2.0 + else if (absx < 1 + && absx >= M_LIT (0.5) + && absy < M_EPSILON / 2 && scale == 0) { - double d2m1 = (absx - 1.0) * (absx + 1.0); - __real__ result = __log1p (d2m1) / 2.0; + FLOAT d2m1 = (absx - 1) * (absx + 1); + __real__ result = M_LOG1P (d2m1) / 2; } - else if (absx < 1.0 - && absx >= 0.5 + else if (absx < 1 + && absx >= M_LIT (0.5) && scale == 0 - && absx * absx + absy * absy >= 0.5) + && absx * absx + absy * absy >= M_LIT (0.5)) { - double d2m1 = __x2y2m1 (absx, absy); - __real__ result = __log1p (d2m1) / 2.0; + FLOAT d2m1 = M_SUF (__x2y2m1) (absx, absy); + __real__ result = M_LOG1P (d2m1) / 2; } else { - double d = __ieee754_hypot (absx, absy); - __real__ result = __ieee754_log (d) - scale * M_LN2; + FLOAT d = M_HYPOT (absx, absy); + __real__ result = M_LOG (d) - scale * (FLOAT) M_MLIT (M_LN2); } - __imag__ result = __ieee754_atan2 (__imag__ x, __real__ x); + __imag__ result = M_ATAN2 (__imag__ x, __real__ x); } else { - __imag__ result = __nan (""); + __imag__ result = M_NAN; if (rcls == FP_INFINITE || icls == FP_INFINITE) /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VAL; + __real__ result = M_HUGE_VAL; else - __real__ result = __nan (""); + __real__ result = M_NAN; } return result; } -weak_alias (__clog, clog) -#ifdef NO_LONG_DOUBLE -strong_alias (__clog, __clogl) -weak_alias (__clog, clogl) + +declare_mgen_alias (__clog, clog) + +#if M_LIBM_NEED_COMPAT (clog) +declare_mgen_libm_compat (__clog, clog) #endif diff --git a/math/s_clogf.c b/math/s_clogf.c deleted file mode 100644 index cc56539..0000000 --- a/math/s_clogf.c +++ /dev/null @@ -1,116 +0,0 @@ -/* Compute complex natural logarithm. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 - -__complex__ float -__clogf (__complex__ float x) -{ - __complex__ float result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO)) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PI : 0.0; - __imag__ result = __copysignf (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabsf (__real__ x); - } - else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN)) - { - /* Neither real nor imaginary part is NaN. */ - float absx = fabsf (__real__ x), absy = fabsf (__imag__ x); - int scale = 0; - - if (absx < absy) - { - float t = absx; - absx = absy; - absy = t; - } - - if (absx > FLT_MAX / 2.0f) - { - scale = -1; - absx = __scalbnf (absx, scale); - absy = (absy >= FLT_MIN * 2.0f ? __scalbnf (absy, scale) : 0.0f); - } - else if (absx < FLT_MIN && absy < FLT_MIN) - { - scale = FLT_MANT_DIG; - absx = __scalbnf (absx, scale); - absy = __scalbnf (absy, scale); - } - - if (absx == 1.0f && scale == 0) - { - __real__ result = __log1pf (absy * absy) / 2.0f; - math_check_force_underflow_nonneg (__real__ result); - } - else if (absx > 1.0f && absx < 2.0f && absy < 1.0f && scale == 0) - { - float d2m1 = (absx - 1.0f) * (absx + 1.0f); - if (absy >= FLT_EPSILON) - d2m1 += absy * absy; - __real__ result = __log1pf (d2m1) / 2.0f; - } - else if (absx < 1.0f - && absx >= 0.5f - && absy < FLT_EPSILON / 2.0f - && scale == 0) - { - float d2m1 = (absx - 1.0f) * (absx + 1.0f); - __real__ result = __log1pf (d2m1) / 2.0f; - } - else if (absx < 1.0f - && absx >= 0.5f - && scale == 0 - && absx * absx + absy * absy >= 0.5f) - { - float d2m1 = __x2y2m1f (absx, absy); - __real__ result = __log1pf (d2m1) / 2.0f; - } - else - { - float d = __ieee754_hypotf (absx, absy); - __real__ result = __ieee754_logf (d) - scale * (float) M_LN2; - } - - __imag__ result = __ieee754_atan2f (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nanf (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VALF; - else - __real__ result = __nanf (""); - } - - return result; -} -#ifndef __clogf -weak_alias (__clogf, clogf) -#endif diff --git a/math/s_clogl.c b/math/s_clogl.c deleted file mode 100644 index 6db59b7..0000000 --- a/math/s_clogl.c +++ /dev/null @@ -1,121 +0,0 @@ -/* Compute complex natural logarithm. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 - -/* To avoid spurious underflows, use this definition to treat IBM long - double as approximating an IEEE-style format. */ -#if LDBL_MANT_DIG == 106 -# undef LDBL_EPSILON -# define LDBL_EPSILON 0x1p-106L -#endif - -__complex__ long double -__clogl (__complex__ long double x) -{ - __complex__ long double result; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (__glibc_unlikely (rcls == FP_ZERO && icls == FP_ZERO)) - { - /* Real and imaginary part are 0.0. */ - __imag__ result = signbit (__real__ x) ? M_PIl : 0.0; - __imag__ result = __copysignl (__imag__ result, __imag__ x); - /* Yes, the following line raises an exception. */ - __real__ result = -1.0 / fabsl (__real__ x); - } - else if (__glibc_likely (rcls != FP_NAN && icls != FP_NAN)) - { - /* Neither real nor imaginary part is NaN. */ - long double absx = fabsl (__real__ x), absy = fabsl (__imag__ x); - int scale = 0; - - if (absx < absy) - { - long double t = absx; - absx = absy; - absy = t; - } - - if (absx > LDBL_MAX / 2.0L) - { - scale = -1; - absx = __scalbnl (absx, scale); - absy = (absy >= LDBL_MIN * 2.0L ? __scalbnl (absy, scale) : 0.0L); - } - else if (absx < LDBL_MIN && absy < LDBL_MIN) - { - scale = LDBL_MANT_DIG; - absx = __scalbnl (absx, scale); - absy = __scalbnl (absy, scale); - } - - if (absx == 1.0L && scale == 0) - { - __real__ result = __log1pl (absy * absy) / 2.0L; - math_check_force_underflow_nonneg (__real__ result); - } - else if (absx > 1.0L && absx < 2.0L && absy < 1.0L && scale == 0) - { - long double d2m1 = (absx - 1.0L) * (absx + 1.0L); - if (absy >= LDBL_EPSILON) - d2m1 += absy * absy; - __real__ result = __log1pl (d2m1) / 2.0L; - } - else if (absx < 1.0L - && absx >= 0.5L - && absy < LDBL_EPSILON / 2.0L - && scale == 0) - { - long double d2m1 = (absx - 1.0L) * (absx + 1.0L); - __real__ result = __log1pl (d2m1) / 2.0L; - } - else if (absx < 1.0L - && absx >= 0.5L - && scale == 0 - && absx * absx + absy * absy >= 0.5L) - { - long double d2m1 = __x2y2m1l (absx, absy); - __real__ result = __log1pl (d2m1) / 2.0L; - } - else - { - long double d = __ieee754_hypotl (absx, absy); - __real__ result = __ieee754_logl (d) - scale * M_LN2l; - } - - __imag__ result = __ieee754_atan2l (__imag__ x, __real__ x); - } - else - { - __imag__ result = __nanl (""); - if (rcls == FP_INFINITE || icls == FP_INFINITE) - /* Real or imaginary part is infinite. */ - __real__ result = HUGE_VALL; - else - __real__ result = __nanl (""); - } - - return result; -} -weak_alias (__clogl, clogl) diff --git a/math/s_cpow.c b/math/s_cpow.c deleted file mode 100644 index 037e575..0000000 --- a/math/s_cpow.c +++ /dev/null @@ -1,33 +0,0 @@ -/* Complex power of double values. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 - - -__complex__ double -__cpow (__complex__ double x, __complex__ double c) -{ - return __cexp (c * __clog (x)); -} -weak_alias (__cpow, cpow) -#ifdef NO_LONG_DOUBLE -strong_alias (__cpow, __cpowl) -weak_alias (__cpow, cpowl) -#endif diff --git a/math/s_cpow_template.c b/math/s_cpow_template.c index 037e575..12dfc92 100644 --- a/math/s_cpow_template.c +++ b/math/s_cpow_template.c @@ -1,4 +1,4 @@ -/* Complex power of double values. +/* Complex power of float type. Copyright (C) 1997-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -20,14 +20,14 @@ #include #include - -__complex__ double -__cpow (__complex__ double x, __complex__ double c) +CFLOAT +M_DECL_FUNC (__cpow) (CFLOAT x, CFLOAT c) { - return __cexp (c * __clog (x)); + return M_SUF (__cexp) (c * M_SUF (__clog) (x)); } -weak_alias (__cpow, cpow) -#ifdef NO_LONG_DOUBLE -strong_alias (__cpow, __cpowl) -weak_alias (__cpow, cpowl) + +declare_mgen_alias (__cpow, cpow) + +#if M_LIBM_NEED_COMPAT (cpow) +declare_mgen_libm_compat (__cpow, cpow) #endif diff --git a/math/s_cpowf.c b/math/s_cpowf.c deleted file mode 100644 index 2b0b5b2..0000000 --- a/math/s_cpowf.c +++ /dev/null @@ -1,31 +0,0 @@ -/* Complex power of float values. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 - - -__complex__ float -__cpowf (__complex__ float x, __complex__ float c) -{ - return __cexpf (c * __clogf (x)); -} -#ifndef __cpowf -weak_alias (__cpowf, cpowf) -#endif diff --git a/math/s_cpowl.c b/math/s_cpowl.c deleted file mode 100644 index 963e03a..0000000 --- a/math/s_cpowl.c +++ /dev/null @@ -1,29 +0,0 @@ -/* Complex power of long double values. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 - - -__complex__ long double -__cpowl (__complex__ long double x, __complex__ long double c) -{ - return __cexpl (c * __clogl (x)); -} -weak_alias (__cpowl, cpowl) diff --git a/math/s_cproj.c b/math/s_cproj.c deleted file mode 100644 index d47f009..0000000 --- a/math/s_cproj.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Compute projection of complex double value to Riemann sphere. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -__cproj (__complex__ double x) -{ - if (isinf (__real__ x) || isinf (__imag__ x)) - { - __complex__ double res; - - __real__ res = INFINITY; - __imag__ res = __copysign (0.0, __imag__ x); - - return res; - } - - return x; -} -weak_alias (__cproj, cproj) -#ifdef NO_LONG_DOUBLE -strong_alias (__cproj, __cprojl) -weak_alias (__cproj, cprojl) -#endif diff --git a/math/s_cproj_template.c b/math/s_cproj_template.c index d47f009..e274e4c 100644 --- a/math/s_cproj_template.c +++ b/math/s_cproj_template.c @@ -1,4 +1,4 @@ -/* Compute projection of complex double value to Riemann sphere. +/* Compute projection of complex float type value to Riemann sphere. Copyright (C) 1997-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1997. @@ -22,23 +22,24 @@ #include -__complex__ double -__cproj (__complex__ double x) +CFLOAT +M_DECL_FUNC (__cproj) (CFLOAT x) { if (isinf (__real__ x) || isinf (__imag__ x)) { - __complex__ double res; + CFLOAT res; __real__ res = INFINITY; - __imag__ res = __copysign (0.0, __imag__ x); + __imag__ res = M_COPYSIGN (0, __imag__ x); return res; } return x; } -weak_alias (__cproj, cproj) -#ifdef NO_LONG_DOUBLE -strong_alias (__cproj, __cprojl) -weak_alias (__cproj, cprojl) + +declare_mgen_alias (__cproj, cproj) + +#if M_LIBM_NEED_COMPAT (cproj) +declare_mgen_libm_compat (__cproj, cproj) #endif diff --git a/math/s_cprojf.c b/math/s_cprojf.c deleted file mode 100644 index 8a0d873..0000000 --- a/math/s_cprojf.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Compute projection of complex float value to Riemann sphere. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -__cprojf (__complex__ float x) -{ - if (isinf (__real__ x) || isinf (__imag__ x)) - { - __complex__ float res; - - __real__ res = INFINITY; - __imag__ res = __copysignf (0.0, __imag__ x); - - return res; - } - - return x; -} -#ifndef __cprojf -weak_alias (__cprojf, cprojf) -#endif diff --git a/math/s_cprojl.c b/math/s_cprojl.c deleted file mode 100644 index 213b733..0000000 --- a/math/s_cprojl.c +++ /dev/null @@ -1,40 +0,0 @@ -/* Compute projection of complex long double value to Riemann sphere. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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 -__cprojl (__complex__ long double x) -{ - if (isinf (__real__ x) || isinf (__imag__ x)) - { - __complex__ long double res; - - __real__ res = INFINITY; - __imag__ res = __copysignl (0.0, __imag__ x); - - return res; - } - - return x; -} -weak_alias (__cprojl, cprojl) diff --git a/math/s_csqrt.c b/math/s_csqrt.c deleted file mode 100644 index 1f073e7..0000000 --- a/math/s_csqrt.c +++ /dev/null @@ -1,165 +0,0 @@ -/* Complex square root of double value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Based on an algorithm by Stephen L. Moshier . - 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 - -__complex__ double -__csqrt (__complex__ double x) -{ - __complex__ double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE)) - { - if (icls == FP_INFINITE) - { - __real__ res = HUGE_VAL; - __imag__ res = __imag__ x; - } - else if (rcls == FP_INFINITE) - { - if (__real__ x < 0.0) - { - __real__ res = icls == FP_NAN ? __nan ("") : 0; - __imag__ res = __copysign (HUGE_VAL, __imag__ x); - } - else - { - __real__ res = __real__ x; - __imag__ res = (icls == FP_NAN - ? __nan ("") : __copysign (0.0, __imag__ x)); - } - } - else - { - __real__ res = __nan (""); - __imag__ res = __nan (""); - } - } - else - { - if (__glibc_unlikely (icls == FP_ZERO)) - { - if (__real__ x < 0.0) - { - __real__ res = 0.0; - __imag__ res = __copysign (__ieee754_sqrt (-__real__ x), - __imag__ x); - } - else - { - __real__ res = fabs (__ieee754_sqrt (__real__ x)); - __imag__ res = __copysign (0.0, __imag__ x); - } - } - else if (__glibc_unlikely (rcls == FP_ZERO)) - { - double r; - if (fabs (__imag__ x) >= 2.0 * DBL_MIN) - r = __ieee754_sqrt (0.5 * fabs (__imag__ x)); - else - r = 0.5 * __ieee754_sqrt (2.0 * fabs (__imag__ x)); - - __real__ res = r; - __imag__ res = __copysign (r, __imag__ x); - } - else - { - double d, r, s; - int scale = 0; - - if (fabs (__real__ x) > DBL_MAX / 4.0) - { - scale = 1; - __real__ x = __scalbn (__real__ x, -2 * scale); - __imag__ x = __scalbn (__imag__ x, -2 * scale); - } - else if (fabs (__imag__ x) > DBL_MAX / 4.0) - { - scale = 1; - if (fabs (__real__ x) >= 4.0 * DBL_MIN) - __real__ x = __scalbn (__real__ x, -2 * scale); - else - __real__ x = 0.0; - __imag__ x = __scalbn (__imag__ x, -2 * scale); - } - else if (fabs (__real__ x) < 2.0 * DBL_MIN - && fabs (__imag__ x) < 2.0 * DBL_MIN) - { - scale = -((DBL_MANT_DIG + 1) / 2); - __real__ x = __scalbn (__real__ x, -2 * scale); - __imag__ x = __scalbn (__imag__ x, -2 * scale); - } - - d = __ieee754_hypot (__real__ x, __imag__ x); - /* Use the identity 2 Re res Im res = Im x - to avoid cancellation error in d +/- Re x. */ - if (__real__ x > 0) - { - r = __ieee754_sqrt (0.5 * (d + __real__ x)); - if (scale == 1 && fabs (__imag__ x) < 1.0) - { - /* Avoid possible intermediate underflow. */ - s = __imag__ x / r; - r = __scalbn (r, scale); - scale = 0; - } - else - s = 0.5 * (__imag__ x / r); - } - else - { - s = __ieee754_sqrt (0.5 * (d - __real__ x)); - if (scale == 1 && fabs (__imag__ x) < 1.0) - { - /* Avoid possible intermediate underflow. */ - r = fabs (__imag__ x / s); - s = __scalbn (s, scale); - scale = 0; - } - else - r = fabs (0.5 * (__imag__ x / s)); - } - - if (scale) - { - r = __scalbn (r, scale); - s = __scalbn (s, scale); - } - - math_check_force_underflow (r); - math_check_force_underflow (s); - - __real__ res = r; - __imag__ res = __copysign (s, __imag__ x); - } - } - - return res; -} -weak_alias (__csqrt, csqrt) -#ifdef NO_LONG_DOUBLE -strong_alias (__csqrt, __csqrtl) -weak_alias (__csqrt, csqrtl) -#endif diff --git a/math/s_csqrt_template.c b/math/s_csqrt_template.c index 1f073e7..22af083 100644 --- a/math/s_csqrt_template.c +++ b/math/s_csqrt_template.c @@ -1,4 +1,4 @@ -/* Complex square root of double value. +/* Complex square root of a float type. Copyright (C) 1997-2016 Free Software Foundation, Inc. This file is part of the GNU C Library. Based on an algorithm by Stephen L. Moshier . @@ -23,10 +23,10 @@ #include #include -__complex__ double -__csqrt (__complex__ double x) +CFLOAT +M_DECL_FUNC (__csqrt) (CFLOAT x) { - __complex__ double res; + CFLOAT res; int rcls = fpclassify (__real__ x); int icls = fpclassify (__imag__ x); @@ -34,132 +34,131 @@ __csqrt (__complex__ double x) { if (icls == FP_INFINITE) { - __real__ res = HUGE_VAL; + __real__ res = M_HUGE_VAL; __imag__ res = __imag__ x; } else if (rcls == FP_INFINITE) { - if (__real__ x < 0.0) + if (__real__ x < 0) { - __real__ res = icls == FP_NAN ? __nan ("") : 0; - __imag__ res = __copysign (HUGE_VAL, __imag__ x); + __real__ res = icls == FP_NAN ? M_NAN : 0; + __imag__ res = M_COPYSIGN (M_HUGE_VAL, __imag__ x); } else { __real__ res = __real__ x; __imag__ res = (icls == FP_NAN - ? __nan ("") : __copysign (0.0, __imag__ x)); + ? M_NAN : M_COPYSIGN (0, __imag__ x)); } } else { - __real__ res = __nan (""); - __imag__ res = __nan (""); + __real__ res = M_NAN; + __imag__ res = M_NAN; } } else { if (__glibc_unlikely (icls == FP_ZERO)) { - if (__real__ x < 0.0) + if (__real__ x < 0) { - __real__ res = 0.0; - __imag__ res = __copysign (__ieee754_sqrt (-__real__ x), - __imag__ x); + __real__ res = 0; + __imag__ res = M_COPYSIGN (M_SQRT (-__real__ x), __imag__ x); } else { - __real__ res = fabs (__ieee754_sqrt (__real__ x)); - __imag__ res = __copysign (0.0, __imag__ x); + __real__ res = M_FABS (M_SQRT (__real__ x)); + __imag__ res = M_COPYSIGN (0, __imag__ x); } } else if (__glibc_unlikely (rcls == FP_ZERO)) { - double r; - if (fabs (__imag__ x) >= 2.0 * DBL_MIN) - r = __ieee754_sqrt (0.5 * fabs (__imag__ x)); + FLOAT r; + if (M_FABS (__imag__ x) >= 2 * M_MIN) + r = M_SQRT (M_LIT (0.5) * M_FABS (__imag__ x)); else - r = 0.5 * __ieee754_sqrt (2.0 * fabs (__imag__ x)); + r = M_LIT (0.5) * M_SQRT (2 * M_FABS (__imag__ x)); __real__ res = r; - __imag__ res = __copysign (r, __imag__ x); + __imag__ res = M_COPYSIGN (r, __imag__ x); } else { - double d, r, s; + FLOAT d, r, s; int scale = 0; - if (fabs (__real__ x) > DBL_MAX / 4.0) + if (M_FABS (__real__ x) > M_MAX / 4) { scale = 1; - __real__ x = __scalbn (__real__ x, -2 * scale); - __imag__ x = __scalbn (__imag__ x, -2 * scale); + __real__ x = M_SCALBN (__real__ x, -2 * scale); + __imag__ x = M_SCALBN (__imag__ x, -2 * scale); } - else if (fabs (__imag__ x) > DBL_MAX / 4.0) + else if (M_FABS (__imag__ x) > M_MAX / 4) { scale = 1; - if (fabs (__real__ x) >= 4.0 * DBL_MIN) - __real__ x = __scalbn (__real__ x, -2 * scale); + if (M_FABS (__real__ x) >= 4 * M_MIN) + __real__ x = M_SCALBN (__real__ x, -2 * scale); else - __real__ x = 0.0; - __imag__ x = __scalbn (__imag__ x, -2 * scale); + __real__ x = 0; + __imag__ x = M_SCALBN (__imag__ x, -2 * scale); } - else if (fabs (__real__ x) < 2.0 * DBL_MIN - && fabs (__imag__ x) < 2.0 * DBL_MIN) + else if (M_FABS (__real__ x) < 2 * M_MIN + && M_FABS (__imag__ x) < 2 * M_MIN) { - scale = -((DBL_MANT_DIG + 1) / 2); - __real__ x = __scalbn (__real__ x, -2 * scale); - __imag__ x = __scalbn (__imag__ x, -2 * scale); + scale = -((M_MANT_DIG + 1) / 2); + __real__ x = M_SCALBN (__real__ x, -2 * scale); + __imag__ x = M_SCALBN (__imag__ x, -2 * scale); } - d = __ieee754_hypot (__real__ x, __imag__ x); + d = M_HYPOT (__real__ x, __imag__ x); /* Use the identity 2 Re res Im res = Im x to avoid cancellation error in d +/- Re x. */ if (__real__ x > 0) { - r = __ieee754_sqrt (0.5 * (d + __real__ x)); - if (scale == 1 && fabs (__imag__ x) < 1.0) + r = M_SQRT (M_LIT (0.5) * (d + __real__ x)); + if (scale == 1 && M_FABS (__imag__ x) < 1) { /* Avoid possible intermediate underflow. */ s = __imag__ x / r; - r = __scalbn (r, scale); + r = M_SCALBN (r, scale); scale = 0; } else - s = 0.5 * (__imag__ x / r); + s = M_LIT (0.5) * (__imag__ x / r); } else { - s = __ieee754_sqrt (0.5 * (d - __real__ x)); - if (scale == 1 && fabs (__imag__ x) < 1.0) + s = M_SQRT (M_LIT (0.5) * (d - __real__ x)); + if (scale == 1 && M_FABS (__imag__ x) < 1) { /* Avoid possible intermediate underflow. */ - r = fabs (__imag__ x / s); - s = __scalbn (s, scale); + r = M_FABS (__imag__ x / s); + s = M_SCALBN (s, scale); scale = 0; } else - r = fabs (0.5 * (__imag__ x / s)); + r = M_FABS (M_LIT (0.5) * (__imag__ x / s)); } if (scale) { - r = __scalbn (r, scale); - s = __scalbn (s, scale); + r = M_SCALBN (r, scale); + s = M_SCALBN (s, scale); } math_check_force_underflow (r); math_check_force_underflow (s); __real__ res = r; - __imag__ res = __copysign (s, __imag__ x); + __imag__ res = M_COPYSIGN (s, __imag__ x); } } return res; } -weak_alias (__csqrt, csqrt) -#ifdef NO_LONG_DOUBLE -strong_alias (__csqrt, __csqrtl) -weak_alias (__csqrt, csqrtl) +declare_mgen_alias (__csqrt, csqrt) + +#if M_LIBM_NEED_COMPAT (csqrt) +declare_mgen_libm_compat (__csqrt, csqrt) #endif diff --git a/math/s_csqrtf.c b/math/s_csqrtf.c deleted file mode 100644 index b30af06..0000000 --- a/math/s_csqrtf.c +++ /dev/null @@ -1,163 +0,0 @@ -/* Complex square root of float value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Based on an algorithm by Stephen L. Moshier . - 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 - -__complex__ float -__csqrtf (__complex__ float x) -{ - __complex__ float res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE)) - { - if (icls == FP_INFINITE) - { - __real__ res = HUGE_VALF; - __imag__ res = __imag__ x; - } - else if (rcls == FP_INFINITE) - { - if (__real__ x < 0.0) - { - __real__ res = icls == FP_NAN ? __nanf ("") : 0; - __imag__ res = __copysignf (HUGE_VALF, __imag__ x); - } - else - { - __real__ res = __real__ x; - __imag__ res = (icls == FP_NAN - ? __nanf ("") : __copysignf (0.0, __imag__ x)); - } - } - else - { - __real__ res = __nanf (""); - __imag__ res = __nanf (""); - } - } - else - { - if (__glibc_unlikely (icls == FP_ZERO)) - { - if (__real__ x < 0.0) - { - __real__ res = 0.0; - __imag__ res = __copysignf (__ieee754_sqrtf (-__real__ x), - __imag__ x); - } - else - { - __real__ res = fabsf (__ieee754_sqrtf (__real__ x)); - __imag__ res = __copysignf (0.0, __imag__ x); - } - } - else if (__glibc_unlikely (rcls == FP_ZERO)) - { - float r; - if (fabsf (__imag__ x) >= 2.0f * FLT_MIN) - r = __ieee754_sqrtf (0.5f * fabsf (__imag__ x)); - else - r = 0.5f * __ieee754_sqrtf (2.0f * fabsf (__imag__ x)); - - __real__ res = r; - __imag__ res = __copysignf (r, __imag__ x); - } - else - { - float d, r, s; - int scale = 0; - - if (fabsf (__real__ x) > FLT_MAX / 4.0f) - { - scale = 1; - __real__ x = __scalbnf (__real__ x, -2 * scale); - __imag__ x = __scalbnf (__imag__ x, -2 * scale); - } - else if (fabsf (__imag__ x) > FLT_MAX / 4.0f) - { - scale = 1; - if (fabsf (__real__ x) >= 4.0f * FLT_MIN) - __real__ x = __scalbnf (__real__ x, -2 * scale); - else - __real__ x = 0.0f; - __imag__ x = __scalbnf (__imag__ x, -2 * scale); - } - else if (fabsf (__real__ x) < 2.0f * FLT_MIN - && fabsf (__imag__ x) < 2.0f * FLT_MIN) - { - scale = -((FLT_MANT_DIG + 1) / 2); - __real__ x = __scalbnf (__real__ x, -2 * scale); - __imag__ x = __scalbnf (__imag__ x, -2 * scale); - } - - d = __ieee754_hypotf (__real__ x, __imag__ x); - /* Use the identity 2 Re res Im res = Im x - to avoid cancellation error in d +/- Re x. */ - if (__real__ x > 0) - { - r = __ieee754_sqrtf (0.5f * (d + __real__ x)); - if (scale == 1 && fabsf (__imag__ x) < 1.0f) - { - /* Avoid possible intermediate underflow. */ - s = __imag__ x / r; - r = __scalbnf (r, scale); - scale = 0; - } - else - s = 0.5f * (__imag__ x / r); - } - else - { - s = __ieee754_sqrtf (0.5f * (d - __real__ x)); - if (scale == 1 && fabsf (__imag__ x) < 1.0f) - { - /* Avoid possible intermediate underflow. */ - r = fabsf (__imag__ x / s); - s = __scalbnf (s, scale); - scale = 0; - } - else - r = fabsf (0.5f * (__imag__ x / s)); - } - - if (scale) - { - r = __scalbnf (r, scale); - s = __scalbnf (s, scale); - } - - math_check_force_underflow (r); - math_check_force_underflow (s); - - __real__ res = r; - __imag__ res = __copysignf (s, __imag__ x); - } - } - - return res; -} -#ifndef __csqrtf -weak_alias (__csqrtf, csqrtf) -#endif diff --git a/math/s_csqrtl.c b/math/s_csqrtl.c deleted file mode 100644 index b0b52a5..0000000 --- a/math/s_csqrtl.c +++ /dev/null @@ -1,161 +0,0 @@ -/* Complex square root of long double value. - Copyright (C) 1997-2016 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Based on an algorithm by Stephen L. Moshier . - 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 - -__complex__ long double -__csqrtl (__complex__ long double x) -{ - __complex__ long double res; - int rcls = fpclassify (__real__ x); - int icls = fpclassify (__imag__ x); - - if (__glibc_unlikely (rcls <= FP_INFINITE || icls <= FP_INFINITE)) - { - if (icls == FP_INFINITE) - { - __real__ res = HUGE_VALL; - __imag__ res = __imag__ x; - } - else if (rcls == FP_INFINITE) - { - if (__real__ x < 0.0) - { - __real__ res = icls == FP_NAN ? __nanl ("") : 0; - __imag__ res = __copysignl (HUGE_VALL, __imag__ x); - } - else - { - __real__ res = __real__ x; - __imag__ res = (icls == FP_NAN - ? __nanl ("") : __copysignl (0.0, __imag__ x)); - } - } - else - { - __real__ res = __nanl (""); - __imag__ res = __nanl (""); - } - } - else - { - if (__glibc_unlikely (icls == FP_ZERO)) - { - if (__real__ x < 0.0) - { - __real__ res = 0.0; - __imag__ res = __copysignl (__ieee754_sqrtl (-__real__ x), - __imag__ x); - } - else - { - __real__ res = fabsl (__ieee754_sqrtl (__real__ x)); - __imag__ res = __copysignl (0.0, __imag__ x); - } - } - else if (__glibc_unlikely (rcls == FP_ZERO)) - { - long double r; - if (fabsl (__imag__ x) >= 2.0L * LDBL_MIN) - r = __ieee754_sqrtl (0.5L * fabsl (__imag__ x)); - else - r = 0.5L * __ieee754_sqrtl (2.0L * fabsl (__imag__ x)); - - __real__ res = r; - __imag__ res = __copysignl (r, __imag__ x); - } - else - { - long double d, r, s; - int scale = 0; - - if (fabsl (__real__ x) > LDBL_MAX / 4.0L) - { - scale = 1; - __real__ x = __scalbnl (__real__ x, -2 * scale); - __imag__ x = __scalbnl (__imag__ x, -2 * scale); - } - else if (fabsl (__imag__ x) > LDBL_MAX / 4.0L) - { - scale = 1; - if (fabsl (__real__ x) >= 4.0L * LDBL_MIN) - __real__ x = __scalbnl (__real__ x, -2 * scale); - else - __real__ x = 0.0L; - __imag__ x = __scalbnl (__imag__ x, -2 * scale); - } - else if (fabsl (__real__ x) < 2.0L * LDBL_MIN - && fabsl (__imag__ x) < 2.0L * LDBL_MIN) - { - scale = -((LDBL_MANT_DIG + 1) / 2); - __real__ x = __scalbnl (__real__ x, -2 * scale); - __imag__ x = __scalbnl (__imag__ x, -2 * scale); - } - - d = __ieee754_hypotl (__real__ x, __imag__ x); - /* Use the identity 2 Re res Im res = Im x - to avoid cancellation error in d +/- Re x. */ - if (__real__ x > 0) - { - r = __ieee754_sqrtl (0.5L * (d + __real__ x)); - if (scale == 1 && fabsl (__imag__ x) < 1.0L) - { - /* Avoid possible intermediate underflow. */ - s = __imag__ x / r; - r = __scalbnl (r, scale); - scale = 0; - } - else - s = 0.5L * (__imag__ x / r); - } - else - { - s = __ieee754_sqrtl (0.5L * (d - __real__ x)); - if (scale == 1 && fabsl (__imag__ x) < 1.0L) - { - /* Avoid possible intermediate underflow. */ - r = fabsl (__imag__ x / s); - s = __scalbnl (s, scale); - scale = 0; - } - else - r = fabsl (0.5L * (__imag__ x / s)); - } - - if (scale) - { - r = __scalbnl (r, scale); - s = __scalbnl (s, scale); - } - - math_check_force_underflow (r); - math_check_force_underflow (s); - - __real__ res = r; - __imag__ res = __copysignl (s, __imag__ x); - } - } - - return res; -} -weak_alias (__csqrtl, csqrtl) diff --git a/sysdeps/alpha/fpu/s_cexpf.c b/sysdeps/alpha/fpu/s_cexpf.c index 2ae519c..d5b53eb 100644 --- a/sysdeps/alpha/fpu/s_cexpf.c +++ b/sysdeps/alpha/fpu/s_cexpf.c @@ -24,14 +24,18 @@ #undef __cexpf #undef cexpf -#define __cexpf internal_cexpf static _Complex float internal_cexpf (_Complex float x); -#include -#include "cfloat-compat.h" +#define M_DECL_FUNC(f) internal_cexpf +#include -#undef __cexpf +/* 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_cexpf (c1_cfloat_decl (x)) diff --git a/sysdeps/alpha/fpu/s_clog10f.c b/sysdeps/alpha/fpu/s_clog10f.c index 1ab0730..c46f288 100644 --- a/sysdeps/alpha/fpu/s_clog10f.c +++ b/sysdeps/alpha/fpu/s_clog10f.c @@ -24,14 +24,18 @@ #undef __clog10f #undef clog10f -#define __clog10f internal_clog10f static _Complex float internal_clog10f (_Complex float x); -#include -#include "cfloat-compat.h" +#define M_DECL_FUNC(f) internal_clog10f +#include -#undef __clog10f +/* 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_clog10f (c1_cfloat_decl (x)) diff --git a/sysdeps/alpha/fpu/s_clogf.c b/sysdeps/alpha/fpu/s_clogf.c index 185948f..492a305 100644 --- a/sysdeps/alpha/fpu/s_clogf.c +++ b/sysdeps/alpha/fpu/s_clogf.c @@ -24,14 +24,18 @@ #undef __clogf #undef clogf -#define __clogf internal_clogf static _Complex float internal_clogf (_Complex float x); -#include -#include "cfloat-compat.h" +#define M_DECL_FUNC(f) internal_clogf +#include -#undef __clogf +/* 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_clogf (c1_cfloat_decl (x)) diff --git a/sysdeps/alpha/fpu/s_cpowf.c b/sysdeps/alpha/fpu/s_cpowf.c index 686c397..4235fe2 100644 --- a/sysdeps/alpha/fpu/s_cpowf.c +++ b/sysdeps/alpha/fpu/s_cpowf.c @@ -24,14 +24,18 @@ #undef __cpowf #undef cpowf -#define __cpowf internal_cpowf static _Complex float internal_cpowf (_Complex float x, _Complex float c); -#include -#include "cfloat-compat.h" +#define M_DECL_FUNC(f) internal_cpowf +#include -#undef __cpowf +/* 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_cpowf (c1_cfloat_decl (x), c1_cfloat_decl (c)) diff --git a/sysdeps/alpha/fpu/s_cprojf.c b/sysdeps/alpha/fpu/s_cprojf.c index 30a24a8..3c4e9e9 100644 --- a/sysdeps/alpha/fpu/s_cprojf.c +++ b/sysdeps/alpha/fpu/s_cprojf.c @@ -24,14 +24,18 @@ #undef __cprojf #undef cprojf -#define __cprojf internal_cprojf static _Complex float internal_cprojf (_Complex float x); -#include -#include "cfloat-compat.h" +#define M_DECL_FUNC(f) internal_cprojf +#include -#undef __cprojf +/* 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_cprojf (c1_cfloat_decl (x)) diff --git a/sysdeps/alpha/fpu/s_csqrtf.c b/sysdeps/alpha/fpu/s_csqrtf.c index c7a18d7..d2f32b9 100644 --- a/sysdeps/alpha/fpu/s_csqrtf.c +++ b/sysdeps/alpha/fpu/s_csqrtf.c @@ -24,14 +24,18 @@ #undef __csqrtf #undef csqrtf -#define __csqrtf internal_csqrtf static _Complex float internal_csqrtf (_Complex float x); -#include -#include "cfloat-compat.h" +#define M_DECL_FUNC(f) internal_csqrtf +#include -#undef __csqrtf +/* 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_csqrtf (c1_cfloat_decl (x)) diff --git a/sysdeps/ieee754/ldbl-opt/s_cexp.c b/sysdeps/ieee754/ldbl-opt/s_cexp.c deleted file mode 100644 index d983c96..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_cexp.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#include -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __cexp, cexpl, GLIBC_2_1); -#endif diff --git a/sysdeps/ieee754/ldbl-opt/s_cexpl.c b/sysdeps/ieee754/ldbl-opt/s_cexpl.c deleted file mode 100644 index d5ae1fc..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_cexpl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#undef weak_alias -#define weak_alias(n,a) -#include -long_double_symbol (libm, __cexpl, cexpl); diff --git a/sysdeps/ieee754/ldbl-opt/s_clog.c b/sysdeps/ieee754/ldbl-opt/s_clog.c deleted file mode 100644 index 3e0e90c..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_clog.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#include -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __clog, clogl, GLIBC_2_1); -#endif diff --git a/sysdeps/ieee754/ldbl-opt/s_clog10.c b/sysdeps/ieee754/ldbl-opt/s_clog10.c deleted file mode 100644 index ac3f4a3..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_clog10.c +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include -#include -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __clog10, __clog10l, GLIBC_2_1); -compat_symbol (libm, clog10, clog10l, GLIBC_2_1); -#endif diff --git a/sysdeps/ieee754/ldbl-opt/s_clog10l.c b/sysdeps/ieee754/ldbl-opt/s_clog10l.c index 954f680..91521ea 100644 --- a/sysdeps/ieee754/ldbl-opt/s_clog10l.c +++ b/sysdeps/ieee754/ldbl-opt/s_clog10l.c @@ -1,10 +1,32 @@ -#include -#include -#undef weak_alias -#define weak_alias(n,a) -#define __clog10l __clog10l_internal -#include -#undef __clog10l +/* clog10l alias overrides for platforms where long double + was previously not unique. + Copyright (C) 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 + . */ + +#define M_DECL_FUNC(x) __clog10l_internal +#include + +#undef declare_mgen_alias +#define declare_mgen_alias(from, to) + +#include + +/* The aliasing for long double is a bit more complicated + since some private symbols leaked out in the past. */ strong_alias (__clog10l_internal, __clog10l__internal) long_double_symbol (libm, __clog10l_internal, __clog10l); long_double_symbol (libm, __clog10l__internal, clog10l); diff --git a/sysdeps/ieee754/ldbl-opt/s_clogl.c b/sysdeps/ieee754/ldbl-opt/s_clogl.c deleted file mode 100644 index 75126c8..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_clogl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#undef weak_alias -#define weak_alias(n,a) -#include -long_double_symbol (libm, __clogl, clogl); diff --git a/sysdeps/ieee754/ldbl-opt/s_cpow.c b/sysdeps/ieee754/ldbl-opt/s_cpow.c deleted file mode 100644 index 4801d7c..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_cpow.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#include -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __cpow, cpowl, GLIBC_2_1); -#endif diff --git a/sysdeps/ieee754/ldbl-opt/s_cpowl.c b/sysdeps/ieee754/ldbl-opt/s_cpowl.c deleted file mode 100644 index 61840e3..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_cpowl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#undef weak_alias -#define weak_alias(n,a) -#include -long_double_symbol (libm, __cpowl, cpowl); diff --git a/sysdeps/ieee754/ldbl-opt/s_cproj.c b/sysdeps/ieee754/ldbl-opt/s_cproj.c deleted file mode 100644 index f298c37..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_cproj.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#include -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __cproj, cprojl, GLIBC_2_1); -#endif diff --git a/sysdeps/ieee754/ldbl-opt/s_cprojl.c b/sysdeps/ieee754/ldbl-opt/s_cprojl.c deleted file mode 100644 index 1cc0580..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_cprojl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#undef weak_alias -#define weak_alias(n,a) -#include -long_double_symbol (libm, __cprojl, cprojl); diff --git a/sysdeps/ieee754/ldbl-opt/s_csqrt.c b/sysdeps/ieee754/ldbl-opt/s_csqrt.c deleted file mode 100644 index 2b6dcfe..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_csqrt.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#include -#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_1) -compat_symbol (libm, __csqrt, csqrtl, GLIBC_2_1); -#endif diff --git a/sysdeps/ieee754/ldbl-opt/s_csqrtl.c b/sysdeps/ieee754/ldbl-opt/s_csqrtl.c deleted file mode 100644 index 045ff93..0000000 --- a/sysdeps/ieee754/ldbl-opt/s_csqrtl.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include -#undef weak_alias -#define weak_alias(n,a) -#include -long_double_symbol (libm, __csqrtl, csqrtl); diff --git a/sysdeps/m68k/m680x0/fpu/s_cexp.c b/sysdeps/m68k/m680x0/fpu/s_cexp_template.c similarity index 94% rename from sysdeps/m68k/m680x0/fpu/s_cexp.c rename to sysdeps/m68k/m680x0/fpu/s_cexp_template.c index f715b77..828ac6c 100644 --- a/sysdeps/m68k/m680x0/fpu/s_cexp.c +++ b/sysdeps/m68k/m680x0/fpu/s_cexp_template.c @@ -22,21 +22,14 @@ #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 s(name) M_SUF (name) #define m81(func) __m81_u(s(func)) -__complex__ float_type -s(__cexp) (__complex__ float_type x) +CFLOAT +s(__cexp) (CFLOAT x) { - __complex__ float_type retval; + CFLOAT retval; unsigned long ix_cond; ix_cond = __m81_test (__imag__ x); diff --git a/sysdeps/m68k/m680x0/fpu/s_cexpf.c b/sysdeps/m68k/m680x0/fpu/s_cexpf.c deleted file mode 100644 index 177a360..0000000 --- a/sysdeps/m68k/m680x0/fpu/s_cexpf.c +++ /dev/null @@ -1,3 +0,0 @@ -#define SUFF f -#define float_type float -#include diff --git a/sysdeps/m68k/m680x0/fpu/s_cexpl.c b/sysdeps/m68k/m680x0/fpu/s_cexpl.c deleted file mode 100644 index bbda4ba..0000000 --- a/sysdeps/m68k/m680x0/fpu/s_cexpl.c +++ /dev/null @@ -1,3 +0,0 @@ -#define SUFF l -#define float_type long double -#include