diff options
Diffstat (limited to 'sysdeps/ieee754/ldbl-128ibm')
104 files changed, 0 insertions, 12987 deletions
diff --git a/sysdeps/ieee754/ldbl-128ibm/Makefile b/sysdeps/ieee754/ldbl-128ibm/Makefile deleted file mode 100644 index bdba6cc6b5..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# The`long double' type is a distinct type we support if -# -mlong-double-128 option is used (or when it becomes a default -# when -mlong-double-64 is not used). -long-double-fcts = yes -sysdep-CFLAGS += -mlong-double-128 - -ifeq ($(subdir),stdlib) -tests += tst-strtold-ldbl-128ibm -$(objpfx)tst-strtold-ldbl-128ibm: $(libm) -endif - -ifeq ($(subdir),math) -tests += test-fmodl-ldbl-128ibm test-remainderl-ldbl-128ibm \ - test-remquol-ldbl-128ibm test-canonical-ldbl-128ibm \ - test-totalorderl-ldbl-128ibm -endif diff --git a/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h b/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h deleted file mode 100644 index 7ddb368d26..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/bits/iscanonical.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Define iscanonical macro. ldbl-128ibm version. - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _MATH_H -# error "Never use <bits/iscanonical.h> directly; include <math.h> instead." -#endif - -#ifdef __NO_LONG_DOUBLE_MATH -# define iscanonical(x) ((void) (__typeof (x)) (x), 1) -#else -extern int __iscanonicall (long double __x) - __THROW __attribute__ ((__const__)); -# define __iscanonicalf(x) ((void) (__typeof (x)) (x), 1) -# define __iscanonical(x) ((void) (__typeof (x)) (x), 1) -# if __HAVE_DISTINCT_FLOAT128 -# define __iscanonicalf128(x) ((void) (__typeof (x)) (x), 1) -# endif - -/* Return nonzero value if X is canonical. In IEEE interchange binary - formats, all values are canonical, but the argument must still be - converted to its semantic type for any exceptions arising from the - conversion, before being discarded; in IBM long double, there are - encodings that are not consistently handled as corresponding to any - particular value of the type, and we return 0 for those. */ -# define iscanonical(x) __MATH_TG ((x), __iscanonical, (x)) -#endif diff --git a/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c b/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c deleted file mode 100644 index cab1da9995..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_acoshl.c +++ /dev/null @@ -1,62 +0,0 @@ -/* @(#)e_acosh.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* __ieee754_acosh(x) - * Method : - * Based on - * acosh(x) = log [ x + sqrt(x*x-1) ] - * we have - * acosh(x) := log(x)+ln2, if x is large; else - * acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else - * acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1. - * - * Special cases: - * acosh(x) is NaN with signal if x<1. - * acosh(NaN) is NaN without signal. - */ - -#include <math.h> -#include <math_private.h> - -static const long double -one = 1.0L, -ln2 = M_LN2l; - -long double -__ieee754_acoshl(long double x) -{ - long double t; - int64_t hx; - uint64_t lx; - double xhi, xlo; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - EXTRACT_WORDS64 (lx, xlo); - if(hx<0x3ff0000000000000LL) { /* x < 1 */ - return (x-x)/(x-x); - } else if(hx >=0x4370000000000000LL) { /* x >= 2**56 */ - if(hx >=0x7ff0000000000000LL) { /* x is inf of NaN */ - return x+x; - } else - return __ieee754_logl(x)+ln2; /* acosh(huge)=log(2x) */ - } else if (((hx-0x3ff0000000000000LL)|(lx&0x7fffffffffffffffLL))==0) { - return 0.0; /* acosh(1) = 0 */ - } else if (hx > 0x4000000000000000LL) { /* 2**56 > x > 2 */ - t=x*x; - return __ieee754_logl(2.0*x-one/(x+__ieee754_sqrtl(t-one))); - } else { /* 1<x<2 */ - t = x-one; - return __log1pl(t+__ieee754_sqrtl(2.0*t+t*t)); - } -} -strong_alias (__ieee754_acoshl, __acoshl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_acosl.c b/sysdeps/ieee754/ldbl-128ibm/e_acosl.c deleted file mode 100644 index 5974ee1338..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_acosl.c +++ /dev/null @@ -1,316 +0,0 @@ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* - Long double expansions are - Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author - reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under - the following terms: - - This 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. - - This 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 this library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* __ieee754_acosl(x) - * Method : - * acos(x) = pi/2 - asin(x) - * acos(-x) = pi/2 + asin(x) - * For |x| <= 0.375 - * acos(x) = pi/2 - asin(x) - * Between .375 and .5 the approximation is - * acos(0.4375 + x) = acos(0.4375) + x P(x) / Q(x) - * Between .5 and .625 the approximation is - * acos(0.5625 + x) = acos(0.5625) + x rS(x) / sS(x) - * For x > 0.625, - * acos(x) = 2 asin(sqrt((1-x)/2)) - * computed with an extended precision square root in the leading term. - * For x < -0.625 - * acos(x) = pi - 2 asin(sqrt((1-|x|)/2)) - * - * Special cases: - * if x is NaN, return x itself; - * if |x|>1, return NaN with invalid signal. - * - * Functions needed: __ieee754_sqrtl. - */ - -#include <math.h> -#include <math_private.h> - -static const long double - one = 1.0L, - pio2_hi = 1.5707963267948966192313216916397514420986L, - pio2_lo = 4.3359050650618905123985220130216759843812E-35L, - - /* acos(0.5625 + x) = acos(0.5625) + x rS(x) / sS(x) - -0.0625 <= x <= 0.0625 - peak relative error 3.3e-35 */ - - rS0 = 5.619049346208901520945464704848780243887E0L, - rS1 = -4.460504162777731472539175700169871920352E1L, - rS2 = 1.317669505315409261479577040530751477488E2L, - rS3 = -1.626532582423661989632442410808596009227E2L, - rS4 = 3.144806644195158614904369445440583873264E1L, - rS5 = 9.806674443470740708765165604769099559553E1L, - rS6 = -5.708468492052010816555762842394927806920E1L, - rS7 = -1.396540499232262112248553357962639431922E1L, - rS8 = 1.126243289311910363001762058295832610344E1L, - rS9 = 4.956179821329901954211277873774472383512E-1L, - rS10 = -3.313227657082367169241333738391762525780E-1L, - - sS0 = -4.645814742084009935700221277307007679325E0L, - sS1 = 3.879074822457694323970438316317961918430E1L, - sS2 = -1.221986588013474694623973554726201001066E2L, - sS3 = 1.658821150347718105012079876756201905822E2L, - sS4 = -4.804379630977558197953176474426239748977E1L, - sS5 = -1.004296417397316948114344573811562952793E2L, - sS6 = 7.530281592861320234941101403870010111138E1L, - sS7 = 1.270735595411673647119592092304357226607E1L, - sS8 = -1.815144839646376500705105967064792930282E1L, - sS9 = -7.821597334910963922204235247786840828217E-2L, - /* 1.000000000000000000000000000000000000000E0 */ - - acosr5625 = 9.7338991014954640492751132535550279812151E-1L, - pimacosr5625 = 2.1682027434402468335351320579240000860757E0L, - - /* acos(0.4375 + x) = acos(0.4375) + x rS(x) / sS(x) - -0.0625 <= x <= 0.0625 - peak relative error 2.1e-35 */ - - P0 = 2.177690192235413635229046633751390484892E0L, - P1 = -2.848698225706605746657192566166142909573E1L, - P2 = 1.040076477655245590871244795403659880304E2L, - P3 = -1.400087608918906358323551402881238180553E2L, - P4 = 2.221047917671449176051896400503615543757E1L, - P5 = 9.643714856395587663736110523917499638702E1L, - P6 = -5.158406639829833829027457284942389079196E1L, - P7 = -1.578651828337585944715290382181219741813E1L, - P8 = 1.093632715903802870546857764647931045906E1L, - P9 = 5.448925479898460003048760932274085300103E-1L, - P10 = -3.315886001095605268470690485170092986337E-1L, - Q0 = -1.958219113487162405143608843774587557016E0L, - Q1 = 2.614577866876185080678907676023269360520E1L, - Q2 = -9.990858606464150981009763389881793660938E1L, - Q3 = 1.443958741356995763628660823395334281596E2L, - Q4 = -3.206441012484232867657763518369723873129E1L, - Q5 = -1.048560885341833443564920145642588991492E2L, - Q6 = 6.745883931909770880159915641984874746358E1L, - Q7 = 1.806809656342804436118449982647641392951E1L, - Q8 = -1.770150690652438294290020775359580915464E1L, - Q9 = -5.659156469628629327045433069052560211164E-1L, - /* 1.000000000000000000000000000000000000000E0 */ - - acosr4375 = 1.1179797320499710475919903296900511518755E0L, - pimacosr4375 = 2.0236129215398221908706530535894517323217E0L, - - /* asin(x) = x + x^3 pS(x^2) / qS(x^2) - 0 <= x <= 0.5 - peak relative error 1.9e-35 */ - pS0 = -8.358099012470680544198472400254596543711E2L, - pS1 = 3.674973957689619490312782828051860366493E3L, - pS2 = -6.730729094812979665807581609853656623219E3L, - pS3 = 6.643843795209060298375552684423454077633E3L, - pS4 = -3.817341990928606692235481812252049415993E3L, - pS5 = 1.284635388402653715636722822195716476156E3L, - pS6 = -2.410736125231549204856567737329112037867E2L, - pS7 = 2.219191969382402856557594215833622156220E1L, - pS8 = -7.249056260830627156600112195061001036533E-1L, - pS9 = 1.055923570937755300061509030361395604448E-3L, - - qS0 = -5.014859407482408326519083440151745519205E3L, - qS1 = 2.430653047950480068881028451580393430537E4L, - qS2 = -4.997904737193653607449250593976069726962E4L, - qS3 = 5.675712336110456923807959930107347511086E4L, - qS4 = -3.881523118339661268482937768522572588022E4L, - qS5 = 1.634202194895541569749717032234510811216E4L, - qS6 = -4.151452662440709301601820849901296953752E3L, - qS7 = 5.956050864057192019085175976175695342168E2L, - qS8 = -4.175375777334867025769346564600396877176E1L; - /* 1.000000000000000000000000000000000000000E0 */ - -long double -__ieee754_acosl (long double x) -{ - long double a, z, r, w, p, q, s, t, f2; - - if (__glibc_unlikely (isnan (x))) - return x + x; - a = __builtin_fabsl (x); - if (a == 1.0L) - { - if (x > 0.0L) - return 0.0; /* acos(1) = 0 */ - else - return (2.0 * pio2_hi) + (2.0 * pio2_lo); /* acos(-1)= pi */ - } - else if (a > 1.0L) - { - return (x - x) / (x - x); /* acos(|x| > 1) is NaN */ - } - if (a < 0.5L) - { - if (a < 0x1p-106L) - return pio2_hi + pio2_lo; - if (a < 0.4375L) - { - /* Arcsine of x. */ - z = x * x; - p = (((((((((pS9 * z - + pS8) * z - + pS7) * z - + pS6) * z - + pS5) * z - + pS4) * z - + pS3) * z - + pS2) * z - + pS1) * z - + pS0) * z; - q = (((((((( z - + qS8) * z - + qS7) * z - + qS6) * z - + qS5) * z - + qS4) * z - + qS3) * z - + qS2) * z - + qS1) * z - + qS0; - r = x + x * p / q; - z = pio2_hi - (r - pio2_lo); - return z; - } - /* .4375 <= |x| < .5 */ - t = a - 0.4375L; - p = ((((((((((P10 * t - + P9) * t - + P8) * t - + P7) * t - + P6) * t - + P5) * t - + P4) * t - + P3) * t - + P2) * t - + P1) * t - + P0) * t; - - q = (((((((((t - + Q9) * t - + Q8) * t - + Q7) * t - + Q6) * t - + Q5) * t - + Q4) * t - + Q3) * t - + Q2) * t - + Q1) * t - + Q0; - r = p / q; - if (x < 0.0L) - r = pimacosr4375 - r; - else - r = acosr4375 + r; - return r; - } - else if (a < 0.625L) - { - t = a - 0.5625L; - p = ((((((((((rS10 * t - + rS9) * t - + rS8) * t - + rS7) * t - + rS6) * t - + rS5) * t - + rS4) * t - + rS3) * t - + rS2) * t - + rS1) * t - + rS0) * t; - - q = (((((((((t - + sS9) * t - + sS8) * t - + sS7) * t - + sS6) * t - + sS5) * t - + sS4) * t - + sS3) * t - + sS2) * t - + sS1) * t - + sS0; - if (x < 0.0L) - r = pimacosr5625 - p / q; - else - r = acosr5625 + p / q; - return r; - } - else - { /* |x| >= .625 */ - double shi, slo; - - z = (one - a) * 0.5; - s = __ieee754_sqrtl (z); - /* Compute an extended precision square root from - the Newton iteration s -> 0.5 * (s + z / s). - The change w from s to the improved value is - w = 0.5 * (s + z / s) - s = (s^2 + z)/2s - s = (z - s^2)/2s. - Express s = f1 + f2 where f1 * f1 is exactly representable. - w = (z - s^2)/2s = (z - f1^2 - 2 f1 f2 - f2^2)/2s . - s + w has extended precision. */ - ldbl_unpack (s, &shi, &slo); - a = shi; - f2 = slo; - w = z - a * a; - w = w - 2.0 * a * f2; - w = w - f2 * f2; - w = w / (2.0 * s); - /* Arcsine of s. */ - p = (((((((((pS9 * z - + pS8) * z - + pS7) * z - + pS6) * z - + pS5) * z - + pS4) * z - + pS3) * z - + pS2) * z - + pS1) * z - + pS0) * z; - q = (((((((( z - + qS8) * z - + qS7) * z - + qS6) * z - + qS5) * z - + qS4) * z - + qS3) * z - + qS2) * z - + qS1) * z - + qS0; - r = s + (w + s * p / q); - - if (x < 0.0L) - w = pio2_hi + (pio2_lo - r); - else - w = r; - return 2.0 * w; - } -} -strong_alias (__ieee754_acosl, __acosl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_asinl.c b/sysdeps/ieee754/ldbl-128ibm/e_asinl.c deleted file mode 100644 index 6ed5e8d68d..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_asinl.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* - Long double expansions are - Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author - reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under the - following terms: - - This 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. - - This 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 this library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* __ieee754_asin(x) - * Method : - * Since asin(x) = x + x^3/6 + x^5*3/40 + x^7*15/336 + ... - * we approximate asin(x) on [0,0.5] by - * asin(x) = x + x*x^2*R(x^2) - * Between .5 and .625 the approximation is - * asin(0.5625 + x) = asin(0.5625) + x rS(x) / sS(x) - * For x in [0.625,1] - * asin(x) = pi/2-2*asin(sqrt((1-x)/2)) - * Let y = (1-x), z = y/2, s := sqrt(z), and pio2_hi+pio2_lo=pi/2; - * then for x>0.98 - * asin(x) = pi/2 - 2*(s+s*z*R(z)) - * = pio2_hi - (2*(s+s*z*R(z)) - pio2_lo) - * For x<=0.98, let pio4_hi = pio2_hi/2, then - * f = hi part of s; - * c = sqrt(z) - f = (z-f*f)/(s+f) ...f+c=sqrt(z) - * and - * asin(x) = pi/2 - 2*(s+s*z*R(z)) - * = pio4_hi+(pio4-2s)-(2s*z*R(z)-pio2_lo) - * = pio4_hi+(pio4-2f)-(2s*z*R(z)-(pio2_lo+2c)) - * - * Special cases: - * if x is NaN, return x itself; - * if |x|>1, return NaN with invalid signal. - * - */ - - -#include <float.h> -#include <math.h> -#include <math_private.h> -long double sqrtl (long double); - -static const long double - one = 1.0L, - huge = 1.0e+300L, - pio2_hi = 1.5707963267948966192313216916397514420986L, - pio2_lo = 4.3359050650618905123985220130216759843812E-35L, - pio4_hi = 7.8539816339744830961566084581987569936977E-1L, - - /* coefficient for R(x^2) */ - - /* asin(x) = x + x^3 pS(x^2) / qS(x^2) - 0 <= x <= 0.5 - peak relative error 1.9e-35 */ - pS0 = -8.358099012470680544198472400254596543711E2L, - pS1 = 3.674973957689619490312782828051860366493E3L, - pS2 = -6.730729094812979665807581609853656623219E3L, - pS3 = 6.643843795209060298375552684423454077633E3L, - pS4 = -3.817341990928606692235481812252049415993E3L, - pS5 = 1.284635388402653715636722822195716476156E3L, - pS6 = -2.410736125231549204856567737329112037867E2L, - pS7 = 2.219191969382402856557594215833622156220E1L, - pS8 = -7.249056260830627156600112195061001036533E-1L, - pS9 = 1.055923570937755300061509030361395604448E-3L, - - qS0 = -5.014859407482408326519083440151745519205E3L, - qS1 = 2.430653047950480068881028451580393430537E4L, - qS2 = -4.997904737193653607449250593976069726962E4L, - qS3 = 5.675712336110456923807959930107347511086E4L, - qS4 = -3.881523118339661268482937768522572588022E4L, - qS5 = 1.634202194895541569749717032234510811216E4L, - qS6 = -4.151452662440709301601820849901296953752E3L, - qS7 = 5.956050864057192019085175976175695342168E2L, - qS8 = -4.175375777334867025769346564600396877176E1L, - /* 1.000000000000000000000000000000000000000E0 */ - - /* asin(0.5625 + x) = asin(0.5625) + x rS(x) / sS(x) - -0.0625 <= x <= 0.0625 - peak relative error 3.3e-35 */ - rS0 = -5.619049346208901520945464704848780243887E0L, - rS1 = 4.460504162777731472539175700169871920352E1L, - rS2 = -1.317669505315409261479577040530751477488E2L, - rS3 = 1.626532582423661989632442410808596009227E2L, - rS4 = -3.144806644195158614904369445440583873264E1L, - rS5 = -9.806674443470740708765165604769099559553E1L, - rS6 = 5.708468492052010816555762842394927806920E1L, - rS7 = 1.396540499232262112248553357962639431922E1L, - rS8 = -1.126243289311910363001762058295832610344E1L, - rS9 = -4.956179821329901954211277873774472383512E-1L, - rS10 = 3.313227657082367169241333738391762525780E-1L, - - sS0 = -4.645814742084009935700221277307007679325E0L, - sS1 = 3.879074822457694323970438316317961918430E1L, - sS2 = -1.221986588013474694623973554726201001066E2L, - sS3 = 1.658821150347718105012079876756201905822E2L, - sS4 = -4.804379630977558197953176474426239748977E1L, - sS5 = -1.004296417397316948114344573811562952793E2L, - sS6 = 7.530281592861320234941101403870010111138E1L, - sS7 = 1.270735595411673647119592092304357226607E1L, - sS8 = -1.815144839646376500705105967064792930282E1L, - sS9 = -7.821597334910963922204235247786840828217E-2L, - /* 1.000000000000000000000000000000000000000E0 */ - - asinr5625 = 5.9740641664535021430381036628424864397707E-1L; - - - -long double -__ieee754_asinl (long double x) -{ - long double a, t, w, p, q, c, r, s; - int flag; - - if (__glibc_unlikely (isnan (x))) - return x + x; - flag = 0; - a = __builtin_fabsl (x); - if (a == 1.0L) /* |x|>= 1 */ - return x * pio2_hi + x * pio2_lo; /* asin(1)=+-pi/2 with inexact */ - else if (a >= 1.0L) - return (x - x) / (x - x); /* asin(|x|>1) is NaN */ - else if (a < 0.5L) - { - if (a < 6.938893903907228e-18L) /* |x| < 2**-57 */ - { - math_check_force_underflow (x); - long double force_inexact = huge + x; - math_force_eval (force_inexact); - return x; /* return x with inexact if x!=0 */ - } - else - { - t = x * x; - /* Mark to use pS, qS later on. */ - flag = 1; - } - } - else if (a < 0.625L) - { - t = a - 0.5625; - p = ((((((((((rS10 * t - + rS9) * t - + rS8) * t - + rS7) * t - + rS6) * t - + rS5) * t - + rS4) * t - + rS3) * t - + rS2) * t - + rS1) * t - + rS0) * t; - - q = ((((((((( t - + sS9) * t - + sS8) * t - + sS7) * t - + sS6) * t - + sS5) * t - + sS4) * t - + sS3) * t - + sS2) * t - + sS1) * t - + sS0; - t = asinr5625 + p / q; - if (x > 0.0L) - return t; - else - return -t; - } - else - { - /* 1 > |x| >= 0.625 */ - w = one - a; - t = w * 0.5; - } - - p = (((((((((pS9 * t - + pS8) * t - + pS7) * t - + pS6) * t - + pS5) * t - + pS4) * t - + pS3) * t - + pS2) * t - + pS1) * t - + pS0) * t; - - q = (((((((( t - + qS8) * t - + qS7) * t - + qS6) * t - + qS5) * t - + qS4) * t - + qS3) * t - + qS2) * t - + qS1) * t - + qS0; - - if (flag) /* 2^-57 < |x| < 0.5 */ - { - w = p / q; - return x + x * w; - } - - s = __ieee754_sqrtl (t); - if (a > 0.975L) - { - w = p / q; - t = pio2_hi - (2.0 * (s + s * w) - pio2_lo); - } - else - { - w = ldbl_high (s); - c = (t - w * w) / (s + w); - r = p / q; - p = 2.0 * s * r - (pio2_lo - 2.0 * c); - q = pio4_hi - 2.0 * w; - t = pio4_hi - (p - q); - } - - if (x > 0.0L) - return t; - else - return -t; -} -strong_alias (__ieee754_asinl, __asinl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c b/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c deleted file mode 100644 index b625323df3..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_atan2l.c +++ /dev/null @@ -1,122 +0,0 @@ -/* e_atan2l.c -- long double version of e_atan2.c. - * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* __ieee754_atan2l(y,x) - * Method : - * 1. Reduce y to positive by atan2l(y,x)=-atan2l(-y,x). - * 2. Reduce x to positive by (if x and y are unexceptional): - * ARG (x+iy) = arctan(y/x) ... if x > 0, - * ARG (x+iy) = pi - arctan[y/(-x)] ... if x < 0, - * - * Special cases: - * - * ATAN2((anything), NaN ) is NaN; - * ATAN2(NAN , (anything) ) is NaN; - * ATAN2(+-0, +(anything but NaN)) is +-0 ; - * ATAN2(+-0, -(anything but NaN)) is +-pi ; - * ATAN2(+-(anything but 0 and NaN), 0) is +-pi/2; - * ATAN2(+-(anything but INF and NaN), +INF) is +-0 ; - * ATAN2(+-(anything but INF and NaN), -INF) is +-pi; - * ATAN2(+-INF,+INF ) is +-pi/4 ; - * ATAN2(+-INF,-INF ) is +-3pi/4; - * ATAN2(+-INF, (anything but,0,NaN, and INF)) is +-pi/2; - * - * Constants: - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include <math.h> -#include <math_private.h> - -static const long double -tiny = 1.0e-300L, -zero = 0.0, -pi_o_4 = 7.85398163397448309615660845819875699e-01L, /* 3ffe921fb54442d18469898cc51701b8 */ -pi_o_2 = 1.57079632679489661923132169163975140e+00L, /* 3fff921fb54442d18469898cc51701b8 */ -pi = 3.14159265358979323846264338327950280e+00L, /* 4000921fb54442d18469898cc51701b8 */ -pi_lo = 8.67181013012378102479704402604335225e-35L; /* 3f8dcd129024e088a67cc74020bbea64 */ - -long double -__ieee754_atan2l(long double y, long double x) -{ - long double z; - int64_t k,m,hx,hy,ix,iy; - uint64_t lx; - double xhi, xlo, yhi; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - EXTRACT_WORDS64 (lx, xlo); - ix = hx&0x7fffffffffffffffLL; - yhi = ldbl_high (y); - EXTRACT_WORDS64 (hy, yhi); - iy = hy&0x7fffffffffffffffLL; - if(((ix)>0x7ff0000000000000LL)|| - ((iy)>0x7ff0000000000000LL)) /* x or y is NaN */ - return x+y; - if(((hx-0x3ff0000000000000LL))==0 - && (lx&0x7fffffffffffffff)==0) return __atanl(y); /* x=1.0L */ - m = ((hy>>63)&1)|((hx>>62)&2); /* 2*sign(x)+sign(y) */ - - /* when y = 0 */ - if(iy==0) { - switch(m) { - case 0: - case 1: return y; /* atan(+-0,+anything)=+-0 */ - case 2: return pi+tiny;/* atan(+0,-anything) = pi */ - case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */ - } - } - /* when x = 0 */ - if(ix==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; - - /* when x is INF */ - if(ix==0x7ff0000000000000LL) { - if(iy==0x7ff0000000000000LL) { - switch(m) { - case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */ - case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */ - case 2: return 3.0L*pi_o_4+tiny;/*atan(+INF,-INF)*/ - case 3: return -3.0L*pi_o_4-tiny;/*atan(-INF,-INF)*/ - } - } else { - switch(m) { - case 0: return zero ; /* atan(+...,+INF) */ - case 1: return -zero ; /* atan(-...,+INF) */ - case 2: return pi+tiny ; /* atan(+...,-INF) */ - case 3: return -pi-tiny ; /* atan(-...,-INF) */ - } - } - } - /* when y is INF */ - if(iy==0x7ff0000000000000LL) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; - - /* compute y/x */ - k = (iy-ix)>>52; - if(k > 120) z=pi_o_2+0.5L*pi_lo; /* |y/x| > 2**120 */ - else if(hx<0&&k<-120) z=0.0L; /* |y|/x < -2**120 */ - else z=__atanl(fabsl(y/x)); /* safe to do y/x */ - switch (m) { - case 0: return z ; /* atan(+,+) */ - case 1: return -z ; /* atan(-,+) */ - case 2: return pi-(z-pi_lo);/* atan(+,-) */ - default: /* case 3 */ - return (z-pi_lo)-pi;/* atan(-,-) */ - } -} -strong_alias (__ieee754_atan2l, __atan2l_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c b/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c deleted file mode 100644 index b576f42030..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_atanhl.c +++ /dev/null @@ -1,71 +0,0 @@ -/* @(#)e_atanh.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* __ieee754_atanh(x) - * Method : - * 1.Reduced x to positive by atanh(-x) = -atanh(x) - * 2.For x>=0.5 - * 1 2x x - * atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------) - * 2 1 - x 1 - x - * - * For x<0.5 - * atanh(x) = 0.5*log1p(2x+2x*x/(1-x)) - * - * Special cases: - * atanh(x) is NaN if |x| > 1 with signal; - * atanh(NaN) is that NaN with no signal; - * atanh(+-1) is +-INF with signal. - * - */ - -#include <float.h> -#include <math.h> -#include <math_private.h> - -static const long double one = 1.0L, huge = 1e300L; - -static const long double zero = 0.0L; - -long double -__ieee754_atanhl(long double x) -{ - long double t; - int64_t hx,ix; - double xhi; - - xhi = ldbl_high (x); - EXTRACT_WORDS64 (hx, xhi); - ix = hx&0x7fffffffffffffffLL; - if (ix >= 0x3ff0000000000000LL) { /* |x|>=1 */ - if (ix > 0x3ff0000000000000LL) - return (x-x)/(x-x); - t = fabsl (x); - if (t > one) - return (x-x)/(x-x); - if (t == one) - return x/zero; - } - if(ix<0x3c70000000000000LL&&(huge+x)>zero) /* x<2**-56 */ - { - math_check_force_underflow (x); - return x; - } - x = fabsl (x); - if(ix<0x3fe0000000000000LL) { /* x < 0.5 */ - t = x+x; - t = 0.5*__log1pl(t+t*x/(one-x)); - } else - t = 0.5*__log1pl((x+x)/(one-x)); - if(hx>=0) return t; else return -t; -} -strong_alias (__ieee754_atanhl, __atanhl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_coshl.c b/sysdeps/ieee754/ldbl-128ibm/e_coshl.c deleted file mode 100644 index 327b2ab960..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_coshl.c +++ /dev/null @@ -1,81 +0,0 @@ -/* @(#)e_cosh.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* __ieee754_cosh(x) - * Method : - * mathematically cosh(x) if defined to be (exp(x)+exp(-x))/2 - * 1. Replace x by |x| (cosh(x) = cosh(-x)). - * 2. - * [ exp(x) - 1 ]^2 - * 0 <= x <= ln2/2 : cosh(x) := 1 + ------------------- - * 2*exp(x) - * - * exp(x) + 1/exp(x) - * ln2/2 <= x <= 40 : cosh(x) := ------------------- - * 2 - * 40 <= x <= lnovft : cosh(x) := exp(x)/2 - * lnovft <= x <= ln2ovft: cosh(x) := exp(x/2)/2 * exp(x/2) - * ln2ovft < x : cosh(x) := huge*huge (overflow) - * - * Special cases: - * cosh(x) is |x| if x is +INF, -INF, or NaN. - * only cosh(0)=1 is exact for finite x. - */ - -#include <math.h> -#include <math_private.h> - -static const long double one = 1.0L, half=0.5L, huge = 1.0e300L; - -long double -__ieee754_coshl (long double x) -{ - long double t,w; - int64_t ix; - double xhi; - - /* High word of |x|. */ - xhi = ldbl_high (x); - EXTRACT_WORDS64 (ix, xhi); - ix &= 0x7fffffffffffffffLL; - - /* x is INF or NaN */ - if(ix>=0x7ff0000000000000LL) return x*x; - - /* |x| in [0,0.5*ln2], return 1+expm1(|x|)^2/(2*exp(|x|)) */ - if(ix<0x3fd62e42fefa39efLL) { - if (ix<0x3c80000000000000LL) return one; /* cosh(tiny) = 1 */ - t = __expm1l(fabsl(x)); - w = one+t; - return one+(t*t)/(w+w); - } - - /* |x| in [0.5*ln2,40], return (exp(|x|)+1/exp(|x|)/2; */ - if (ix < 0x4044000000000000LL) { - t = __ieee754_expl(fabsl(x)); - return half*t+half/t; - } - - /* |x| in [40, log(maxdouble)] return half*exp(|x|) */ - if (ix < 0x40862e42fefa39efLL) return half*__ieee754_expl(fabsl(x)); - - /* |x| in [log(maxdouble), overflowthresold] */ - if (ix < 0x408633ce8fb9f87fLL) { - w = __ieee754_expl(half*fabsl(x)); - t = half*w; - return t*w; - } - - /* |x| > overflowthresold, cosh(x) overflow */ - return huge*huge; -} -strong_alias (__ieee754_coshl, __coshl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c b/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c deleted file mode 100644 index 6c3b6f5589..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_exp10l.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright (C) 2012-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_private.h> -#include <float.h> - -static const long double log10_high = 0x2.4d763776aaap+0L; -static const long double log10_low = 0x2.b05ba95b58ae0b4c28a38a3fb4p-48L; - -long double -__ieee754_exp10l (long double arg) -{ - union ibm_extended_long_double u; - long double arg_high, arg_low; - long double exp_high, exp_low; - - if (!isfinite (arg)) - return __ieee754_expl (arg); - if (arg < LDBL_MIN_10_EXP - LDBL_DIG - 10) - return LDBL_MIN * LDBL_MIN; - else if (arg > LDBL_MAX_10_EXP + 1) - return LDBL_MAX * LDBL_MAX; - else if (fabsl (arg) < 0x1p-109L) - return 1.0L; - - u.ld = arg; - arg_high = u.d[0].d; - arg_low = u.d[1].d; - exp_high = arg_high * log10_high; - exp_low = arg_high * log10_low + arg_low * M_LN10l; - return __ieee754_expl (exp_high) * __ieee754_expl (exp_low); -} -strong_alias (__ieee754_exp10l, __exp10l_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_expl.c b/sysdeps/ieee754/ldbl-128ibm/e_expl.c deleted file mode 100644 index 10df6bb7d5..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_expl.c +++ /dev/null @@ -1,256 +0,0 @@ -/* Quad-precision floating point e^x. - Copyright (C) 1999-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek <jj@ultra.linux.cz> - Partly based on double-precision code - by Geoffrey Keating <geoffk@ozemail.com.au> - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* The basic design here is from - Abraham Ziv, "Fast Evaluation of Elementary Mathematical Functions with - Correctly Rounded Last Bit", ACM Trans. Math. Soft., 17 (3), September 1991, - pp. 410-423. - - We work with number pairs where the first number is the high part and - the second one is the low part. Arithmetic with the high part numbers must - be exact, without any roundoff errors. - - The input value, X, is written as - X = n * ln(2)_0 + arg1[t1]_0 + arg2[t2]_0 + x - - n * ln(2)_1 + arg1[t1]_1 + arg2[t2]_1 + xl - - where: - - n is an integer, 16384 >= n >= -16495; - - ln(2)_0 is the first 93 bits of ln(2), and |ln(2)_0-ln(2)-ln(2)_1| < 2^-205 - - t1 is an integer, 89 >= t1 >= -89 - - t2 is an integer, 65 >= t2 >= -65 - - |arg1[t1]-t1/256.0| < 2^-53 - - |arg2[t2]-t2/32768.0| < 2^-53 - - x + xl is whatever is left, |x + xl| < 2^-16 + 2^-53 - - Then e^x is approximated as - - e^x = 2^n_1 ( 2^n_0 e^(arg1[t1]_0 + arg1[t1]_1) e^(arg2[t2]_0 + arg2[t2]_1) - + 2^n_0 e^(arg1[t1]_0 + arg1[t1]_1) e^(arg2[t2]_0 + arg2[t2]_1) - * p (x + xl + n * ln(2)_1)) - where: - - p(x) is a polynomial approximating e(x)-1 - - e^(arg1[t1]_0 + arg1[t1]_1) is obtained from a table - - e^(arg2[t2]_0 + arg2[t2]_1) likewise - - n_1 + n_0 = n, so that |n_0| < -LDBL_MIN_EXP-1. - - If it happens that n_1 == 0 (this is the usual case), that multiplication - is omitted. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -#include <float.h> -#include <ieee754.h> -#include <math.h> -#include <fenv.h> -#include <inttypes.h> -#include <math_private.h> - -#define _Float128 long double -#define L(x) x ## L - -#include <sysdeps/ieee754/ldbl-128/t_expl.h> - -static const long double C[] = { -/* Smallest integer x for which e^x overflows. */ -#define himark C[0] - 709.78271289338399678773454114191496482L, - -/* Largest integer x for which e^x underflows. */ -#define lomark C[1] --744.44007192138126231410729844608163411L, - -/* 3x2^96 */ -#define THREEp96 C[2] - 59421121885698253195157962752.0L, - -/* 3x2^103 */ -#define THREEp103 C[3] - 30423614405477505635920876929024.0L, - -/* 3x2^111 */ -#define THREEp111 C[4] - 7788445287802241442795744493830144.0L, - -/* 1/ln(2) */ -#define M_1_LN2 C[5] - 1.44269504088896340735992468100189204L, - -/* first 93 bits of ln(2) */ -#define M_LN2_0 C[6] - 0.693147180559945309417232121457981864L, - -/* ln2_0 - ln(2) */ -#define M_LN2_1 C[7] --1.94704509238074995158795957333327386E-31L, - -/* very small number */ -#define TINY C[8] - 1.0e-308L, - -/* 2^16383 */ -#define TWO1023 C[9] - 8.988465674311579538646525953945123668E+307L, - -/* 256 */ -#define TWO8 C[10] - 256.0L, - -/* 32768 */ -#define TWO15 C[11] - 32768.0L, - -/* Chebyshev polynom coefficients for (exp(x)-1)/x */ -#define P1 C[12] -#define P2 C[13] -#define P3 C[14] -#define P4 C[15] -#define P5 C[16] -#define P6 C[17] - 0.5L, - 1.66666666666666666666666666666666683E-01L, - 4.16666666666666666666654902320001674E-02L, - 8.33333333333333333333314659767198461E-03L, - 1.38888888889899438565058018857254025E-03L, - 1.98412698413981650382436541785404286E-04L, -}; - -long double -__ieee754_expl (long double x) -{ - long double result, x22; - union ibm_extended_long_double ex2_u, scale_u; - int unsafe; - - /* Check for usual case. */ - if (isless (x, himark) && isgreater (x, lomark)) - { - int tval1, tval2, n_i, exponent2; - long double n, xl; - - SET_RESTORE_ROUND (FE_TONEAREST); - - n = __roundl (x*M_1_LN2); - x = x-n*M_LN2_0; - xl = n*M_LN2_1; - - tval1 = __roundl (x*TWO8); - x -= __expl_table[T_EXPL_ARG1+2*tval1]; - xl -= __expl_table[T_EXPL_ARG1+2*tval1+1]; - - tval2 = __roundl (x*TWO15); - x -= __expl_table[T_EXPL_ARG2+2*tval2]; - xl -= __expl_table[T_EXPL_ARG2+2*tval2+1]; - - x = x + xl; - - /* Compute ex2 = 2^n_0 e^(argtable[tval1]) e^(argtable[tval2]). */ - ex2_u.ld = (__expl_table[T_EXPL_RES1 + tval1] - * __expl_table[T_EXPL_RES2 + tval2]); - n_i = (int)n; - /* 'unsafe' is 1 iff n_1 != 0. */ - unsafe = fabsl(n_i) >= -LDBL_MIN_EXP - 1; - ex2_u.d[0].ieee.exponent += n_i >> unsafe; - /* Fortunately, there are no subnormal lowpart doubles in - __expl_table, only normal values and zeros. - But after scaling it can be subnormal. */ - exponent2 = ex2_u.d[1].ieee.exponent + (n_i >> unsafe); - if (ex2_u.d[1].ieee.exponent == 0) - /* assert ((ex2_u.d[1].ieee.mantissa0|ex2_u.d[1].ieee.mantissa1) == 0) */; - else if (exponent2 > 0) - ex2_u.d[1].ieee.exponent = exponent2; - else if (exponent2 <= -54) - { - ex2_u.d[1].ieee.exponent = 0; - ex2_u.d[1].ieee.mantissa0 = 0; - ex2_u.d[1].ieee.mantissa1 = 0; - } - else - { - static const double - two54 = 1.80143985094819840000e+16, /* 4350000000000000 */ - twom54 = 5.55111512312578270212e-17; /* 3C90000000000000 */ - ex2_u.d[1].d *= two54; - ex2_u.d[1].ieee.exponent += n_i >> unsafe; - ex2_u.d[1].d *= twom54; - } - - /* Compute scale = 2^n_1. */ - scale_u.ld = 1.0L; - scale_u.d[0].ieee.exponent += n_i - (n_i >> unsafe); - - /* Approximate e^x2 - 1, using a seventh-degree polynomial, - with maximum error in [-2^-16-2^-53,2^-16+2^-53] - less than 4.8e-39. */ - x22 = x + x*x*(P1+x*(P2+x*(P3+x*(P4+x*(P5+x*P6))))); - - /* Now we can test whether the result is ultimate or if we are unsure. - In the later case we should probably call a mpn based routine to give - the ultimate result. - Empirically, this routine is already ultimate in about 99.9986% of - cases, the test below for the round to nearest case will be false - in ~ 99.9963% of cases. - Without proc2 routine maximum error which has been seen is - 0.5000262 ulp. - - union ieee854_long_double ex3_u; - - #ifdef FE_TONEAREST - fesetround (FE_TONEAREST); - #endif - ex3_u.d = (result - ex2_u.d) - x22 * ex2_u.d; - ex2_u.d = result; - ex3_u.ieee.exponent += LDBL_MANT_DIG + 15 + IEEE854_LONG_DOUBLE_BIAS - - ex2_u.ieee.exponent; - n_i = abs (ex3_u.d); - n_i = (n_i + 1) / 2; - fesetenv (&oldenv); - #ifdef FE_TONEAREST - if (fegetround () == FE_TONEAREST) - n_i -= 0x4000; - #endif - if (!n_i) { - return __ieee754_expl_proc2 (origx); - } - */ - } - /* Exceptional cases: */ - else if (isless (x, himark)) - { - if (isinf (x)) - /* e^-inf == 0, with no error. */ - return 0; - else - /* Underflow */ - return TINY * TINY; - } - else - /* Return x, if x is a NaN or Inf; or overflow, otherwise. */ - return TWO1023*x; - - result = x22 * ex2_u.ld + ex2_u.ld; - if (!unsafe) - return result; - return result * scale_u.ld; -} -strong_alias (__ieee754_expl, __expl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c b/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c deleted file mode 100644 index 5284fd0fd5..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_fmodl.c +++ /dev/null @@ -1,149 +0,0 @@ -/* e_fmodl.c -- long double version of e_fmod.c. - * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* - * __ieee754_fmodl(x,y) - * Return x mod y in exact arithmetic - * Method: shift and subtract - */ - -#include <math.h> -#include <math_private.h> -#include <ieee754.h> - -static const long double one = 1.0, Zero[] = {0.0, -0.0,}; - -long double -__ieee754_fmodl (long double x, long double y) -{ - int64_t hx, hy, hz, sx, sy; - uint64_t lx, ly, lz; - int n, ix, iy; - double xhi, xlo, yhi, ylo; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - EXTRACT_WORDS64 (lx, xlo); - ldbl_unpack (y, &yhi, &ylo); - EXTRACT_WORDS64 (hy, yhi); - EXTRACT_WORDS64 (ly, ylo); - sx = hx&0x8000000000000000ULL; /* sign of x */ - hx ^= sx; /* |x| */ - sy = hy&0x8000000000000000ULL; /* sign of y */ - hy ^= sy; /* |y| */ - - /* purge off exception values */ - if(__builtin_expect(hy==0 || - (hx>=0x7ff0000000000000LL)|| /* y=0,or x not finite */ - (hy>0x7ff0000000000000LL),0)) /* or y is NaN */ - return (x*y)/(x*y); - if (__glibc_unlikely (hx <= hy)) - { - /* If |x| < |y| return x. */ - if (hx < hy) - return x; - /* At this point the absolute value of the high doubles of - x and y must be equal. */ - if ((lx & 0x7fffffffffffffffLL) == 0 - && (ly & 0x7fffffffffffffffLL) == 0) - /* Both low parts are zero. The result should be an - appropriately signed zero, but the subsequent logic - could treat them as unequal, depending on the signs - of the low parts. */ - return Zero[(uint64_t) sx >> 63]; - /* If the low double of y is the same sign as the high - double of y (ie. the low double increases |y|)... */ - if (((ly ^ sy) & 0x8000000000000000LL) == 0 - /* ... then a different sign low double to high double - for x or same sign but lower magnitude... */ - && (int64_t) (lx ^ sx) < (int64_t) (ly ^ sy)) - /* ... means |x| < |y|. */ - return x; - /* If the low double of x differs in sign to the high - double of x (ie. the low double decreases |x|)... */ - if (((lx ^ sx) & 0x8000000000000000LL) != 0 - /* ... then a different sign low double to high double - for y with lower magnitude (we've already caught - the same sign for y case above)... */ - && (int64_t) (lx ^ sx) > (int64_t) (ly ^ sy)) - /* ... means |x| < |y|. */ - return x; - /* If |x| == |y| return x*0. */ - if ((lx ^ sx) == (ly ^ sy)) - return Zero[(uint64_t) sx >> 63]; - } - - /* Make the IBM extended format 105 bit mantissa look like the ieee854 112 - bit mantissa so the following operations will give the correct - result. */ - ldbl_extract_mantissa(&hx, &lx, &ix, x); - ldbl_extract_mantissa(&hy, &ly, &iy, y); - - if (__glibc_unlikely (ix == -IEEE754_DOUBLE_BIAS)) - { - /* subnormal x, shift x to normal. */ - while ((hx & (1LL << 48)) == 0) - { - hx = (hx << 1) | (lx >> 63); - lx = lx << 1; - ix -= 1; - } - } - - if (__glibc_unlikely (iy == -IEEE754_DOUBLE_BIAS)) - { - /* subnormal y, shift y to normal. */ - while ((hy & (1LL << 48)) == 0) - { - hy = (hy << 1) | (ly >> 63); - ly = ly << 1; - iy -= 1; - } - } - - /* fix point fmod */ - n = ix - iy; - while(n--) { - hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1; - if(hz<0){hx = hx+hx+(lx>>63); lx = lx+lx;} - else { - if((hz|lz)==0) /* return sign(x)*0 */ - return Zero[(u_int64_t)sx>>63]; - hx = hz+hz+(lz>>63); lx = lz+lz; - } - } - hz=hx-hy;lz=lx-ly; if(lx<ly) hz -= 1; - if(hz>=0) {hx=hz;lx=lz;} - - /* convert back to floating value and restore the sign */ - if((hx|lx)==0) /* return sign(x)*0 */ - return Zero[(u_int64_t)sx>>63]; - while(hx<0x0001000000000000LL) { /* normalize x */ - hx = hx+hx+(lx>>63); lx = lx+lx; - iy -= 1; - } - if(__builtin_expect(iy>= -1022,0)) { /* normalize output */ - x = ldbl_insert_mantissa((sx>>63), iy, hx, lx); - } else { /* subnormal output */ - n = -1022 - iy; - /* We know 1 <= N <= 52, and that there are no nonzero - bits in places below 2^-1074. */ - lx = (lx >> n) | ((u_int64_t) hx << (64 - n)); - hx >>= n; - x = ldbl_insert_mantissa((sx>>63), -1023, hx, lx); - x *= one; /* create necessary signal */ - } - return x; /* exact output */ -} -strong_alias (__ieee754_fmodl, __fmodl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c b/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c deleted file mode 100644 index 81dbe42c79..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_gammal_r.c +++ /dev/null @@ -1,218 +0,0 @@ -/* Implementation of gamma function according to ISO C. - Copyright (C) 1997-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and - Jakub Jelinek <jj@ultra.linux.cz, 1999. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_private.h> -#include <float.h> - -/* Coefficients B_2k / 2k(2k-1) of x^-(2k-1) inside exp in Stirling's - approximation to gamma function. */ - -static const long double gamma_coeff[] = - { - 0x1.555555555555555555555555558p-4L, - -0xb.60b60b60b60b60b60b60b60b6p-12L, - 0x3.4034034034034034034034034p-12L, - -0x2.7027027027027027027027027p-12L, - 0x3.72a3c5631fe46ae1d4e700dca9p-12L, - -0x7.daac36664f1f207daac36664f2p-12L, - 0x1.a41a41a41a41a41a41a41a41a4p-8L, - -0x7.90a1b2c3d4e5f708192a3b4c5ep-8L, - 0x2.dfd2c703c0cfff430edfd2c704p-4L, - -0x1.6476701181f39edbdb9ce625988p+0L, - 0xd.672219167002d3a7a9c886459cp+0L, - -0x9.cd9292e6660d55b3f712eb9e08p+4L, - 0x8.911a740da740da740da740da74p+8L, - }; - -#define NCOEFF (sizeof (gamma_coeff) / sizeof (gamma_coeff[0])) - -/* Return gamma (X), for positive X less than 191, in the form R * - 2^(*EXP2_ADJ), where R is the return value and *EXP2_ADJ is set to - avoid overflow or underflow in intermediate calculations. */ - -static long double -gammal_positive (long double x, int *exp2_adj) -{ - int local_signgam; - if (x < 0.5L) - { - *exp2_adj = 0; - return __ieee754_expl (__ieee754_lgammal_r (x + 1, &local_signgam)) / x; - } - else if (x <= 1.5L) - { - *exp2_adj = 0; - return __ieee754_expl (__ieee754_lgammal_r (x, &local_signgam)); - } - else if (x < 11.5L) - { - /* Adjust into the range for using exp (lgamma). */ - *exp2_adj = 0; - long double n = __ceill (x - 1.5L); - long double x_adj = x - n; - long double eps; - long double prod = __gamma_productl (x_adj, 0, n, &eps); - return (__ieee754_expl (__ieee754_lgammal_r (x_adj, &local_signgam)) - * prod * (1.0L + eps)); - } - else - { - long double eps = 0; - long double x_eps = 0; - long double x_adj = x; - long double prod = 1; - if (x < 23.0L) - { - /* Adjust into the range for applying Stirling's - approximation. */ - long double n = __ceill (23.0L - x); - x_adj = x + n; - x_eps = (x - (x_adj - n)); - prod = __gamma_productl (x_adj - n, x_eps, n, &eps); - } - /* The result is now gamma (X_ADJ + X_EPS) / (PROD * (1 + EPS)). - Compute gamma (X_ADJ + X_EPS) using Stirling's approximation, - starting by computing pow (X_ADJ, X_ADJ) with a power of 2 - factored out. */ - long double exp_adj = -eps; - long double x_adj_int = __roundl (x_adj); - long double x_adj_frac = x_adj - x_adj_int; - int x_adj_log2; - long double x_adj_mant = __frexpl (x_adj, &x_adj_log2); - if (x_adj_mant < M_SQRT1_2l) - { - x_adj_log2--; - x_adj_mant *= 2.0L; - } - *exp2_adj = x_adj_log2 * (int) x_adj_int; - long double ret = (__ieee754_powl (x_adj_mant, x_adj) - * __ieee754_exp2l (x_adj_log2 * x_adj_frac) - * __ieee754_expl (-x_adj) - * __ieee754_sqrtl (2 * M_PIl / x_adj) - / prod); - exp_adj += x_eps * __ieee754_logl (x_adj); - long double bsum = gamma_coeff[NCOEFF - 1]; - long double x_adj2 = x_adj * x_adj; - for (size_t i = 1; i <= NCOEFF - 1; i++) - bsum = bsum / x_adj2 + gamma_coeff[NCOEFF - 1 - i]; - exp_adj += bsum / x_adj; - return ret + ret * __expm1l (exp_adj); - } -} - -long double -__ieee754_gammal_r (long double x, int *signgamp) -{ - int64_t hx; - double xhi; - long double ret; - - xhi = ldbl_high (x); - EXTRACT_WORDS64 (hx, xhi); - - if ((hx & 0x7fffffffffffffffLL) == 0) - { - /* Return value for x == 0 is Inf with divide by zero exception. */ - *signgamp = 0; - return 1.0 / x; - } - if (hx < 0 && (u_int64_t) hx < 0xfff0000000000000ULL && __rintl (x) == x) - { - /* Return value for integer x < 0 is NaN with invalid exception. */ - *signgamp = 0; - return (x - x) / (x - x); - } - if (hx == 0xfff0000000000000ULL) - { - /* x == -Inf. According to ISO this is NaN. */ - *signgamp = 0; - return x - x; - } - if ((hx & 0x7ff0000000000000ULL) == 0x7ff0000000000000ULL) - { - /* Positive infinity (return positive infinity) or NaN (return - NaN). */ - *signgamp = 0; - return x + x; - } - - if (x >= 172.0L) - { - /* Overflow. */ - *signgamp = 0; - return LDBL_MAX * LDBL_MAX; - } - else - { - SET_RESTORE_ROUNDL (FE_TONEAREST); - if (x > 0.0L) - { - *signgamp = 0; - int exp2_adj; - ret = gammal_positive (x, &exp2_adj); - ret = __scalbnl (ret, exp2_adj); - } - else if (x >= -0x1p-110L) - { - *signgamp = 0; - ret = 1.0L / x; - } - else - { - long double tx = __truncl (x); - *signgamp = (tx == 2.0L * __truncl (tx / 2.0L)) ? -1 : 1; - if (x <= -191.0L) - /* Underflow. */ - ret = LDBL_MIN * LDBL_MIN; - else - { - long double frac = tx - x; - if (frac > 0.5L) - frac = 1.0L - frac; - long double sinpix = (frac <= 0.25L - ? __sinl (M_PIl * frac) - : __cosl (M_PIl * (0.5L - frac))); - int exp2_adj; - ret = M_PIl / (-x * sinpix - * gammal_positive (-x, &exp2_adj)); - ret = __scalbnl (ret, -exp2_adj); - math_check_force_underflow_nonneg (ret); - } - } - } - if (isinf (ret) && x != 0) - { - if (*signgamp < 0) - return -(-__copysignl (LDBL_MAX, ret) * LDBL_MAX); - else - return __copysignl (LDBL_MAX, ret) * LDBL_MAX; - } - else if (ret == 0) - { - if (*signgamp < 0) - return -(-__copysignl (LDBL_MIN, ret) * LDBL_MIN); - else - return __copysignl (LDBL_MIN, ret) * LDBL_MIN; - } - else - return ret; -} -strong_alias (__ieee754_gammal_r, __gammal_r_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c b/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c deleted file mode 100644 index de5a66ab05..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_hypotl.c +++ /dev/null @@ -1,138 +0,0 @@ -/* @(#)e_hypotl.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* __ieee754_hypotl(x,y) - * - * Method : - * If (assume round-to-nearest) z=x*x+y*y - * has error less than sqrtl(2)/2 ulp, than - * sqrtl(z) has error less than 1 ulp (exercise). - * - * So, compute sqrtl(x*x+y*y) with some care as - * follows to get the error below 1 ulp: - * - * Assume x>y>0; - * (if possible, set rounding to round-to-nearest) - * 1. if x > 2y use - * x1*x1+(y*y+(x2*(x+x1))) for x*x+y*y - * where x1 = x with lower 53 bits cleared, x2 = x-x1; else - * 2. if x <= 2y use - * t1*y1+((x-y)*(x-y)+(t1*y2+t2*y)) - * where t1 = 2x with lower 53 bits cleared, t2 = 2x-t1, - * y1= y with lower 53 bits chopped, y2 = y-y1. - * - * NOTE: scaling may be necessary if some argument is too - * large or too tiny - * - * Special cases: - * hypotl(x,y) is INF if x or y is +INF or -INF; else - * hypotl(x,y) is NAN if x or y is NAN. - * - * Accuracy: - * hypotl(x,y) returns sqrtl(x^2+y^2) with error less - * than 1 ulps (units in the last place) - */ - -#include <math.h> -#include <math_private.h> - -long double -__ieee754_hypotl(long double x, long double y) -{ - long double a,b,a1,a2,b1,b2,w,kld; - int64_t j,k,ha,hb; - double xhi, yhi, hi, lo; - - xhi = ldbl_high (x); - EXTRACT_WORDS64 (ha, xhi); - yhi = ldbl_high (y); - EXTRACT_WORDS64 (hb, yhi); - ha &= 0x7fffffffffffffffLL; - hb &= 0x7fffffffffffffffLL; - if(hb > ha) {a=y;b=x;j=ha; ha=hb;hb=j;} else {a=x;b=y;} - a = fabsl(a); /* a <- |a| */ - b = fabsl(b); /* b <- |b| */ - if((ha-hb)>0x0780000000000000LL) {return a+b;} /* x/y > 2**120 */ - k=0; - kld = 1.0L; - if(ha > 0x5f30000000000000LL) { /* a>2**500 */ - if(ha >= 0x7ff0000000000000LL) { /* Inf or NaN */ - w = a+b; /* for sNaN */ - if (issignaling (a) || issignaling (b)) - return w; - if(ha == 0x7ff0000000000000LL) - w = a; - if(hb == 0x7ff0000000000000LL) - w = b; - return w; - } - /* scale a and b by 2**-600 */ - a *= 0x1p-600L; - b *= 0x1p-600L; - k = 600; - kld = 0x1p+600L; - } - else if(hb < 0x23d0000000000000LL) { /* b < 2**-450 */ - if(hb <= 0x000fffffffffffffLL) { /* subnormal b or 0 */ - if(hb==0) return a; - a *= 0x1p+1022L; - b *= 0x1p+1022L; - k = -1022; - kld = 0x1p-1022L; - } else { /* scale a and b by 2^600 */ - a *= 0x1p+600L; - b *= 0x1p+600L; - k = -600; - kld = 0x1p-600L; - } - } - /* medium size a and b */ - w = a-b; - if (w>b) { - ldbl_unpack (a, &hi, &lo); - a1 = hi; - a2 = lo; - /* a*a + b*b - = (a1+a2)*a + b*b - = a1*a + a2*a + b*b - = a1*(a1+a2) + a2*a + b*b - = a1*a1 + a1*a2 + a2*a + b*b - = a1*a1 + a2*(a+a1) + b*b */ - w = __ieee754_sqrtl(a1*a1-(b*(-b)-a2*(a+a1))); - } else { - a = a+a; - ldbl_unpack (b, &hi, &lo); - b1 = hi; - b2 = lo; - ldbl_unpack (a, &hi, &lo); - a1 = hi; - a2 = lo; - /* a*a + b*b - = a*a + (a-b)*(a-b) - (a-b)*(a-b) + b*b - = a*a + w*w - (a*a - 2*a*b + b*b) + b*b - = w*w + 2*a*b - = w*w + (a1+a2)*b - = w*w + a1*b + a2*b - = w*w + a1*(b1+b2) + a2*b - = w*w + a1*b1 + a1*b2 + a2*b */ - w = __ieee754_sqrtl(a1*b1-(w*(-w)-(a1*b2+a2*b))); - } - if(k!=0) - { - w *= kld; - math_check_force_underflow_nonneg (w); - return w; - } - else - return w; -} -strong_alias (__ieee754_hypotl, __hypotl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c b/sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c deleted file mode 100644 index 4088238f30..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_ilogbl.c +++ /dev/null @@ -1,70 +0,0 @@ -/* s_ilogbl.c -- long double version of s_ilogb.c. - * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* ilogbl(long double x) - * return the binary exponent of non-zero x - * ilogbl(0) = FP_ILOGB0 - * ilogbl(NaN) = FP_ILOGBNAN (no signal is raised) - * ilogbl(+-Inf) = INT_MAX (no signal is raised) - */ - -#include <limits.h> -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -int __ieee754_ilogbl(long double x) -{ - int64_t hx, hxs; - int ix; - double xhi, xlo; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - hxs = hx; - hx &= 0x7fffffffffffffffLL; - if(hx <= 0x0010000000000000LL) { - if(hx==0) - return FP_ILOGB0; /* ilogbl(0) = FP_ILOGB0 */ - else /* subnormal x */ - for (ix = -1022, hx<<=11; hx>0; hx<<=1) ix -=1; - return ix; - } - else if (hx < 0x7ff0000000000000LL) - { - int hexp = (hx >> 52) - 0x3ff; - /* If the high part is a power of 2, and the low part is - nonzero with the opposite sign, the low part affects - the exponent. */ - if ((hx & 0x000fffffffffffffLL) == 0) - { - int64_t lx; - EXTRACT_WORDS64 (lx, xlo); - if ((hxs ^ lx) < 0 && (lx & 0x7fffffffffffffffLL) != 0) - hexp--; - } - return hexp; - } - else if (FP_ILOGBNAN != INT_MAX) { - /* ISO C99 requires ilogbl(+-Inf) == INT_MAX. */ - if (hx==0x7ff0000000000000LL) - return INT_MAX; - } - return FP_ILOGBNAN; -} diff --git a/sysdeps/ieee754/ldbl-128ibm/e_j0l.c b/sysdeps/ieee754/ldbl-128ibm/e_j0l.c deleted file mode 100644 index 00bce29284..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_j0l.c +++ /dev/null @@ -1,5 +0,0 @@ -/* Looks like we can use ieee854 e_j0l.c as is for IBM extended format. */ -#define _Float128 long double -#define L(x) x ## L -#include <sysdeps/ieee754/ldbl-128/e_j0l.c> - diff --git a/sysdeps/ieee754/ldbl-128ibm/e_j1l.c b/sysdeps/ieee754/ldbl-128ibm/e_j1l.c deleted file mode 100644 index da9fd9eeca..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_j1l.c +++ /dev/null @@ -1,4 +0,0 @@ -/* Looks like we can use ieee854 e_j1l.c as is for IBM extended format. */ -#define _Float128 long double -#define L(x) x ## L -#include <sysdeps/ieee754/ldbl-128/e_j1l.c> diff --git a/sysdeps/ieee754/ldbl-128ibm/e_jnl.c b/sysdeps/ieee754/ldbl-128ibm/e_jnl.c deleted file mode 100644 index 4a8ccb044e..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_jnl.c +++ /dev/null @@ -1,421 +0,0 @@ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* Modifications for 128-bit long double are - Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author - reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under - the following terms: - - This 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. - - This 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 this library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* - * __ieee754_jn(n, x), __ieee754_yn(n, x) - * floating point Bessel's function of the 1st and 2nd kind - * of order n - * - * Special cases: - * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal; - * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal. - * Note 2. About jn(n,x), yn(n,x) - * For n=0, j0(x) is called, - * for n=1, j1(x) is called, - * for n<x, forward recursion us used starting - * from values of j0(x) and j1(x). - * for n>x, a continued fraction approximation to - * j(n,x)/j(n-1,x) is evaluated and then backward - * recursion is used starting from a supposed value - * for j(n,x). The resulting value of j(0,x) is - * compared with the actual value to correct the - * supposed value of j(n,x). - * - * yn(n,x) is similar in all respects, except - * that forward recursion is used for all - * values of n>1. - * - */ - -#include <errno.h> -#include <float.h> -#include <math.h> -#include <math_private.h> - -static const long double - invsqrtpi = 5.6418958354775628694807945156077258584405E-1L, - two = 2.0e0L, - one = 1.0e0L, - zero = 0.0L; - - -long double -__ieee754_jnl (int n, long double x) -{ - uint32_t se, lx; - int32_t i, ix, sgn; - long double a, b, temp, di, ret; - long double z, w; - double xhi; - - - /* J(-n,x) = (-1)^n * J(n, x), J(n, -x) = (-1)^n * J(n, x) - * Thus, J(-n,x) = J(n,-x) - */ - - xhi = ldbl_high (x); - EXTRACT_WORDS (se, lx, xhi); - ix = se & 0x7fffffff; - - /* if J(n,NaN) is NaN */ - if (ix >= 0x7ff00000) - { - if (((ix - 0x7ff00000) | lx) != 0) - return x + x; - } - - if (n < 0) - { - n = -n; - x = -x; - se ^= 0x80000000; - } - if (n == 0) - return (__ieee754_j0l (x)); - if (n == 1) - return (__ieee754_j1l (x)); - sgn = (n & 1) & (se >> 31); /* even n -- 0, odd n -- sign(x) */ - x = fabsl (x); - - { - SET_RESTORE_ROUNDL (FE_TONEAREST); - if (x == 0.0L || ix >= 0x7ff00000) /* if x is 0 or inf */ - return sgn == 1 ? -zero : zero; - else if ((long double) n <= x) - { - /* Safe to use J(n+1,x)=2n/x *J(n,x)-J(n-1,x) */ - if (ix >= 0x52d00000) - { /* x > 2**302 */ - - /* ??? Could use an expansion for large x here. */ - - /* (x >> n**2) - * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Let s=sin(x), c=cos(x), - * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then - * - * n sin(xn)*sqt2 cos(xn)*sqt2 - * ---------------------------------- - * 0 s-c c+s - * 1 -s-c -c+s - * 2 -s+c -c-s - * 3 s+c c-s - */ - long double s; - long double c; - __sincosl (x, &s, &c); - switch (n & 3) - { - case 0: - temp = c + s; - break; - case 1: - temp = -c + s; - break; - case 2: - temp = -c - s; - break; - case 3: - temp = c - s; - break; - } - b = invsqrtpi * temp / __ieee754_sqrtl (x); - } - else - { - a = __ieee754_j0l (x); - b = __ieee754_j1l (x); - for (i = 1; i < n; i++) - { - temp = b; - b = b * ((long double) (i + i) / x) - a; /* avoid underflow */ - a = temp; - } - } - } - else - { - if (ix < 0x3e100000) - { /* x < 2**-29 */ - /* x is tiny, return the first Taylor expansion of J(n,x) - * J(n,x) = 1/n!*(x/2)^n - ... - */ - if (n >= 33) /* underflow, result < 10^-300 */ - b = zero; - else - { - temp = x * 0.5; - b = temp; - for (a = one, i = 2; i <= n; i++) - { - a *= (long double) i; /* a = n! */ - b *= temp; /* b = (x/2)^n */ - } - b = b / a; - } - } - else - { - /* use backward recurrence */ - /* x x^2 x^2 - * J(n,x)/J(n-1,x) = ---- ------ ------ ..... - * 2n - 2(n+1) - 2(n+2) - * - * 1 1 1 - * (for large x) = ---- ------ ------ ..... - * 2n 2(n+1) 2(n+2) - * -- - ------ - ------ - - * x x x - * - * Let w = 2n/x and h=2/x, then the above quotient - * is equal to the continued fraction: - * 1 - * = ----------------------- - * 1 - * w - ----------------- - * 1 - * w+h - --------- - * w+2h - ... - * - * To determine how many terms needed, let - * Q(0) = w, Q(1) = w(w+h) - 1, - * Q(k) = (w+k*h)*Q(k-1) - Q(k-2), - * When Q(k) > 1e4 good for single - * When Q(k) > 1e9 good for double - * When Q(k) > 1e17 good for quadruple - */ - /* determine k */ - long double t, v; - long double q0, q1, h, tmp; - int32_t k, m; - w = (n + n) / (long double) x; - h = 2.0L / (long double) x; - q0 = w; - z = w + h; - q1 = w * z - 1.0L; - k = 1; - while (q1 < 1.0e17L) - { - k += 1; - z += h; - tmp = z * q1 - q0; - q0 = q1; - q1 = tmp; - } - m = n + n; - for (t = zero, i = 2 * (n + k); i >= m; i -= 2) - t = one / (i / x - t); - a = t; - b = one; - /* estimate log((2/x)^n*n!) = n*log(2/x)+n*ln(n) - * Hence, if n*(log(2n/x)) > ... - * single 8.8722839355e+01 - * double 7.09782712893383973096e+02 - * long double 1.1356523406294143949491931077970765006170e+04 - * then recurrent value may overflow and the result is - * likely underflow to zero - */ - tmp = n; - v = two / x; - tmp = tmp * __ieee754_logl (fabsl (v * tmp)); - - if (tmp < 1.1356523406294143949491931077970765006170e+04L) - { - for (i = n - 1, di = (long double) (i + i); i > 0; i--) - { - temp = b; - b *= di; - b = b / x - a; - a = temp; - di -= two; - } - } - else - { - for (i = n - 1, di = (long double) (i + i); i > 0; i--) - { - temp = b; - b *= di; - b = b / x - a; - a = temp; - di -= two; - /* scale b to avoid spurious overflow */ - if (b > 1e100L) - { - a /= b; - t /= b; - b = one; - } - } - } - /* j0() and j1() suffer enormous loss of precision at and - * near zero; however, we know that their zero points never - * coincide, so just choose the one further away from zero. - */ - z = __ieee754_j0l (x); - w = __ieee754_j1l (x); - if (fabsl (z) >= fabsl (w)) - b = (t * z / b); - else - b = (t * w / a); - } - } - if (sgn == 1) - ret = -b; - else - ret = b; - } - if (ret == 0) - { - ret = __copysignl (LDBL_MIN, ret) * LDBL_MIN; - __set_errno (ERANGE); - } - else - math_check_force_underflow (ret); - return ret; -} -strong_alias (__ieee754_jnl, __jnl_finite) - -long double -__ieee754_ynl (int n, long double x) -{ - uint32_t se, lx; - int32_t i, ix; - int32_t sign; - long double a, b, temp, ret; - double xhi; - - xhi = ldbl_high (x); - EXTRACT_WORDS (se, lx, xhi); - ix = se & 0x7fffffff; - - /* if Y(n,NaN) is NaN */ - if (ix >= 0x7ff00000) - { - if (((ix - 0x7ff00000) | lx) != 0) - return x + x; - } - if (x <= 0.0L) - { - if (x == 0.0L) - return ((n < 0 && (n & 1) != 0) ? 1.0L : -1.0L) / 0.0L; - if (se & 0x80000000) - return zero / (zero * x); - } - sign = 1; - if (n < 0) - { - n = -n; - sign = 1 - ((n & 1) << 1); - } - if (n == 0) - return (__ieee754_y0l (x)); - { - SET_RESTORE_ROUNDL (FE_TONEAREST); - if (n == 1) - { - ret = sign * __ieee754_y1l (x); - goto out; - } - if (ix >= 0x7ff00000) - return zero; - if (ix >= 0x52D00000) - { /* x > 2**302 */ - - /* ??? See comment above on the possible futility of this. */ - - /* (x >> n**2) - * Jn(x) = cos(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Yn(x) = sin(x-(2n+1)*pi/4)*sqrt(2/x*pi) - * Let s=sin(x), c=cos(x), - * xn=x-(2n+1)*pi/4, sqt2 = sqrt(2),then - * - * n sin(xn)*sqt2 cos(xn)*sqt2 - * ---------------------------------- - * 0 s-c c+s - * 1 -s-c -c+s - * 2 -s+c -c-s - * 3 s+c c-s - */ - long double s; - long double c; - __sincosl (x, &s, &c); - switch (n & 3) - { - case 0: - temp = s - c; - break; - case 1: - temp = -s - c; - break; - case 2: - temp = -s + c; - break; - case 3: - temp = s + c; - break; - } - b = invsqrtpi * temp / __ieee754_sqrtl (x); - } - else - { - a = __ieee754_y0l (x); - b = __ieee754_y1l (x); - /* quit if b is -inf */ - xhi = ldbl_high (b); - GET_HIGH_WORD (se, xhi); - se &= 0xfff00000; - for (i = 1; i < n && se != 0xfff00000; i++) - { - temp = b; - b = ((long double) (i + i) / x) * b - a; - xhi = ldbl_high (b); - GET_HIGH_WORD (se, xhi); - se &= 0xfff00000; - a = temp; - } - } - /* If B is +-Inf, set up errno accordingly. */ - if (! isfinite (b)) - __set_errno (ERANGE); - if (sign > 0) - ret = b; - else - ret = -b; - } - out: - if (isinf (ret)) - ret = __copysignl (LDBL_MAX, ret) * LDBL_MAX; - return ret; -} -strong_alias (__ieee754_ynl, __ynl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c b/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c deleted file mode 100644 index 8ac8283bd8..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_lgammal_r.c +++ /dev/null @@ -1,5 +0,0 @@ -/* Looks like we can use ieee854 e_lgammal_r.c as is for IBM extended format. */ -#define _Float128 long double -#define L(x) x ## L -#include <sysdeps/ieee754/ldbl-128/e_lgammal_r.c> - diff --git a/sysdeps/ieee754/ldbl-128ibm/e_log10l.c b/sysdeps/ieee754/ldbl-128ibm/e_log10l.c deleted file mode 100644 index 1fbfa48e13..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_log10l.c +++ /dev/null @@ -1,261 +0,0 @@ -/* log10l.c - * - * Common logarithm, 128-bit long double precision - * - * - * - * SYNOPSIS: - * - * long double x, y, log10l(); - * - * y = log10l( x ); - * - * - * - * DESCRIPTION: - * - * Returns the base 10 logarithm of x. - * - * The argument is separated into its exponent and fractional - * parts. If the exponent is between -1 and +1, the logarithm - * of the fraction is approximated by - * - * log(1+x) = x - 0.5 x^2 + x^3 P(x)/Q(x). - * - * Otherwise, setting z = 2(x-1)/x+1), - * - * log(x) = z + z^3 P(z)/Q(z). - * - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE 0.5, 2.0 30000 2.3e-34 4.9e-35 - * IEEE exp(+-10000) 30000 1.0e-34 4.1e-35 - * - * In the tests over the interval exp(+-10000), the logarithms - * of the random arguments were uniformly distributed over - * [-10000, +10000]. - * - */ - -/* - Cephes Math Library Release 2.2: January, 1991 - Copyright 1984, 1991 by Stephen L. Moshier - Adapted for glibc November, 2001 - - This 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. - - This 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 this library; if not, see <http://www.gnu.org/licenses/>. - */ - -#include <math.h> -#include <math_private.h> - -/* Coefficients for ln(1+x) = x - x**2/2 + x**3 P(x)/Q(x) - * 1/sqrt(2) <= x < sqrt(2) - * Theoretical peak relative error = 5.3e-37, - * relative peak error spread = 2.3e-14 - */ -static const long double P[13] = -{ - 1.313572404063446165910279910527789794488E4L, - 7.771154681358524243729929227226708890930E4L, - 2.014652742082537582487669938141683759923E5L, - 3.007007295140399532324943111654767187848E5L, - 2.854829159639697837788887080758954924001E5L, - 1.797628303815655343403735250238293741397E5L, - 7.594356839258970405033155585486712125861E4L, - 2.128857716871515081352991964243375186031E4L, - 3.824952356185897735160588078446136783779E3L, - 4.114517881637811823002128927449878962058E2L, - 2.321125933898420063925789532045674660756E1L, - 4.998469661968096229986658302195402690910E-1L, - 1.538612243596254322971797716843006400388E-6L -}; -static const long double Q[12] = -{ - 3.940717212190338497730839731583397586124E4L, - 2.626900195321832660448791748036714883242E5L, - 7.777690340007566932935753241556479363645E5L, - 1.347518538384329112529391120390701166528E6L, - 1.514882452993549494932585972882995548426E6L, - 1.158019977462989115839826904108208787040E6L, - 6.132189329546557743179177159925690841200E5L, - 2.248234257620569139969141618556349415120E5L, - 5.605842085972455027590989944010492125825E4L, - 9.147150349299596453976674231612674085381E3L, - 9.104928120962988414618126155557301584078E2L, - 4.839208193348159620282142911143429644326E1L -/* 1.000000000000000000000000000000000000000E0L, */ -}; - -/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2), - * where z = 2(x-1)/(x+1) - * 1/sqrt(2) <= x < sqrt(2) - * Theoretical peak relative error = 1.1e-35, - * relative peak error spread 1.1e-9 - */ -static const long double R[6] = -{ - 1.418134209872192732479751274970992665513E5L, - -8.977257995689735303686582344659576526998E4L, - 2.048819892795278657810231591630928516206E4L, - -2.024301798136027039250415126250455056397E3L, - 8.057002716646055371965756206836056074715E1L, - -8.828896441624934385266096344596648080902E-1L -}; -static const long double S[6] = -{ - 1.701761051846631278975701529965589676574E6L, - -1.332535117259762928288745111081235577029E6L, - 4.001557694070773974936904547424676279307E5L, - -5.748542087379434595104154610899551484314E4L, - 3.998526750980007367835804959888064681098E3L, - -1.186359407982897997337150403816839480438E2L -/* 1.000000000000000000000000000000000000000E0L, */ -}; - -static const long double -/* log10(2) */ -L102A = 0.3125L, -L102B = -1.14700043360188047862611052755069732318101185E-2L, -/* log10(e) */ -L10EA = 0.5L, -L10EB = -6.570551809674817234887108108339491770560299E-2L, -/* sqrt(2)/2 */ -SQRTH = 7.071067811865475244008443621048490392848359E-1L; - - - -/* Evaluate P[n] x^n + P[n-1] x^(n-1) + ... + P[0] */ - -static long double -neval (long double x, const long double *p, int n) -{ - long double y; - - p += n; - y = *p--; - do - { - y = y * x + *p--; - } - while (--n > 0); - return y; -} - - -/* Evaluate x^n+1 + P[n] x^(n) + P[n-1] x^(n-1) + ... + P[0] */ - -static long double -deval (long double x, const long double *p, int n) -{ - long double y; - - p += n; - y = x + *p--; - do - { - y = y * x + *p--; - } - while (--n > 0); - return y; -} - - - -long double -__ieee754_log10l (long double x) -{ - long double z; - long double y; - int e; - int64_t hx; - double xhi; - -/* Test for domain */ - xhi = ldbl_high (x); - EXTRACT_WORDS64 (hx, xhi); - if ((hx & 0x7fffffffffffffffLL) == 0) - return (-1.0L / __fabsl (x)); /* log10l(+-0)=-inf */ - if (hx < 0) - return (x - x) / (x - x); - if (hx >= 0x7ff0000000000000LL) - return (x + x); - - if (x == 1.0L) - return 0.0L; - -/* separate mantissa from exponent */ - -/* Note, frexp is used so that denormal numbers - * will be handled properly. - */ - x = __frexpl (x, &e); - - -/* logarithm using log(x) = z + z**3 P(z)/Q(z), - * where z = 2(x-1)/x+1) - */ - if ((e > 2) || (e < -2)) - { - if (x < SQRTH) - { /* 2( 2x-1 )/( 2x+1 ) */ - e -= 1; - z = x - 0.5L; - y = 0.5L * z + 0.5L; - } - else - { /* 2 (x-1)/(x+1) */ - z = x - 0.5L; - z -= 0.5L; - y = 0.5L * x + 0.5L; - } - x = z / y; - z = x * x; - y = x * (z * neval (z, R, 5) / deval (z, S, 5)); - goto done; - } - - -/* logarithm using log(1+x) = x - .5x**2 + x**3 P(x)/Q(x) */ - - if (x < SQRTH) - { - e -= 1; - x = 2.0 * x - 1.0L; /* 2x - 1 */ - } - else - { - x = x - 1.0L; - } - z = x * x; - y = x * (z * neval (x, P, 12) / deval (x, Q, 11)); - y = y - 0.5 * z; - -done: - - /* Multiply log of fraction by log10(e) - * and base 2 exponent by log10(2). - */ - z = y * L10EB; - z += x * L10EB; - z += e * L102B; - z += y * L10EA; - z += x * L10EA; - z += e * L102A; - return (z); -} -strong_alias (__ieee754_log10l, __log10l_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_log2l.c b/sysdeps/ieee754/ldbl-128ibm/e_log2l.c deleted file mode 100644 index c820dacf08..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_log2l.c +++ /dev/null @@ -1,254 +0,0 @@ -/* log2l.c - * Base 2 logarithm, 128-bit long double precision - * - * - * - * SYNOPSIS: - * - * long double x, y, log2l(); - * - * y = log2l( x ); - * - * - * - * DESCRIPTION: - * - * Returns the base 2 logarithm of x. - * - * The argument is separated into its exponent and fractional - * parts. If the exponent is between -1 and +1, the (natural) - * logarithm of the fraction is approximated by - * - * log(1+x) = x - 0.5 x^2 + x^3 P(x)/Q(x). - * - * Otherwise, setting z = 2(x-1)/x+1), - * - * log(x) = z + z^3 P(z)/Q(z). - * - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE 0.5, 2.0 100,000 2.6e-34 4.9e-35 - * IEEE exp(+-10000) 100,000 9.6e-35 4.0e-35 - * - * In the tests over the interval exp(+-10000), the logarithms - * of the random arguments were uniformly distributed over - * [-10000, +10000]. - * - */ - -/* - Cephes Math Library Release 2.2: January, 1991 - Copyright 1984, 1991 by Stephen L. Moshier - Adapted for glibc November, 2001 - - This 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. - - This 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 this library; if not, see <http://www.gnu.org/licenses/>. - */ - -#include <math.h> -#include <math_private.h> - -/* Coefficients for ln(1+x) = x - x**2/2 + x**3 P(x)/Q(x) - * 1/sqrt(2) <= x < sqrt(2) - * Theoretical peak relative error = 5.3e-37, - * relative peak error spread = 2.3e-14 - */ -static const long double P[13] = -{ - 1.313572404063446165910279910527789794488E4L, - 7.771154681358524243729929227226708890930E4L, - 2.014652742082537582487669938141683759923E5L, - 3.007007295140399532324943111654767187848E5L, - 2.854829159639697837788887080758954924001E5L, - 1.797628303815655343403735250238293741397E5L, - 7.594356839258970405033155585486712125861E4L, - 2.128857716871515081352991964243375186031E4L, - 3.824952356185897735160588078446136783779E3L, - 4.114517881637811823002128927449878962058E2L, - 2.321125933898420063925789532045674660756E1L, - 4.998469661968096229986658302195402690910E-1L, - 1.538612243596254322971797716843006400388E-6L -}; -static const long double Q[12] = -{ - 3.940717212190338497730839731583397586124E4L, - 2.626900195321832660448791748036714883242E5L, - 7.777690340007566932935753241556479363645E5L, - 1.347518538384329112529391120390701166528E6L, - 1.514882452993549494932585972882995548426E6L, - 1.158019977462989115839826904108208787040E6L, - 6.132189329546557743179177159925690841200E5L, - 2.248234257620569139969141618556349415120E5L, - 5.605842085972455027590989944010492125825E4L, - 9.147150349299596453976674231612674085381E3L, - 9.104928120962988414618126155557301584078E2L, - 4.839208193348159620282142911143429644326E1L -/* 1.000000000000000000000000000000000000000E0L, */ -}; - -/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2), - * where z = 2(x-1)/(x+1) - * 1/sqrt(2) <= x < sqrt(2) - * Theoretical peak relative error = 1.1e-35, - * relative peak error spread 1.1e-9 - */ -static const long double R[6] = -{ - 1.418134209872192732479751274970992665513E5L, - -8.977257995689735303686582344659576526998E4L, - 2.048819892795278657810231591630928516206E4L, - -2.024301798136027039250415126250455056397E3L, - 8.057002716646055371965756206836056074715E1L, - -8.828896441624934385266096344596648080902E-1L -}; -static const long double S[6] = -{ - 1.701761051846631278975701529965589676574E6L, - -1.332535117259762928288745111081235577029E6L, - 4.001557694070773974936904547424676279307E5L, - -5.748542087379434595104154610899551484314E4L, - 3.998526750980007367835804959888064681098E3L, - -1.186359407982897997337150403816839480438E2L -/* 1.000000000000000000000000000000000000000E0L, */ -}; - -static const long double -/* log2(e) - 1 */ -LOG2EA = 4.4269504088896340735992468100189213742664595E-1L, -/* sqrt(2)/2 */ -SQRTH = 7.071067811865475244008443621048490392848359E-1L; - - -/* Evaluate P[n] x^n + P[n-1] x^(n-1) + ... + P[0] */ - -static long double -neval (long double x, const long double *p, int n) -{ - long double y; - - p += n; - y = *p--; - do - { - y = y * x + *p--; - } - while (--n > 0); - return y; -} - - -/* Evaluate x^n+1 + P[n] x^(n) + P[n-1] x^(n-1) + ... + P[0] */ - -static long double -deval (long double x, const long double *p, int n) -{ - long double y; - - p += n; - y = x + *p--; - do - { - y = y * x + *p--; - } - while (--n > 0); - return y; -} - - - -long double -__ieee754_log2l (long double x) -{ - long double z; - long double y; - int e; - int64_t hx; - double xhi; - -/* Test for domain */ - xhi = ldbl_high (x); - EXTRACT_WORDS64 (hx, xhi); - if ((hx & 0x7fffffffffffffffLL) == 0) - return (-1.0L / __fabsl (x)); /* log2l(+-0)=-inf */ - if (hx < 0) - return (x - x) / (x - x); - if (hx >= 0x7ff0000000000000LL) - return (x + x); - - if (x == 1.0L) - return 0.0L; - -/* separate mantissa from exponent */ - -/* Note, frexp is used so that denormal numbers - * will be handled properly. - */ - x = __frexpl (x, &e); - - -/* logarithm using log(x) = z + z**3 P(z)/Q(z), - * where z = 2(x-1)/x+1) - */ - if ((e > 2) || (e < -2)) - { - if (x < SQRTH) - { /* 2( 2x-1 )/( 2x+1 ) */ - e -= 1; - z = x - 0.5L; - y = 0.5L * z + 0.5L; - } - else - { /* 2 (x-1)/(x+1) */ - z = x - 0.5L; - z -= 0.5L; - y = 0.5L * x + 0.5L; - } - x = z / y; - z = x * x; - y = x * (z * neval (z, R, 5) / deval (z, S, 5)); - goto done; - } - - -/* logarithm using log(1+x) = x - .5x**2 + x**3 P(x)/Q(x) */ - - if (x < SQRTH) - { - e -= 1; - x = 2.0 * x - 1.0L; /* 2x - 1 */ - } - else - { - x = x - 1.0L; - } - z = x * x; - y = x * (z * neval (x, P, 12) / deval (x, Q, 11)); - y = y - 0.5 * z; - -done: - -/* Multiply log of fraction by log2(e) - * and base 2 exponent by 1 - */ - z = y * LOG2EA; - z += x * LOG2EA; - z += y; - z += x; - z += e; - return (z); -} -strong_alias (__ieee754_log2l, __log2l_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_logl.c b/sysdeps/ieee754/ldbl-128ibm/e_logl.c deleted file mode 100644 index c44feca65b..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_logl.c +++ /dev/null @@ -1,300 +0,0 @@ -/* logll.c - * - * Natural logarithm for 128-bit long double precision. - * - * - * - * SYNOPSIS: - * - * long double x, y, logl(); - * - * y = logl( x ); - * - * - * - * DESCRIPTION: - * - * Returns the base e (2.718...) logarithm of x. - * - * The argument is separated into its exponent and fractional - * parts. Use of a lookup table increases the speed of the routine. - * The program uses logarithms tabulated at intervals of 1/128 to - * cover the domain from approximately 0.7 to 1.4. - * - * On the interval [-1/128, +1/128] the logarithm of 1+x is approximated by - * log(1+x) = x - 0.5 x^2 + x^3 P(x) . - * - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE 0.875, 1.125 100000 1.2e-34 4.1e-35 - * IEEE 0.125, 8 100000 1.2e-34 4.1e-35 - * - * - * WARNING: - * - * This program uses integer operations on bit fields of floating-point - * numbers. It does not work with data structures other than the - * structure assumed. - * - */ - -/* Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov> - - This 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. - - This 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 this library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_private.h> - -/* log(1+x) = x - .5 x^2 + x^3 l(x) - -.0078125 <= x <= +.0078125 - peak relative error 1.2e-37 */ -static const long double -l3 = 3.333333333333333333333333333333336096926E-1L, -l4 = -2.499999999999999999999999999486853077002E-1L, -l5 = 1.999999999999999999999999998515277861905E-1L, -l6 = -1.666666666666666666666798448356171665678E-1L, -l7 = 1.428571428571428571428808945895490721564E-1L, -l8 = -1.249999999999999987884655626377588149000E-1L, -l9 = 1.111111111111111093947834982832456459186E-1L, -l10 = -1.000000000000532974938900317952530453248E-1L, -l11 = 9.090909090915566247008015301349979892689E-2L, -l12 = -8.333333211818065121250921925397567745734E-2L, -l13 = 7.692307559897661630807048686258659316091E-2L, -l14 = -7.144242754190814657241902218399056829264E-2L, -l15 = 6.668057591071739754844678883223432347481E-2L; - -/* Lookup table of ln(t) - (t-1) - t = 0.5 + (k+26)/128) - k = 0, ..., 91 */ -static const long double logtbl[92] = { --5.5345593589352099112142921677820359632418E-2L, --5.2108257402767124761784665198737642086148E-2L, --4.8991686870576856279407775480686721935120E-2L, --4.5993270766361228596215288742353061431071E-2L, --4.3110481649613269682442058976885699556950E-2L, --4.0340872319076331310838085093194799765520E-2L, --3.7682072451780927439219005993827431503510E-2L, --3.5131785416234343803903228503274262719586E-2L, --3.2687785249045246292687241862699949178831E-2L, --3.0347913785027239068190798397055267411813E-2L, --2.8110077931525797884641940838507561326298E-2L, --2.5972247078357715036426583294246819637618E-2L, --2.3932450635346084858612873953407168217307E-2L, --2.1988775689981395152022535153795155900240E-2L, --2.0139364778244501615441044267387667496733E-2L, --1.8382413762093794819267536615342902718324E-2L, --1.6716169807550022358923589720001638093023E-2L, --1.5138929457710992616226033183958974965355E-2L, --1.3649036795397472900424896523305726435029E-2L, --1.2244881690473465543308397998034325468152E-2L, --1.0924898127200937840689817557742469105693E-2L, --9.6875626072830301572839422532631079809328E-3L, --8.5313926245226231463436209313499745894157E-3L, --7.4549452072765973384933565912143044991706E-3L, --6.4568155251217050991200599386801665681310E-3L, --5.5356355563671005131126851708522185605193E-3L, --4.6900728132525199028885749289712348829878E-3L, --3.9188291218610470766469347968659624282519E-3L, --3.2206394539524058873423550293617843896540E-3L, --2.5942708080877805657374888909297113032132E-3L, --2.0385211375711716729239156839929281289086E-3L, --1.5522183228760777967376942769773768850872E-3L, --1.1342191863606077520036253234446621373191E-3L, --7.8340854719967065861624024730268350459991E-4L, --4.9869831458030115699628274852562992756174E-4L, --2.7902661731604211834685052867305795169688E-4L, --1.2335696813916860754951146082826952093496E-4L, --3.0677461025892873184042490943581654591817E-5L, -#define ZERO logtbl[38] - 0.0000000000000000000000000000000000000000E0L, --3.0359557945051052537099938863236321874198E-5L, --1.2081346403474584914595395755316412213151E-4L, --2.7044071846562177120083903771008342059094E-4L, --4.7834133324631162897179240322783590830326E-4L, --7.4363569786340080624467487620270965403695E-4L, --1.0654639687057968333207323853366578860679E-3L, --1.4429854811877171341298062134712230604279E-3L, --1.8753781835651574193938679595797367137975E-3L, --2.3618380914922506054347222273705859653658E-3L, --2.9015787624124743013946600163375853631299E-3L, --3.4938307889254087318399313316921940859043E-3L, --4.1378413103128673800485306215154712148146E-3L, --4.8328735414488877044289435125365629849599E-3L, --5.5782063183564351739381962360253116934243E-3L, --6.3731336597098858051938306767880719015261E-3L, --7.2169643436165454612058905294782949315193E-3L, --8.1090214990427641365934846191367315083867E-3L, --9.0486422112807274112838713105168375482480E-3L, --1.0035177140880864314674126398350812606841E-2L, --1.1067990155502102718064936259435676477423E-2L, --1.2146457974158024928196575103115488672416E-2L, --1.3269969823361415906628825374158424754308E-2L, --1.4437927104692837124388550722759686270765E-2L, --1.5649743073340777659901053944852735064621E-2L, --1.6904842527181702880599758489058031645317E-2L, --1.8202661505988007336096407340750378994209E-2L, --1.9542647000370545390701192438691126552961E-2L, --2.0924256670080119637427928803038530924742E-2L, --2.2346958571309108496179613803760727786257E-2L, --2.3810230892650362330447187267648486279460E-2L, --2.5313561699385640380910474255652501521033E-2L, --2.6856448685790244233704909690165496625399E-2L, --2.8438398935154170008519274953860128449036E-2L, --3.0058928687233090922411781058956589863039E-2L, --3.1717563112854831855692484086486099896614E-2L, --3.3413836095418743219397234253475252001090E-2L, --3.5147290019036555862676702093393332533702E-2L, --3.6917475563073933027920505457688955423688E-2L, --3.8723951502862058660874073462456610731178E-2L, --4.0566284516358241168330505467000838017425E-2L, --4.2444048996543693813649967076598766917965E-2L, --4.4356826869355401653098777649745233339196E-2L, --4.6304207416957323121106944474331029996141E-2L, --4.8285787106164123613318093945035804818364E-2L, --5.0301169421838218987124461766244507342648E-2L, --5.2349964705088137924875459464622098310997E-2L, --5.4431789996103111613753440311680967840214E-2L, --5.6546268881465384189752786409400404404794E-2L, --5.8693031345788023909329239565012647817664E-2L, --6.0871713627532018185577188079210189048340E-2L, --6.3081958078862169742820420185833800925568E-2L, --6.5323413029406789694910800219643791556918E-2L, --6.7595732653791419081537811574227049288168E-2L -}; - -/* ln(2) = ln2a + ln2b with extended precision. */ -static const long double - ln2a = 6.93145751953125e-1L, - ln2b = 1.4286068203094172321214581765680755001344E-6L; - -static const long double - ldbl_epsilon = 0x1p-106L; - -long double -__ieee754_logl(long double x) -{ - long double z, y, w, t; - unsigned int m; - int k, e; - double xhi; - uint32_t hx, lx; - - xhi = ldbl_high (x); - EXTRACT_WORDS (hx, lx, xhi); - m = hx; - - /* Check for IEEE special cases. */ - k = m & 0x7fffffff; - /* log(0) = -infinity. */ - if ((k | lx) == 0) - { - return -0.5L / ZERO; - } - /* log ( x < 0 ) = NaN */ - if (m & 0x80000000) - { - return (x - x) / ZERO; - } - /* log (infinity or NaN) */ - if (k >= 0x7ff00000) - { - return x + x; - } - - /* On this interval the table is not used due to cancellation error. */ - if ((x <= 1.0078125L) && (x >= 0.9921875L)) - { - if (x == 1.0L) - return 0.0L; - z = x - 1.0L; - k = 64; - t = 1.0L; - e = 0; - } - else - { - /* Extract exponent and reduce domain to 0.703125 <= u < 1.40625 */ - unsigned int w0; - e = (int) (m >> 20) - (int) 0x3fe; - if (e == -1022) - { - x *= 0x1p106L; - xhi = ldbl_high (x); - EXTRACT_WORDS (hx, lx, xhi); - m = hx; - e = (int) (m >> 20) - (int) 0x3fe - 106; - } - m &= 0xfffff; - w0 = m | 0x3fe00000; - m |= 0x100000; - /* Find lookup table index k from high order bits of the significand. */ - if (m < 0x168000) - { - k = (m - 0xff000) >> 13; - /* t is the argument 0.5 + (k+26)/128 - of the nearest item to u in the lookup table. */ - INSERT_WORDS (xhi, 0x3ff00000 + (k << 13), 0); - t = xhi; - w0 += 0x100000; - e -= 1; - k += 64; - } - else - { - k = (m - 0xfe000) >> 14; - INSERT_WORDS (xhi, 0x3fe00000 + (k << 14), 0); - t = xhi; - } - x = __scalbnl (x, ((int) ((w0 - hx) * 2)) >> 21); - /* log(u) = log( t u/t ) = log(t) + log(u/t) - log(t) is tabulated in the lookup table. - Express log(u/t) = log(1+z), where z = u/t - 1 = (u-t)/t. - cf. Cody & Waite. */ - z = (x - t) / t; - } - /* Series expansion of log(1+z). */ - w = z * z; - /* Avoid spurious underflows. */ - if (__glibc_unlikely (fabsl (z) <= ldbl_epsilon)) - y = 0.0L; - else - { - y = ((((((((((((l15 * z - + l14) * z - + l13) * z - + l12) * z - + l11) * z - + l10) * z - + l9) * z - + l8) * z - + l7) * z - + l6) * z - + l5) * z - + l4) * z - + l3) * z * w; - y -= 0.5 * w; - } - y += e * ln2b; /* Base 2 exponent offset times ln(2). */ - y += z; - y += logtbl[k-26]; /* log(t) - (t-1) */ - y += (t - 1.0L); - y += e * ln2a; - return y; -} -strong_alias (__ieee754_logl, __logl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_powl.c b/sysdeps/ieee754/ldbl-128ibm/e_powl.c deleted file mode 100644 index d6fbef6997..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_powl.c +++ /dev/null @@ -1,415 +0,0 @@ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* Expansions and modifications for 128-bit long double are - Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author - reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under - the following terms: - - This 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. - - This 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 this library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* __ieee754_powl(x,y) return x**y - * - * n - * Method: Let x = 2 * (1+f) - * 1. Compute and return log2(x) in two pieces: - * log2(x) = w1 + w2, - * where w1 has 113-53 = 60 bit trailing zeros. - * 2. Perform y*log2(x) = n+y' by simulating muti-precision - * arithmetic, where |y'|<=0.5. - * 3. Return x**y = 2**n*exp(y'*log2) - * - * Special cases: - * 1. (anything) ** 0 is 1 - * 2. (anything) ** 1 is itself - * 3. (anything) ** NAN is NAN - * 4. NAN ** (anything except 0) is NAN - * 5. +-(|x| > 1) ** +INF is +INF - * 6. +-(|x| > 1) ** -INF is +0 - * 7. +-(|x| < 1) ** +INF is +0 - * 8. +-(|x| < 1) ** -INF is +INF - * 9. +-1 ** +-INF is NAN - * 10. +0 ** (+anything except 0, NAN) is +0 - * 11. -0 ** (+anything except 0, NAN, odd integer) is +0 - * 12. +0 ** (-anything except 0, NAN) is +INF - * 13. -0 ** (-anything except 0, NAN, odd integer) is +INF - * 14. -0 ** (odd integer) = -( +0 ** (odd integer) ) - * 15. +INF ** (+anything except 0,NAN) is +INF - * 16. +INF ** (-anything except 0,NAN) is +0 - * 17. -INF ** (anything) = -0 ** (-anything) - * 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) - * 19. (-anything except 0 and inf) ** (non-integer) is NAN - * - */ - -#include <math.h> -#include <math_private.h> - -static const long double bp[] = { - 1.0L, - 1.5L, -}; - -/* log_2(1.5) */ -static const long double dp_h[] = { - 0.0, - 5.8496250072115607565592654282227158546448E-1L -}; - -/* Low part of log_2(1.5) */ -static const long double dp_l[] = { - 0.0, - 1.0579781240112554492329533686862998106046E-16L -}; - -static const long double zero = 0.0L, - one = 1.0L, - two = 2.0L, - two113 = 1.0384593717069655257060992658440192E34L, - huge = 1.0e300L, - tiny = 1.0e-300L; - -/* 3/2 log x = 3 z + z^3 + z^3 (z^2 R(z^2)) - z = (x-1)/(x+1) - 1 <= x <= 1.25 - Peak relative error 2.3e-37 */ -static const long double LN[] = -{ - -3.0779177200290054398792536829702930623200E1L, - 6.5135778082209159921251824580292116201640E1L, - -4.6312921812152436921591152809994014413540E1L, - 1.2510208195629420304615674658258363295208E1L, - -9.9266909031921425609179910128531667336670E-1L -}; -static const long double LD[] = -{ - -5.129862866715009066465422805058933131960E1L, - 1.452015077564081884387441590064272782044E2L, - -1.524043275549860505277434040464085593165E2L, - 7.236063513651544224319663428634139768808E1L, - -1.494198912340228235853027849917095580053E1L - /* 1.0E0 */ -}; - -/* exp(x) = 1 + x - x / (1 - 2 / (x - x^2 R(x^2))) - 0 <= x <= 0.5 - Peak relative error 5.7e-38 */ -static const long double PN[] = -{ - 5.081801691915377692446852383385968225675E8L, - 9.360895299872484512023336636427675327355E6L, - 4.213701282274196030811629773097579432957E4L, - 5.201006511142748908655720086041570288182E1L, - 9.088368420359444263703202925095675982530E-3L, -}; -static const long double PD[] = -{ - 3.049081015149226615468111430031590411682E9L, - 1.069833887183886839966085436512368982758E8L, - 8.259257717868875207333991924545445705394E5L, - 1.872583833284143212651746812884298360922E3L, - /* 1.0E0 */ -}; - -static const long double - /* ln 2 */ - lg2 = 6.9314718055994530941723212145817656807550E-1L, - lg2_h = 6.9314718055994528622676398299518041312695E-1L, - lg2_l = 2.3190468138462996154948554638754786504121E-17L, - ovt = 8.0085662595372944372e-0017L, - /* 2/(3*log(2)) */ - cp = 9.6179669392597560490661645400126142495110E-1L, - cp_h = 9.6179669392597555432899980587535537779331E-1L, - cp_l = 5.0577616648125906047157785230014751039424E-17L; - -long double -__ieee754_powl (long double x, long double y) -{ - long double z, ax, z_h, z_l, p_h, p_l; - long double y1, t1, t2, r, s, sgn, t, u, v, w; - long double s2, s_h, s_l, t_h, t_l, ay; - int32_t i, j, k, yisint, n; - uint32_t ix, iy; - int32_t hx, hy, hax; - double ohi, xhi, xlo, yhi, ylo; - uint32_t lx, ly, lj; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS (hx, lx, xhi); - ix = hx & 0x7fffffff; - - ldbl_unpack (y, &yhi, &ylo); - EXTRACT_WORDS (hy, ly, yhi); - iy = hy & 0x7fffffff; - - /* y==zero: x**0 = 1 */ - if ((iy | ly) == 0 && !issignaling (x)) - return one; - - /* 1.0**y = 1; -1.0**+-Inf = 1 */ - if (x == one && !issignaling (y)) - return one; - if (x == -1.0L && ((iy - 0x7ff00000) | ly) == 0) - return one; - - /* +-NaN return x+y */ - if ((ix >= 0x7ff00000 && ((ix - 0x7ff00000) | lx) != 0) - || (iy >= 0x7ff00000 && ((iy - 0x7ff00000) | ly) != 0)) - return x + y; - - /* determine if y is an odd int when x < 0 - * yisint = 0 ... y is not an integer - * yisint = 1 ... y is an odd int - * yisint = 2 ... y is an even int - */ - yisint = 0; - if (hx < 0) - { - uint32_t low_ye; - - GET_HIGH_WORD (low_ye, ylo); - if ((low_ye & 0x7fffffff) >= 0x43400000) /* Low part >= 2^53 */ - yisint = 2; /* even integer y */ - else if (iy >= 0x3ff00000) /* 1.0 */ - { - if (__floorl (y) == y) - { - z = 0.5 * y; - if (__floorl (z) == z) - yisint = 2; - else - yisint = 1; - } - } - } - - ax = fabsl (x); - - /* special value of y */ - if (ly == 0) - { - if (iy == 0x7ff00000) /* y is +-inf */ - { - if (ax > one) - /* (|x|>1)**+-inf = inf,0 */ - return (hy >= 0) ? y : zero; - else - /* (|x|<1)**-,+inf = inf,0 */ - return (hy < 0) ? -y : zero; - } - if (ylo == 0.0) - { - if (iy == 0x3ff00000) - { /* y is +-1 */ - if (hy < 0) - return one / x; - else - return x; - } - if (hy == 0x40000000) - return x * x; /* y is 2 */ - if (hy == 0x3fe00000) - { /* y is 0.5 */ - if (hx >= 0) /* x >= +0 */ - return __ieee754_sqrtl (x); - } - } - } - - /* special value of x */ - if (lx == 0) - { - if (ix == 0x7ff00000 || ix == 0 || (ix == 0x3ff00000 && xlo == 0.0)) - { - z = ax; /*x is +-0,+-inf,+-1 */ - if (hy < 0) - z = one / z; /* z = (1/|x|) */ - if (hx < 0) - { - if (((ix - 0x3ff00000) | yisint) == 0) - { - z = (z - z) / (z - z); /* (-1)**non-int is NaN */ - } - else if (yisint == 1) - z = -z; /* (x<0)**odd = -(|x|**odd) */ - } - return z; - } - } - - /* (x<0)**(non-int) is NaN */ - if (((((u_int32_t) hx >> 31) - 1) | yisint) == 0) - return (x - x) / (x - x); - - /* sgn (sign of result -ve**odd) = -1 else = 1 */ - sgn = one; - if (((((u_int32_t) hx >> 31) - 1) | (yisint - 1)) == 0) - sgn = -one; /* (-ve)**(odd int) */ - - /* |y| is huge. - 2^-16495 = 1/2 of smallest representable value. - If (1 - 1/131072)^y underflows, y > 1.4986e9 */ - if (iy > 0x41d654b0) - { - /* if (1 - 2^-113)^y underflows, y > 1.1873e38 */ - if (iy > 0x47d654b0) - { - if (ix <= 0x3fefffff) - return (hy < 0) ? sgn * huge * huge : sgn * tiny * tiny; - if (ix >= 0x3ff00000) - return (hy > 0) ? sgn * huge * huge : sgn * tiny * tiny; - } - /* over/underflow if x is not close to one */ - if (ix < 0x3fefffff) - return (hy < 0) ? sgn * huge * huge : sgn * tiny * tiny; - if (ix > 0x3ff00000) - return (hy > 0) ? sgn * huge * huge : sgn * tiny * tiny; - } - - ay = y > 0 ? y : -y; - if (ay < 0x1p-117) - y = y < 0 ? -0x1p-117 : 0x1p-117; - - n = 0; - /* take care subnormal number */ - if (ix < 0x00100000) - { - ax *= two113; - n -= 113; - ohi = ldbl_high (ax); - GET_HIGH_WORD (ix, ohi); - } - n += ((ix) >> 20) - 0x3ff; - j = ix & 0x000fffff; - /* determine interval */ - ix = j | 0x3ff00000; /* normalize ix */ - if (j <= 0x39880) - k = 0; /* |x|<sqrt(3/2) */ - else if (j < 0xbb670) - k = 1; /* |x|<sqrt(3) */ - else - { - k = 0; - n += 1; - ix -= 0x00100000; - } - - ohi = ldbl_high (ax); - GET_HIGH_WORD (hax, ohi); - ax = __scalbnl (ax, ((int) ((ix - hax) * 2)) >> 21); - - /* compute s = s_h+s_l = (x-1)/(x+1) or (x-1.5)/(x+1.5) */ - u = ax - bp[k]; /* bp[0]=1.0, bp[1]=1.5 */ - v = one / (ax + bp[k]); - s = u * v; - s_h = ldbl_high (s); - - /* t_h=ax+bp[k] High */ - t_h = ax + bp[k]; - t_h = ldbl_high (t_h); - t_l = ax - (t_h - bp[k]); - s_l = v * ((u - s_h * t_h) - s_h * t_l); - /* compute log(ax) */ - s2 = s * s; - u = LN[0] + s2 * (LN[1] + s2 * (LN[2] + s2 * (LN[3] + s2 * LN[4]))); - v = LD[0] + s2 * (LD[1] + s2 * (LD[2] + s2 * (LD[3] + s2 * (LD[4] + s2)))); - r = s2 * s2 * u / v; - r += s_l * (s_h + s); - s2 = s_h * s_h; - t_h = 3.0 + s2 + r; - t_h = ldbl_high (t_h); - t_l = r - ((t_h - 3.0) - s2); - /* u+v = s*(1+...) */ - u = s_h * t_h; - v = s_l * t_h + t_l * s; - /* 2/(3log2)*(s+...) */ - p_h = u + v; - p_h = ldbl_high (p_h); - p_l = v - (p_h - u); - z_h = cp_h * p_h; /* cp_h+cp_l = 2/(3*log2) */ - z_l = cp_l * p_h + p_l * cp + dp_l[k]; - /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ - t = (long double) n; - t1 = (((z_h + z_l) + dp_h[k]) + t); - t1 = ldbl_high (t1); - t2 = z_l - (((t1 - t) - dp_h[k]) - z_h); - - /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ - y1 = ldbl_high (y); - p_l = (y - y1) * t1 + y * t2; - p_h = y1 * t1; - z = p_l + p_h; - ohi = ldbl_high (z); - EXTRACT_WORDS (j, lj, ohi); - if (j >= 0x40d00000) /* z >= 16384 */ - { - /* if z > 16384 */ - if (((j - 0x40d00000) | lj) != 0) - return sgn * huge * huge; /* overflow */ - else - { - if (p_l + ovt > z - p_h) - return sgn * huge * huge; /* overflow */ - } - } - else if ((j & 0x7fffffff) >= 0x40d01b90) /* z <= -16495 */ - { - /* z < -16495 */ - if (((j - 0xc0d01bc0) | lj) != 0) - return sgn * tiny * tiny; /* underflow */ - else - { - if (p_l <= z - p_h) - return sgn * tiny * tiny; /* underflow */ - } - } - /* compute 2**(p_h+p_l) */ - i = j & 0x7fffffff; - k = (i >> 20) - 0x3ff; - n = 0; - if (i > 0x3fe00000) - { /* if |z| > 0.5, set n = [z+0.5] */ - n = __floorl (z + 0.5L); - t = n; - p_h -= t; - } - t = p_l + p_h; - t = ldbl_high (t); - u = t * lg2_h; - v = (p_l - (t - p_h)) * lg2 + t * lg2_l; - z = u + v; - w = v - (z - u); - /* exp(z) */ - t = z * z; - u = PN[0] + t * (PN[1] + t * (PN[2] + t * (PN[3] + t * PN[4]))); - v = PD[0] + t * (PD[1] + t * (PD[2] + t * (PD[3] + t))); - t1 = z - t * u / v; - r = (z * t1) / (t1 - two) - (w + z * w); - z = one - (r - z); - z = __scalbnl (sgn * z, n); - math_check_force_underflow (z); - return z; -} -strong_alias (__ieee754_powl, __powl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c b/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c deleted file mode 100644 index 5aa2c1c007..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_rem_pio2l.c +++ /dev/null @@ -1,279 +0,0 @@ -/* Quad-precision floating point argument reduction. - Copyright (C) 1999-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek <jj@ultra.linux.cz> - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_private.h> -#include <ieee754.h> - -/* - * Table of constants for 2/pi, 5628 hexadecimal digits of 2/pi - */ -static const int32_t two_over_pi[] = { -0xa2f983, 0x6e4e44, 0x1529fc, 0x2757d1, 0xf534dd, 0xc0db62, -0x95993c, 0x439041, 0xfe5163, 0xabdebb, 0xc561b7, 0x246e3a, -0x424dd2, 0xe00649, 0x2eea09, 0xd1921c, 0xfe1deb, 0x1cb129, -0xa73ee8, 0x8235f5, 0x2ebb44, 0x84e99c, 0x7026b4, 0x5f7e41, -0x3991d6, 0x398353, 0x39f49c, 0x845f8b, 0xbdf928, 0x3b1ff8, -0x97ffde, 0x05980f, 0xef2f11, 0x8b5a0a, 0x6d1f6d, 0x367ecf, -0x27cb09, 0xb74f46, 0x3f669e, 0x5fea2d, 0x7527ba, 0xc7ebe5, -0xf17b3d, 0x0739f7, 0x8a5292, 0xea6bfb, 0x5fb11f, 0x8d5d08, -0x560330, 0x46fc7b, 0x6babf0, 0xcfbc20, 0x9af436, 0x1da9e3, -0x91615e, 0xe61b08, 0x659985, 0x5f14a0, 0x68408d, 0xffd880, -0x4d7327, 0x310606, 0x1556ca, 0x73a8c9, 0x60e27b, 0xc08c6b, -0x47c419, 0xc367cd, 0xdce809, 0x2a8359, 0xc4768b, 0x961ca6, -0xddaf44, 0xd15719, 0x053ea5, 0xff0705, 0x3f7e33, 0xe832c2, -0xde4f98, 0x327dbb, 0xc33d26, 0xef6b1e, 0x5ef89f, 0x3a1f35, -0xcaf27f, 0x1d87f1, 0x21907c, 0x7c246a, 0xfa6ed5, 0x772d30, -0x433b15, 0xc614b5, 0x9d19c3, 0xc2c4ad, 0x414d2c, 0x5d000c, -0x467d86, 0x2d71e3, 0x9ac69b, 0x006233, 0x7cd2b4, 0x97a7b4, -0xd55537, 0xf63ed7, 0x1810a3, 0xfc764d, 0x2a9d64, 0xabd770, -0xf87c63, 0x57b07a, 0xe71517, 0x5649c0, 0xd9d63b, 0x3884a7, -0xcb2324, 0x778ad6, 0x23545a, 0xb91f00, 0x1b0af1, 0xdfce19, -0xff319f, 0x6a1e66, 0x615799, 0x47fbac, 0xd87f7e, 0xb76522, -0x89e832, 0x60bfe6, 0xcdc4ef, 0x09366c, 0xd43f5d, 0xd7de16, -0xde3b58, 0x929bde, 0x2822d2, 0xe88628, 0x4d58e2, 0x32cac6, -0x16e308, 0xcb7de0, 0x50c017, 0xa71df3, 0x5be018, 0x34132e, -0x621283, 0x014883, 0x5b8ef5, 0x7fb0ad, 0xf2e91e, 0x434a48, -0xd36710, 0xd8ddaa, 0x425fae, 0xce616a, 0xa4280a, 0xb499d3, -0xf2a606, 0x7f775c, 0x83c2a3, 0x883c61, 0x78738a, 0x5a8caf, -0xbdd76f, 0x63a62d, 0xcbbff4, 0xef818d, 0x67c126, 0x45ca55, -0x36d9ca, 0xd2a828, 0x8d61c2, 0x77c912, 0x142604, 0x9b4612, -0xc459c4, 0x44c5c8, 0x91b24d, 0xf31700, 0xad43d4, 0xe54929, -0x10d5fd, 0xfcbe00, 0xcc941e, 0xeece70, 0xf53e13, 0x80f1ec, -0xc3e7b3, 0x28f8c7, 0x940593, 0x3e71c1, 0xb3092e, 0xf3450b, -0x9c1288, 0x7b20ab, 0x9fb52e, 0xc29247, 0x2f327b, 0x6d550c, -0x90a772, 0x1fe76b, 0x96cb31, 0x4a1679, 0xe27941, 0x89dff4, -0x9794e8, 0x84e6e2, 0x973199, 0x6bed88, 0x365f5f, 0x0efdbb, -0xb49a48, 0x6ca467, 0x427271, 0x325d8d, 0xb8159f, 0x09e5bc, -0x25318d, 0x3974f7, 0x1c0530, 0x010c0d, 0x68084b, 0x58ee2c, -0x90aa47, 0x02e774, 0x24d6bd, 0xa67df7, 0x72486e, 0xef169f, -0xa6948e, 0xf691b4, 0x5153d1, 0xf20acf, 0x339820, 0x7e4bf5, -0x6863b2, 0x5f3edd, 0x035d40, 0x7f8985, 0x295255, 0xc06437, -0x10d86d, 0x324832, 0x754c5b, 0xd4714e, 0x6e5445, 0xc1090b, -0x69f52a, 0xd56614, 0x9d0727, 0x50045d, 0xdb3bb4, 0xc576ea, -0x17f987, 0x7d6b49, 0xba271d, 0x296996, 0xacccc6, 0x5414ad, -0x6ae290, 0x89d988, 0x50722c, 0xbea404, 0x940777, 0x7030f3, -0x27fc00, 0xa871ea, 0x49c266, 0x3de064, 0x83dd97, 0x973fa3, -0xfd9443, 0x8c860d, 0xde4131, 0x9d3992, 0x8c70dd, 0xe7b717, -0x3bdf08, 0x2b3715, 0xa0805c, 0x93805a, 0x921110, 0xd8e80f, -0xaf806c, 0x4bffdb, 0x0f9038, 0x761859, 0x15a562, 0xbbcb61, -0xb989c7, 0xbd4010, 0x04f2d2, 0x277549, 0xf6b6eb, 0xbb22db, -0xaa140a, 0x2f2689, 0x768364, 0x333b09, 0x1a940e, 0xaa3a51, -0xc2a31d, 0xaeedaf, 0x12265c, 0x4dc26d, 0x9c7a2d, 0x9756c0, -0x833f03, 0xf6f009, 0x8c402b, 0x99316d, 0x07b439, 0x15200c, -0x5bc3d8, 0xc492f5, 0x4badc6, 0xa5ca4e, 0xcd37a7, 0x36a9e6, -0x9492ab, 0x6842dd, 0xde6319, 0xef8c76, 0x528b68, 0x37dbfc, -0xaba1ae, 0x3115df, 0xa1ae00, 0xdafb0c, 0x664d64, 0xb705ed, -0x306529, 0xbf5657, 0x3aff47, 0xb9f96a, 0xf3be75, 0xdf9328, -0x3080ab, 0xf68c66, 0x15cb04, 0x0622fa, 0x1de4d9, 0xa4b33d, -0x8f1b57, 0x09cd36, 0xe9424e, 0xa4be13, 0xb52333, 0x1aaaf0, -0xa8654f, 0xa5c1d2, 0x0f3f0b, 0xcd785b, 0x76f923, 0x048b7b, -0x721789, 0x53a6c6, 0xe26e6f, 0x00ebef, 0x584a9b, 0xb7dac4, -0xba66aa, 0xcfcf76, 0x1d02d1, 0x2df1b1, 0xc1998c, 0x77adc3, -0xda4886, 0xa05df7, 0xf480c6, 0x2ff0ac, 0x9aecdd, 0xbc5c3f, -0x6dded0, 0x1fc790, 0xb6db2a, 0x3a25a3, 0x9aaf00, 0x9353ad, -0x0457b6, 0xb42d29, 0x7e804b, 0xa707da, 0x0eaa76, 0xa1597b, -0x2a1216, 0x2db7dc, 0xfde5fa, 0xfedb89, 0xfdbe89, 0x6c76e4, -0xfca906, 0x70803e, 0x156e85, 0xff87fd, 0x073e28, 0x336761, -0x86182a, 0xeabd4d, 0xafe7b3, 0x6e6d8f, 0x396795, 0x5bbf31, -0x48d784, 0x16df30, 0x432dc7, 0x356125, 0xce70c9, 0xb8cb30, -0xfd6cbf, 0xa200a4, 0xe46c05, 0xa0dd5a, 0x476f21, 0xd21262, -0x845cb9, 0x496170, 0xe0566b, 0x015299, 0x375550, 0xb7d51e, -0xc4f133, 0x5f6e13, 0xe4305d, 0xa92e85, 0xc3b21d, 0x3632a1, -0xa4b708, 0xd4b1ea, 0x21f716, 0xe4698f, 0x77ff27, 0x80030c, -0x2d408d, 0xa0cd4f, 0x99a520, 0xd3a2b3, 0x0a5d2f, 0x42f9b4, -0xcbda11, 0xd0be7d, 0xc1db9b, 0xbd17ab, 0x81a2ca, 0x5c6a08, -0x17552e, 0x550027, 0xf0147f, 0x8607e1, 0x640b14, 0x8d4196, -0xdebe87, 0x2afdda, 0xb6256b, 0x34897b, 0xfef305, 0x9ebfb9, -0x4f6a68, 0xa82a4a, 0x5ac44f, 0xbcf82d, 0x985ad7, 0x95c7f4, -0x8d4d0d, 0xa63a20, 0x5f57a4, 0xb13f14, 0x953880, 0x0120cc, -0x86dd71, 0xb6dec9, 0xf560bf, 0x11654d, 0x6b0701, 0xacb08c, -0xd0c0b2, 0x485551, 0x0efb1e, 0xc37295, 0x3b06a3, 0x3540c0, -0x7bdc06, 0xcc45e0, 0xfa294e, 0xc8cad6, 0x41f3e8, 0xde647c, -0xd8649b, 0x31bed9, 0xc397a4, 0xd45877, 0xc5e369, 0x13daf0, -0x3c3aba, 0x461846, 0x5f7555, 0xf5bdd2, 0xc6926e, 0x5d2eac, -0xed440e, 0x423e1c, 0x87c461, 0xe9fd29, 0xf3d6e7, 0xca7c22, -0x35916f, 0xc5e008, 0x8dd7ff, 0xe26a6e, 0xc6fdb0, 0xc10893, -0x745d7c, 0xb2ad6b, 0x9d6ecd, 0x7b723e, 0x6a11c6, 0xa9cff7, -0xdf7329, 0xbac9b5, 0x5100b7, 0x0db2e2, 0x24ba74, 0x607de5, -0x8ad874, 0x2c150d, 0x0c1881, 0x94667e, 0x162901, 0x767a9f, -0xbefdfd, 0xef4556, 0x367ed9, 0x13d9ec, 0xb9ba8b, 0xfc97c4, -0x27a831, 0xc36ef1, 0x36c594, 0x56a8d8, 0xb5a8b4, 0x0ecccf, -0x2d8912, 0x34576f, 0x89562c, 0xe3ce99, 0xb920d6, 0xaa5e6b, -0x9c2a3e, 0xcc5f11, 0x4a0bfd, 0xfbf4e1, 0x6d3b8e, 0x2c86e2, -0x84d4e9, 0xa9b4fc, 0xd1eeef, 0xc9352e, 0x61392f, 0x442138, -0xc8d91b, 0x0afc81, 0x6a4afb, 0xd81c2f, 0x84b453, 0x8c994e, -0xcc2254, 0xdc552a, 0xd6c6c0, 0x96190b, 0xb8701a, 0x649569, -0x605a26, 0xee523f, 0x0f117f, 0x11b5f4, 0xf5cbfc, 0x2dbc34, -0xeebc34, 0xcc5de8, 0x605edd, 0x9b8e67, 0xef3392, 0xb817c9, -0x9b5861, 0xbc57e1, 0xc68351, 0x103ed8, 0x4871dd, 0xdd1c2d, -0xa118af, 0x462c21, 0xd7f359, 0x987ad9, 0xc0549e, 0xfa864f, -0xfc0656, 0xae79e5, 0x362289, 0x22ad38, 0xdc9367, 0xaae855, -0x382682, 0x9be7ca, 0xa40d51, 0xb13399, 0x0ed7a9, 0x480569, -0xf0b265, 0xa7887f, 0x974c88, 0x36d1f9, 0xb39221, 0x4a827b, -0x21cf98, 0xdc9f40, 0x5547dc, 0x3a74e1, 0x42eb67, 0xdf9dfe, -0x5fd45e, 0xa4677b, 0x7aacba, 0xa2f655, 0x23882b, 0x55ba41, -0x086e59, 0x862a21, 0x834739, 0xe6e389, 0xd49ee5, 0x40fb49, -0xe956ff, 0xca0f1c, 0x8a59c5, 0x2bfa94, 0xc5c1d3, 0xcfc50f, -0xae5adb, 0x86c547, 0x624385, 0x3b8621, 0x94792c, 0x876110, -0x7b4c2a, 0x1a2c80, 0x12bf43, 0x902688, 0x893c78, 0xe4c4a8, -0x7bdbe5, 0xc23ac4, 0xeaf426, 0x8a67f7, 0xbf920d, 0x2ba365, -0xb1933d, 0x0b7cbd, 0xdc51a4, 0x63dd27, 0xdde169, 0x19949a, -0x9529a8, 0x28ce68, 0xb4ed09, 0x209f44, 0xca984e, 0x638270, -0x237c7e, 0x32b90f, 0x8ef5a7, 0xe75614, 0x08f121, 0x2a9db5, -0x4d7e6f, 0x5119a5, 0xabf9b5, 0xd6df82, 0x61dd96, 0x023616, -0x9f3ac4, 0xa1a283, 0x6ded72, 0x7a8d39, 0xa9b882, 0x5c326b, -0x5b2746, 0xed3400, 0x7700d2, 0x55f4fc, 0x4d5901, 0x8071e0, -0xe13f89, 0xb295f3, 0x64a8f1, 0xaea74b, 0x38fc4c, 0xeab2bb, -0x47270b, 0xabc3a7, 0x34ba60, 0x52dd34, 0xf8563a, 0xeb7e8a, -0x31bb36, 0x5895b7, 0x47f7a9, 0x94c3aa, 0xd39225, 0x1e7f3e, -0xd8974e, 0xbba94f, 0xd8ae01, 0xe661b4, 0x393d8e, 0xa523aa, -0x33068e, 0x1633b5, 0x3bb188, 0x1d3a9d, 0x4013d0, 0xcc1be5, -0xf862e7, 0x3bf28f, 0x39b5bf, 0x0bc235, 0x22747e, 0xa247c0, -0xd52d1f, 0x19add3, 0x9094df, 0x9311d0, 0xb42b25, 0x496db2, -0xe264b2, 0x5ef135, 0x3bc6a4, 0x1a4ad0, 0xaac92e, 0x64e886, -0x573091, 0x982cfb, 0x311b1a, 0x08728b, 0xbdcee1, 0x60e142, -0xeb641d, 0xd0bba3, 0xe559d4, 0x597b8c, 0x2a4483, 0xf332ba, -0xf84867, 0x2c8d1b, 0x2fa9b0, 0x50f3dd, 0xf9f573, 0xdb61b4, -0xfe233e, 0x6c41a6, 0xeea318, 0x775a26, 0xbc5e5c, 0xcea708, -0x94dc57, 0xe20196, 0xf1e839, 0xbe4851, 0x5d2d2f, 0x4e9555, -0xd96ec2, 0xe7d755, 0x6304e0, 0xc02e0e, 0xfc40a0, 0xbbf9b3, -0x7125a7, 0x222dfb, 0xf619d8, 0x838c1c, 0x6619e6, 0xb20d55, -0xbb5137, 0x79e809, 0xaf9149, 0x0d73de, 0x0b0da5, 0xce7f58, -0xac1934, 0x724667, 0x7a1a13, 0x9e26bc, 0x4555e7, 0x585cb5, -0x711d14, 0x486991, 0x480d60, 0x56adab, 0xd62f64, 0x96ee0c, -0x212ff3, 0x5d6d88, 0xa67684, 0x95651e, 0xab9e0a, 0x4ddefe, -0x571010, 0x836a39, 0xf8ea31, 0x9e381d, 0xeac8b1, 0xcac96b, -0x37f21e, 0xd505e9, 0x984743, 0x9fc56c, 0x0331b7, 0x3b8bf8, -0x86e56a, 0x8dc343, 0x6230e7, 0x93cfd5, 0x6a8f2d, 0x733005, -0x1af021, 0xa09fcb, 0x7415a1, 0xd56b23, 0x6ff725, 0x2f4bc7, -0xb8a591, 0x7fac59, 0x5c55de, 0x212c38, 0xb13296, 0x5cff50, -0x366262, 0xfa7b16, 0xf4d9a6, 0x2acfe7, 0xf07403, 0xd4d604, -0x6fd916, 0x31b1bf, 0xcbb450, 0x5bd7c8, 0x0ce194, 0x6bd643, -0x4fd91c, 0xdf4543, 0x5f3453, 0xe2b5aa, 0xc9aec8, 0x131485, -0xf9d2bf, 0xbadb9e, 0x76f5b9, 0xaf15cf, 0xca3182, 0x14b56d, -0xe9fe4d, 0x50fc35, 0xf5aed5, 0xa2d0c1, 0xc96057, 0x192eb6, -0xe91d92, 0x07d144, 0xaea3c6, 0x343566, 0x26d5b4, 0x3161e2, -0x37f1a2, 0x209eff, 0x958e23, 0x493798, 0x35f4a6, 0x4bdc02, -0xc2be13, 0xbe80a0, 0x0b72a3, 0x115c5f, 0x1e1bd1, 0x0db4d3, -0x869e85, 0x96976b, 0x2ac91f, 0x8a26c2, 0x3070f0, 0x041412, -0xfc9fa5, 0xf72a38, 0x9c6878, 0xe2aa76, 0x50cfe1, 0x559274, -0x934e38, 0x0a92f7, 0x5533f0, 0xa63db4, 0x399971, 0xe2b755, -0xa98a7c, 0x008f19, 0xac54d2, 0x2ea0b4, 0xf5f3e0, 0x60c849, -0xffd269, 0xae52ce, 0x7a5fdd, 0xe9ce06, 0xfb0ae8, 0xa50cce, -0xea9d3e, 0x3766dd, 0xb834f5, 0x0da090, 0x846f88, 0x4ae3d5, -0x099a03, 0x2eae2d, 0xfcb40a, 0xfb9b33, 0xe281dd, 0x1b16ba, -0xd8c0af, 0xd96b97, 0xb52dc9, 0x9c277f, 0x5951d5, 0x21ccd6, -0xb6496b, 0x584562, 0xb3baf2, 0xa1a5c4, 0x7ca2cf, 0xa9b93d, -0x7b7b89, 0x483d38, -}; - -static const long double c[] = { -/* 106 bits of pi/2 */ -#define PI_2_1 c[0] - 0x1.921fb54442d18469898cc517018p+0L, - -/* pi/2 - PI_2_1 */ -#define PI_2_1t c[1] - 0x3.839a252049c1114cf98e804178p-108L, -}; - -int32_t __ieee754_rem_pio2l(long double x, long double *y) -{ - long double z, w, t; - double tx[8]; - int exp; - int64_t n, ix, hx, ixd; - u_int64_t lxd; - double xhi; - - xhi = ldbl_high (x); - EXTRACT_WORDS64 (hx, xhi); - ix = hx & 0x7fffffffffffffffLL; - if (ix <= 0x3fe921fb54442d10LL) /* x in <-pi/4, pi/4> */ - { - y[0] = x; - y[1] = 0; - return 0; - } - - if (ix < 0x4002d97c7f3321d0LL) /* |x| in <pi/4, 3pi/4) */ - { - if (hx > 0) - { - /* 106 + 106 bit PI is ok */ - z = x - PI_2_1; - y[0] = z - PI_2_1t; - y[1] = (z - y[0]) - PI_2_1t; - return 1; - } - else - { - /* 106 + 106 bit PI is ok */ - z = x + PI_2_1; - y[0] = z + PI_2_1t; - y[1] = (z - y[0]) + PI_2_1t; - return -1; - } - } - - if (ix >= 0x7ff0000000000000LL) /* x is +=oo or NaN */ - { - y[0] = x - x; - y[1] = y[0]; - return 0; - } - - /* Handle large arguments. - We split the 113 bits of the mantissa into 5 24bit integers - stored in a double array. */ - /* Make the IBM extended format 105 bit mantissa look like the ieee854 112 - bit mantissa so the next operation will give the correct result. */ - ldbl_extract_mantissa (&ixd, &lxd, &exp, x); - exp = exp - 23; - /* This is faster than doing this in floating point, because we - have to convert it to integers anyway and like this we can keep - both integer and floating point units busy. */ - tx [0] = (double)(((ixd >> 25) & 0x7fffff) | 0x800000); - tx [1] = (double)((ixd >> 1) & 0xffffff); - tx [2] = (double)(((ixd << 23) | (lxd >> 41)) & 0xffffff); - tx [3] = (double)((lxd >> 17) & 0xffffff); - tx [4] = (double)((lxd << 7) & 0xffffff); - - n = __kernel_rem_pio2 (tx, tx + 5, exp, ((lxd << 7) & 0xffffff) ? 5 : 4, - 3, two_over_pi); - - /* The result is now stored in 3 double values, we need to convert it into - two long double values. */ - t = (long double) tx [6] + (long double) tx [7]; - w = (long double) tx [5]; - - if (hx >= 0) - { - y[0] = w + t; - y[1] = t - (y[0] - w); - return n; - } - else - { - y[0] = -(w + t); - y[1] = -t - (y[0] + w); - return -n; - } -} diff --git a/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c b/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c deleted file mode 100644 index 68b8fb3519..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_remainderl.c +++ /dev/null @@ -1,81 +0,0 @@ -/* e_fmodl.c -- long double version of e_fmod.c. - * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. - */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* __ieee754_remainderl(x,p) - * Return : - * returns x REM p = x - [x/p]*p as if in infinite - * precise arithmetic, where [x/p] is the (infinite bit) - * integer nearest x/p (in half way case choose the even one). - * Method : - * Based on fmodl() return x-[x/p]chopped*p exactlp. - */ - -#include <math.h> -#include <math_private.h> - -static const long double zero = 0.0L; - - -long double -__ieee754_remainderl(long double x, long double p) -{ - int64_t hx,hp; - u_int64_t sx,lx,lp; - long double p_half; - double xhi, xlo, phi, plo; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - EXTRACT_WORDS64 (lx, xlo); - ldbl_unpack (p, &phi, &plo); - EXTRACT_WORDS64 (hp, phi); - EXTRACT_WORDS64 (lp, plo); - sx = hx&0x8000000000000000ULL; - lp ^= hp & 0x8000000000000000ULL; - hp &= 0x7fffffffffffffffLL; - lx ^= sx; - hx &= 0x7fffffffffffffffLL; - if (lp == 0x8000000000000000ULL) - lp = 0; - if (lx == 0x8000000000000000ULL) - lx = 0; - - /* purge off exception values */ - if(hp==0) return (x*p)/(x*p); /* p = 0 */ - if((hx>=0x7ff0000000000000LL)|| /* x not finite */ - (hp>0x7ff0000000000000LL)) /* p is NaN */ - return (x*p)/(x*p); - - - if (hp<=0x7fdfffffffffffffLL) x = __ieee754_fmodl(x,p+p); /* now x < 2p */ - if (((hx-hp)|(lx-lp))==0) return zero*x; - x = fabsl(x); - p = fabsl(p); - if (hp<0x0020000000000000LL) { - if(x+x>p) { - x-=p; - if(x+x>=p) x -= p; - } - } else { - p_half = 0.5L*p; - if(x>p_half) { - x-=p; - if(x>=p_half) x -= p; - } - } - if (sx) - x = -x; - return x; -} -strong_alias (__ieee754_remainderl, __remainderl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c b/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c deleted file mode 100644 index 67d9d24ce7..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_sinhl.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - - -/* __ieee754_sinh(x) - * Method : - * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2 - * 1. Replace x by |x| (sinh(-x) = -sinh(x)). - * 2. - * E + E/(E+1) - * 0 <= x <= 40 : sinh(x) := --------------, E=expm1(x) - * 2 - * - * 40 <= x <= lnovft : sinh(x) := exp(x)/2 - * lnovft <= x <= ln2ovft: sinh(x) := exp(x/2)/2 * exp(x/2) - * ln2ovft < x : sinh(x) := x*shuge (overflow) - * - * Special cases: - * sinh(x) is |x| if x is +INF, -INF, or NaN. - * only sinh(0)=0 is exact for finite x. - */ - -#include <float.h> -#include <math.h> -#include <math_private.h> - -static const long double one = 1.0, shuge = 1.0e307; - -long double -__ieee754_sinhl(long double x) -{ - long double t,w,h; - int64_t ix,jx; - double xhi; - - /* High word of |x|. */ - xhi = ldbl_high (x); - EXTRACT_WORDS64 (jx, xhi); - ix = jx&0x7fffffffffffffffLL; - - /* x is INF or NaN */ - if(ix>=0x7ff0000000000000LL) return x+x; - - h = 0.5; - if (jx<0) h = -h; - /* |x| in [0,40], return sign(x)*0.5*(E+E/(E+1))) */ - if (ix < 0x4044000000000000LL) { /* |x|<40 */ - if (ix<0x3c90000000000000LL) { /* |x|<2**-54 */ - math_check_force_underflow (x); - if(shuge+x>one) return x;/* sinhl(tiny) = tiny with inexact */ - } - t = __expm1l(fabsl(x)); - if(ix<0x3ff0000000000000LL) return h*(2.0*t-t*t/(t+one)); - w = t/(t+one); - return h*(t+w); - } - - /* |x| in [40, log(maxdouble)] return 0.5*exp(|x|) */ - if (ix < 0x40862e42fefa39efLL) return h*__ieee754_expl(fabsl(x)); - - /* |x| in [log(maxdouble), overflowthresold] */ - if (ix <= 0x408633ce8fb9f87eLL) { - w = __ieee754_expl(0.5*fabsl(x)); - t = h*w; - return t*w; - } - - /* |x| > overflowthresold, sinh(x) overflow */ - return x*shuge; -} -strong_alias (__ieee754_sinhl, __sinhl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c b/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c deleted file mode 100644 index 8089090533..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/e_sqrtl.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * IBM Accurate Mathematical Library - * written by International Business Machines Corp. - * Copyright (C) 2001-2017 Free Software Foundation, Inc. - * - * This program 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. - * - * This program 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 this program; if not, see <http://www.gnu.org/licenses/>. - */ -/*********************************************************************/ -/* MODULE_NAME: uroot.c */ -/* */ -/* FUNCTION: usqrt */ -/* */ -/* FILES NEEDED: dla.h endian.h mydefs.h uroot.h */ -/* uroot.tbl */ -/* */ -/* An ultimate sqrt routine. Given an IEEE double machine number x */ -/* it computes the correctly rounded (to nearest) value of square */ -/* root of x. */ -/* Assumption: Machine arithmetic operations are performed in */ -/* round to nearest mode of IEEE 754 standard. */ -/* */ -/*********************************************************************/ - -#include <math_private.h> - -typedef union {int64_t i[2]; long double x; double d[2]; } mynumber; - -static const double - t512 = 0x1p512, - tm256 = 0x1p-256, - two54 = 0x1p54, /* 0x4350000000000000 */ - twom54 = 0x1p-54; /* 0x3C90000000000000 */ - -/*********************************************************************/ -/* An ultimate sqrt routine. Given an IEEE double machine number x */ -/* it computes the correctly rounded (to nearest) value of square */ -/* root of x. */ -/*********************************************************************/ -long double __ieee754_sqrtl(long double x) -{ - static const long double big = 134217728.0, big1 = 134217729.0; - long double t,s,i; - mynumber a,c; - uint64_t k, l; - int64_t m, n; - double d; - - a.x=x; - k=a.i[0] & INT64_C(0x7fffffffffffffff); - /*----------------- 2^-1022 <= | x |< 2^1024 -----------------*/ - if (k>INT64_C(0x000fffff00000000) && k<INT64_C(0x7ff0000000000000)) { - if (x < 0) return (big1-big1)/(big-big); - l = (k&INT64_C(0x001fffffffffffff))|INT64_C(0x3fe0000000000000); - if ((a.i[1] & INT64_C(0x7fffffffffffffff)) != 0) { - n = (int64_t) ((l - k) * 2) >> 53; - m = (a.i[1] >> 52) & 0x7ff; - if (m == 0) { - a.d[1] *= two54; - m = ((a.i[1] >> 52) & 0x7ff) - 54; - } - m += n; - if (m > 0) - a.i[1] = (a.i[1] & INT64_C(0x800fffffffffffff)) | (m << 52); - else if (m <= -54) { - a.i[1] &= INT64_C(0x8000000000000000); - } else { - m += 54; - a.i[1] = (a.i[1] & INT64_C(0x800fffffffffffff)) | (m << 52); - a.d[1] *= twom54; - } - } - a.i[0] = l; - s = a.x; - d = __ieee754_sqrt (a.d[0]); - c.i[0] = INT64_C(0x2000000000000000)+((k&INT64_C(0x7fe0000000000000))>>1); - c.i[1] = 0; - i = d; - t = 0.5L * (i + s / i); - i = 0.5L * (t + s / t); - return c.x * i; - } - else { - if (k>=INT64_C(0x7ff0000000000000)) - /* sqrt (-Inf) = NaN, sqrt (NaN) = NaN, sqrt (+Inf) = +Inf. */ - return x * x + x; - if (x == 0) return x; - if (x < 0) return (big1-big1)/(big-big); - return tm256*__ieee754_sqrtl(x*t512); - } -} -strong_alias (__ieee754_sqrtl, __sqrtl_finite) diff --git a/sysdeps/ieee754/ldbl-128ibm/gamma_productl.c b/sysdeps/ieee754/ldbl-128ibm/gamma_productl.c deleted file mode 100644 index 7e71cb008a..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/gamma_productl.c +++ /dev/null @@ -1,42 +0,0 @@ -/* Compute a product of X, X+1, ..., with an error estimate. - Copyright (C) 2013-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_private.h> - -/* Compute the product of X + X_EPS, X + X_EPS + 1, ..., X + X_EPS + N - - 1, in the form R * (1 + *EPS) where the return value R is an - approximation to the product and *EPS is set to indicate the - approximate error in the return value. X is such that all the - values X + 1, ..., X + N - 1 are exactly representable, and X_EPS / - X is small enough that factors quadratic in it can be - neglected. */ - -long double -__gamma_productl (long double x, long double x_eps, int n, long double *eps) -{ - long double ret = x; - *eps = x_eps / x; - for (int i = 1; i < n; i++) - { - *eps += x_eps / (x + i); - ret *= x + i; - /* FIXME: no error estimates for the multiplication. */ - } - return ret; -} diff --git a/sysdeps/ieee754/ldbl-128ibm/ieee754.h b/sysdeps/ieee754/ldbl-128ibm/ieee754.h deleted file mode 100644 index 7e31128996..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/ieee754.h +++ /dev/null @@ -1,133 +0,0 @@ -/* Copyright (C) 1992-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _IEEE754_H - -#define _IEEE754_H 1 -#include <features.h> - -#include <endian.h> - -__BEGIN_DECLS - -union ieee754_float - { - float f; - - /* This is the IEEE 754 single-precision format. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:8; - unsigned int mantissa:23; -#endif /* Big endian. */ -#if __BYTE_ORDER == __LITTLE_ENDIAN - unsigned int mantissa:23; - unsigned int exponent:8; - unsigned int negative:1; -#endif /* Little endian. */ - } ieee; - - /* This format makes it easier to see if a NaN is a signalling NaN. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:8; - unsigned int quiet_nan:1; - unsigned int mantissa:22; -#endif /* Big endian. */ -#if __BYTE_ORDER == __LITTLE_ENDIAN - unsigned int mantissa:22; - unsigned int quiet_nan:1; - unsigned int exponent:8; - unsigned int negative:1; -#endif /* Little endian. */ - } ieee_nan; - }; - -#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */ - - -union ieee754_double - { - double d; - - /* This is the IEEE 754 double-precision format. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:11; - /* Together these comprise the mantissa. */ - unsigned int mantissa0:20; - unsigned int mantissa1:32; -#endif /* Big endian. */ -#if __BYTE_ORDER == __LITTLE_ENDIAN - /* Together these comprise the mantissa. */ - unsigned int mantissa1:32; - unsigned int mantissa0:20; - unsigned int exponent:11; - unsigned int negative:1; -#endif /* Little endian. */ - } ieee; - - /* This format makes it easier to see if a NaN is a signalling NaN. */ - struct - { -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned int negative:1; - unsigned int exponent:11; - unsigned int quiet_nan:1; - /* Together these comprise the mantissa. */ - unsigned int mantissa0:19; - unsigned int mantissa1:32; -#else - /* Together these comprise the mantissa. */ - unsigned int mantissa1:32; - unsigned int mantissa0:19; - unsigned int quiet_nan:1; - unsigned int exponent:11; - unsigned int negative:1; -#endif - } ieee_nan; - }; - -#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */ - - -/* IBM extended format for long double. - - Each long double is made up of two IEEE doubles. The value of the - long double is the sum of the values of the two parts. The most - significant part is required to be the value of the long double - rounded to the nearest double, as specified by IEEE. For Inf - values, the least significant part is required to be one of +0.0 or - -0.0. No other requirements are made; so, for example, 1.0 may be - represented as (1.0, +0.0) or (1.0, -0.0), and the low part of a - NaN is don't-care. */ - -union ibm_extended_long_double - { - long double ld; - union ieee754_double d[2]; - }; - -__END_DECLS - -#endif /* ieee754.h */ diff --git a/sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h b/sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h deleted file mode 100644 index bee080bd29..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/include/bits/iscanonical.h +++ /dev/null @@ -1,5 +0,0 @@ -#include_next <bits/iscanonical.h> - -#ifndef _ISOMAC -libm_hidden_proto (__iscanonicall) -#endif diff --git a/sysdeps/ieee754/ldbl-128ibm/k_cosl.c b/sysdeps/ieee754/ldbl-128ibm/k_cosl.c deleted file mode 100644 index 0010d6274a..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/k_cosl.c +++ /dev/null @@ -1,153 +0,0 @@ -/* Quad-precision floating point cosine on <-pi/4,pi/4>. - Copyright (C) 1999-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek <jj@ultra.linux.cz> - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_private.h> - -static const long double c[] = { -#define ONE c[0] - 1.00000000000000000000000000000000000E+00L, /* 3fff0000000000000000000000000000 */ - -/* cos x ~ ONE + x^2 ( SCOS1 + SCOS2 * x^2 + ... + SCOS4 * x^6 + SCOS5 * x^8 ) - x in <0,1/256> */ -#define SCOS1 c[1] -#define SCOS2 c[2] -#define SCOS3 c[3] -#define SCOS4 c[4] -#define SCOS5 c[5] --5.00000000000000000000000000000000000E-01L, /* bffe0000000000000000000000000000 */ - 4.16666666666666666666666666556146073E-02L, /* 3ffa5555555555555555555555395023 */ --1.38888888888888888888309442601939728E-03L, /* bff56c16c16c16c16c16a566e42c0375 */ - 2.48015873015862382987049502531095061E-05L, /* 3fefa01a01a019ee02dcf7da2d6d5444 */ --2.75573112601362126593516899592158083E-07L, /* bfe927e4f5dce637cb0b54908754bde0 */ - -/* cos x ~ ONE + x^2 ( COS1 + COS2 * x^2 + ... + COS7 * x^12 + COS8 * x^14 ) - x in <0,0.1484375> */ -#define COS1 c[6] -#define COS2 c[7] -#define COS3 c[8] -#define COS4 c[9] -#define COS5 c[10] -#define COS6 c[11] -#define COS7 c[12] -#define COS8 c[13] --4.99999999999999999999999999999999759E-01L, /* bffdfffffffffffffffffffffffffffb */ - 4.16666666666666666666666666651287795E-02L, /* 3ffa5555555555555555555555516f30 */ --1.38888888888888888888888742314300284E-03L, /* bff56c16c16c16c16c16c16a463dfd0d */ - 2.48015873015873015867694002851118210E-05L, /* 3fefa01a01a01a01a0195cebe6f3d3a5 */ --2.75573192239858811636614709689300351E-07L, /* bfe927e4fb7789f5aa8142a22044b51f */ - 2.08767569877762248667431926878073669E-09L, /* 3fe21eed8eff881d1e9262d7adff4373 */ --1.14707451049343817400420280514614892E-11L, /* bfda9397496922a9601ed3d4ca48944b */ - 4.77810092804389587579843296923533297E-14L, /* 3fd2ae5f8197cbcdcaf7c3fb4523414c */ - -/* sin x ~ ONE * x + x^3 ( SSIN1 + SSIN2 * x^2 + ... + SSIN4 * x^6 + SSIN5 * x^8 ) - x in <0,1/256> */ -#define SSIN1 c[14] -#define SSIN2 c[15] -#define SSIN3 c[16] -#define SSIN4 c[17] -#define SSIN5 c[18] --1.66666666666666666666666666666666659E-01L, /* bffc5555555555555555555555555555 */ - 8.33333333333333333333333333146298442E-03L, /* 3ff81111111111111111111110fe195d */ --1.98412698412698412697726277416810661E-04L, /* bff2a01a01a01a01a019e7121e080d88 */ - 2.75573192239848624174178393552189149E-06L, /* 3fec71de3a556c640c6aaa51aa02ab41 */ --2.50521016467996193495359189395805639E-08L, /* bfe5ae644ee90c47dc71839de75b2787 */ -}; - -#define SINCOSL_COS_HI 0 -#define SINCOSL_COS_LO 1 -#define SINCOSL_SIN_HI 2 -#define SINCOSL_SIN_LO 3 -extern const long double __sincosl_table[]; - -long double -__kernel_cosl(long double x, long double y) -{ - long double h, l, z, sin_l, cos_l_m1; - int64_t ix; - uint32_t tix, hix, index; - double xhi, hhi; - - xhi = ldbl_high (x); - EXTRACT_WORDS64 (ix, xhi); - tix = ((u_int64_t)ix) >> 32; - tix &= ~0x80000000; /* tix = |x|'s high 32 bits */ - if (tix < 0x3fc30000) /* |x| < 0.1484375 */ - { - /* Argument is small enough to approximate it by a Chebyshev - polynomial of degree 16. */ - if (tix < 0x3c600000) /* |x| < 2^-57 */ - if (!((int)x)) return ONE; /* generate inexact */ - z = x * x; - return ONE + (z*(COS1+z*(COS2+z*(COS3+z*(COS4+ - z*(COS5+z*(COS6+z*(COS7+z*COS8)))))))); - } - else - { - /* So that we don't have to use too large polynomial, we find - l and h such that x = l + h, where fabsl(l) <= 1.0/256 with 83 - possible values for h. We look up cosl(h) and sinl(h) in - pre-computed tables, compute cosl(l) and sinl(l) using a - Chebyshev polynomial of degree 10(11) and compute - cosl(h+l) = cosl(h)cosl(l) - sinl(h)sinl(l). */ - int six = tix; - tix = ((six - 0x3ff00000) >> 4) + 0x3fff0000; - index = 0x3ffe - (tix >> 16); - hix = (tix + (0x200 << index)) & (0xfffffc00 << index); - x = fabsl (x); - switch (index) - { - case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break; - case 1: index = ((13 << 11) + hix - 0x3ffd0000) >> 9; break; - default: - case 2: index = (hix - 0x3ffc3000) >> 10; break; - } - hix = (hix << 4) & 0x3fffffff; -/* - The following should work for double but generates the wrong index. - For now the code above converts double to ieee extended to compute - the index back to double for the h value. - - index = 0x3fe - (tix >> 20); - hix = (tix + (0x200 << index)) & (0xfffffc00 << index); - if (signbit (x)) - { - x = -x; - y = -y; - } - switch (index) - { - case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break; - case 1: index = ((13 << 15) + hix - 0x3fd00000) >> 13; break; - default: - case 2: index = (hix - 0x3fc30000) >> 14; break; - } -*/ - INSERT_WORDS64 (hhi, ((uint64_t)hix) << 32); - h = hhi; - l = y - (h - x); - z = l * l; - sin_l = l*(ONE+z*(SSIN1+z*(SSIN2+z*(SSIN3+z*(SSIN4+z*SSIN5))))); - cos_l_m1 = z*(SCOS1+z*(SCOS2+z*(SCOS3+z*(SCOS4+z*SCOS5)))); - return __sincosl_table [index + SINCOSL_COS_HI] - + (__sincosl_table [index + SINCOSL_COS_LO] - - (__sincosl_table [index + SINCOSL_SIN_HI] * sin_l - - __sincosl_table [index + SINCOSL_COS_HI] * cos_l_m1)); - } -} diff --git a/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c b/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c deleted file mode 100644 index 14b0359c15..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/k_sincosl.c +++ /dev/null @@ -1,193 +0,0 @@ -/* Quad-precision floating point sine and cosine on <-pi/4,pi/4>. - Copyright (C) 1999-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek <jj@ultra.linux.cz> - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <float.h> -#include <math.h> -#include <math_private.h> - -static const long double c[] = { -#define ONE c[0] - 1.00000000000000000000000000000000000E+00L, /* 3fff0000000000000000000000000000 */ - -/* cos x ~ ONE + x^2 ( SCOS1 + SCOS2 * x^2 + ... + SCOS4 * x^6 + SCOS5 * x^8 ) - x in <0,1/256> */ -#define SCOS1 c[1] -#define SCOS2 c[2] -#define SCOS3 c[3] -#define SCOS4 c[4] -#define SCOS5 c[5] --5.00000000000000000000000000000000000E-01L, /* bffe0000000000000000000000000000 */ - 4.16666666666666666666666666556146073E-02L, /* 3ffa5555555555555555555555395023 */ --1.38888888888888888888309442601939728E-03L, /* bff56c16c16c16c16c16a566e42c0375 */ - 2.48015873015862382987049502531095061E-05L, /* 3fefa01a01a019ee02dcf7da2d6d5444 */ --2.75573112601362126593516899592158083E-07L, /* bfe927e4f5dce637cb0b54908754bde0 */ - -/* cos x ~ ONE + x^2 ( COS1 + COS2 * x^2 + ... + COS7 * x^12 + COS8 * x^14 ) - x in <0,0.1484375> */ -#define COS1 c[6] -#define COS2 c[7] -#define COS3 c[8] -#define COS4 c[9] -#define COS5 c[10] -#define COS6 c[11] -#define COS7 c[12] -#define COS8 c[13] --4.99999999999999999999999999999999759E-01L, /* bffdfffffffffffffffffffffffffffb */ - 4.16666666666666666666666666651287795E-02L, /* 3ffa5555555555555555555555516f30 */ --1.38888888888888888888888742314300284E-03L, /* bff56c16c16c16c16c16c16a463dfd0d */ - 2.48015873015873015867694002851118210E-05L, /* 3fefa01a01a01a01a0195cebe6f3d3a5 */ --2.75573192239858811636614709689300351E-07L, /* bfe927e4fb7789f5aa8142a22044b51f */ - 2.08767569877762248667431926878073669E-09L, /* 3fe21eed8eff881d1e9262d7adff4373 */ --1.14707451049343817400420280514614892E-11L, /* bfda9397496922a9601ed3d4ca48944b */ - 4.77810092804389587579843296923533297E-14L, /* 3fd2ae5f8197cbcdcaf7c3fb4523414c */ - -/* sin x ~ ONE * x + x^3 ( SSIN1 + SSIN2 * x^2 + ... + SSIN4 * x^6 + SSIN5 * x^8 ) - x in <0,1/256> */ -#define SSIN1 c[14] -#define SSIN2 c[15] -#define SSIN3 c[16] -#define SSIN4 c[17] -#define SSIN5 c[18] --1.66666666666666666666666666666666659E-01L, /* bffc5555555555555555555555555555 */ - 8.33333333333333333333333333146298442E-03L, /* 3ff81111111111111111111110fe195d */ --1.98412698412698412697726277416810661E-04L, /* bff2a01a01a01a01a019e7121e080d88 */ - 2.75573192239848624174178393552189149E-06L, /* 3fec71de3a556c640c6aaa51aa02ab41 */ --2.50521016467996193495359189395805639E-08L, /* bfe5ae644ee90c47dc71839de75b2787 */ - -/* sin x ~ ONE * x + x^3 ( SIN1 + SIN2 * x^2 + ... + SIN7 * x^12 + SIN8 * x^14 ) - x in <0,0.1484375> */ -#define SIN1 c[19] -#define SIN2 c[20] -#define SIN3 c[21] -#define SIN4 c[22] -#define SIN5 c[23] -#define SIN6 c[24] -#define SIN7 c[25] -#define SIN8 c[26] --1.66666666666666666666666666666666538e-01L, /* bffc5555555555555555555555555550 */ - 8.33333333333333333333333333307532934e-03L, /* 3ff811111111111111111111110e7340 */ --1.98412698412698412698412534478712057e-04L, /* bff2a01a01a01a01a01a019e7a626296 */ - 2.75573192239858906520896496653095890e-06L, /* 3fec71de3a556c7338fa38527474b8f5 */ --2.50521083854417116999224301266655662e-08L, /* bfe5ae64567f544e16c7de65c2ea551f */ - 1.60590438367608957516841576404938118e-10L, /* 3fde6124613a811480538a9a41957115 */ --7.64716343504264506714019494041582610e-13L, /* bfd6ae7f3d5aef30c7bc660b060ef365 */ - 2.81068754939739570236322404393398135e-15L, /* 3fce9510115aabf87aceb2022a9a9180 */ -}; - -#define SINCOSL_COS_HI 0 -#define SINCOSL_COS_LO 1 -#define SINCOSL_SIN_HI 2 -#define SINCOSL_SIN_LO 3 -extern const long double __sincosl_table[]; - -void -__kernel_sincosl(long double x, long double y, long double *sinx, long double *cosx, int iy) -{ - long double h, l, z, sin_l, cos_l_m1; - int64_t ix; - uint32_t tix, hix, index; - double xhi, hhi; - - xhi = ldbl_high (x); - EXTRACT_WORDS64 (ix, xhi); - tix = ((uint64_t)ix) >> 32; - tix &= ~0x80000000; /* tix = |x|'s high 32 bits */ - if (tix < 0x3fc30000) /* |x| < 0.1484375 */ - { - /* Argument is small enough to approximate it by a Chebyshev - polynomial of degree 16(17). */ - if (tix < 0x3c600000) /* |x| < 2^-57 */ - { - math_check_force_underflow (x); - if (!((int)x)) /* generate inexact */ - { - *sinx = x; - *cosx = ONE; - return; - } - } - z = x * x; - *sinx = x + (x * (z*(SIN1+z*(SIN2+z*(SIN3+z*(SIN4+ - z*(SIN5+z*(SIN6+z*(SIN7+z*SIN8))))))))); - *cosx = ONE + (z*(COS1+z*(COS2+z*(COS3+z*(COS4+ - z*(COS5+z*(COS6+z*(COS7+z*COS8)))))))); - } - else - { - /* So that we don't have to use too large polynomial, we find - l and h such that x = l + h, where fabsl(l) <= 1.0/256 with 83 - possible values for h. We look up cosl(h) and sinl(h) in - pre-computed tables, compute cosl(l) and sinl(l) using a - Chebyshev polynomial of degree 10(11) and compute - sinl(h+l) = sinl(h)cosl(l) + cosl(h)sinl(l) and - cosl(h+l) = cosl(h)cosl(l) - sinl(h)sinl(l). */ - int six = tix; - tix = ((six - 0x3ff00000) >> 4) + 0x3fff0000; - index = 0x3ffe - (tix >> 16); - hix = (tix + (0x200 << index)) & (0xfffffc00 << index); - x = fabsl (x); - switch (index) - { - case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break; - case 1: index = ((13 << 11) + hix - 0x3ffd0000) >> 9; break; - default: - case 2: index = (hix - 0x3ffc3000) >> 10; break; - } - hix = (hix << 4) & 0x3fffffff; -/* - The following should work for double but generates the wrong index. - For now the code above converts double to ieee extended to compute - the index back to double for the h value. - - - index = 0x3fe - (tix >> 20); - hix = (tix + (0x2000 << index)) & (0xffffc000 << index); - if (signbit (x)) - { - x = -x; - y = -y; - } - switch (index) - { - case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break; - case 1: index = ((13 << 15) + hix - 0x3fd00000) >> 13; break; - default: - case 2: index = (hix - 0x3fc30000) >> 14; break; - } -*/ - INSERT_WORDS64 (hhi, ((uint64_t)hix) << 32); - h = hhi; - if (iy) - l = y - (h - x); - else - l = x - h; - z = l * l; - sin_l = l*(ONE+z*(SSIN1+z*(SSIN2+z*(SSIN3+z*(SSIN4+z*SSIN5))))); - cos_l_m1 = z*(SCOS1+z*(SCOS2+z*(SCOS3+z*(SCOS4+z*SCOS5)))); - z = __sincosl_table [index + SINCOSL_SIN_HI] - + (__sincosl_table [index + SINCOSL_SIN_LO] - + (__sincosl_table [index + SINCOSL_SIN_HI] * cos_l_m1) - + (__sincosl_table [index + SINCOSL_COS_HI] * sin_l)); - *sinx = (ix < 0) ? -z : z; - *cosx = __sincosl_table [index + SINCOSL_COS_HI] - + (__sincosl_table [index + SINCOSL_COS_LO] - - (__sincosl_table [index + SINCOSL_SIN_HI] * sin_l - - __sincosl_table [index + SINCOSL_COS_HI] * cos_l_m1)); - } -} diff --git a/sysdeps/ieee754/ldbl-128ibm/k_sinl.c b/sysdeps/ieee754/ldbl-128ibm/k_sinl.c deleted file mode 100644 index 2138ccf13b..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/k_sinl.c +++ /dev/null @@ -1,157 +0,0 @@ -/* Quad-precision floating point sine on <-pi/4,pi/4>. - Copyright (C) 1999-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek <jj@ultra.linux.cz> - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <float.h> -#include <math.h> -#include <math_private.h> - -static const long double c[] = { -#define ONE c[0] - 1.00000000000000000000000000000000000E+00L, /* 3fff0000000000000000000000000000 */ - -/* cos x ~ ONE + x^2 ( SCOS1 + SCOS2 * x^2 + ... + SCOS4 * x^6 + SCOS5 * x^8 ) - x in <0,1/256> */ -#define SCOS1 c[1] -#define SCOS2 c[2] -#define SCOS3 c[3] -#define SCOS4 c[4] -#define SCOS5 c[5] --5.00000000000000000000000000000000000E-01L, /* bffe0000000000000000000000000000 */ - 4.16666666666666666666666666556146073E-02L, /* 3ffa5555555555555555555555395023 */ --1.38888888888888888888309442601939728E-03L, /* bff56c16c16c16c16c16a566e42c0375 */ - 2.48015873015862382987049502531095061E-05L, /* 3fefa01a01a019ee02dcf7da2d6d5444 */ --2.75573112601362126593516899592158083E-07L, /* bfe927e4f5dce637cb0b54908754bde0 */ - -/* sin x ~ ONE * x + x^3 ( SIN1 + SIN2 * x^2 + ... + SIN7 * x^12 + SIN8 * x^14 ) - x in <0,0.1484375> */ -#define SIN1 c[6] -#define SIN2 c[7] -#define SIN3 c[8] -#define SIN4 c[9] -#define SIN5 c[10] -#define SIN6 c[11] -#define SIN7 c[12] -#define SIN8 c[13] --1.66666666666666666666666666666666538e-01L, /* bffc5555555555555555555555555550 */ - 8.33333333333333333333333333307532934e-03L, /* 3ff811111111111111111111110e7340 */ --1.98412698412698412698412534478712057e-04L, /* bff2a01a01a01a01a01a019e7a626296 */ - 2.75573192239858906520896496653095890e-06L, /* 3fec71de3a556c7338fa38527474b8f5 */ --2.50521083854417116999224301266655662e-08L, /* bfe5ae64567f544e16c7de65c2ea551f */ - 1.60590438367608957516841576404938118e-10L, /* 3fde6124613a811480538a9a41957115 */ --7.64716343504264506714019494041582610e-13L, /* bfd6ae7f3d5aef30c7bc660b060ef365 */ - 2.81068754939739570236322404393398135e-15L, /* 3fce9510115aabf87aceb2022a9a9180 */ - -/* sin x ~ ONE * x + x^3 ( SSIN1 + SSIN2 * x^2 + ... + SSIN4 * x^6 + SSIN5 * x^8 ) - x in <0,1/256> */ -#define SSIN1 c[14] -#define SSIN2 c[15] -#define SSIN3 c[16] -#define SSIN4 c[17] -#define SSIN5 c[18] --1.66666666666666666666666666666666659E-01L, /* bffc5555555555555555555555555555 */ - 8.33333333333333333333333333146298442E-03L, /* 3ff81111111111111111111110fe195d */ --1.98412698412698412697726277416810661E-04L, /* bff2a01a01a01a01a019e7121e080d88 */ - 2.75573192239848624174178393552189149E-06L, /* 3fec71de3a556c640c6aaa51aa02ab41 */ --2.50521016467996193495359189395805639E-08L, /* bfe5ae644ee90c47dc71839de75b2787 */ -}; - -#define SINCOSL_COS_HI 0 -#define SINCOSL_COS_LO 1 -#define SINCOSL_SIN_HI 2 -#define SINCOSL_SIN_LO 3 -extern const long double __sincosl_table[]; - -long double -__kernel_sinl(long double x, long double y, int iy) -{ - long double h, l, z, sin_l, cos_l_m1; - int64_t ix; - u_int32_t tix, hix, index; - double xhi, hhi; - - xhi = ldbl_high (x); - EXTRACT_WORDS64 (ix, xhi); - tix = ((u_int64_t)ix) >> 32; - tix &= ~0x80000000; /* tix = |x|'s high 32 bits */ - if (tix < 0x3fc30000) /* |x| < 0.1484375 */ - { - /* Argument is small enough to approximate it by a Chebyshev - polynomial of degree 17. */ - if (tix < 0x3c600000) /* |x| < 2^-57 */ - { - math_check_force_underflow (x); - if (!((int)x)) return x; /* generate inexact */ - } - z = x * x; - return x + (x * (z*(SIN1+z*(SIN2+z*(SIN3+z*(SIN4+ - z*(SIN5+z*(SIN6+z*(SIN7+z*SIN8))))))))); - } - else - { - /* So that we don't have to use too large polynomial, we find - l and h such that x = l + h, where fabsl(l) <= 1.0/256 with 83 - possible values for h. We look up cosl(h) and sinl(h) in - pre-computed tables, compute cosl(l) and sinl(l) using a - Chebyshev polynomial of degree 10(11) and compute - sinl(h+l) = sinl(h)cosl(l) + cosl(h)sinl(l). */ - int six = tix; - tix = ((six - 0x3ff00000) >> 4) + 0x3fff0000; - index = 0x3ffe - (tix >> 16); - hix = (tix + (0x200 << index)) & (0xfffffc00 << index); - x = fabsl (x); - switch (index) - { - case 0: index = ((45 << 10) + hix - 0x3ffe0000) >> 8; break; - case 1: index = ((13 << 11) + hix - 0x3ffd0000) >> 9; break; - default: - case 2: index = (hix - 0x3ffc3000) >> 10; break; - } - hix = (hix << 4) & 0x3fffffff; -/* - The following should work for double but generates the wrong index. - For now the code above converts double to ieee extended to compute - the index back to double for the h value. - - index = 0x3fe - (tix >> 20); - hix = (tix + (0x2000 << index)) & (0xffffc000 << index); - x = fabsl (x); - switch (index) - { - case 0: index = ((45 << 14) + hix - 0x3fe00000) >> 12; break; - case 1: index = ((13 << 15) + hix - 0x3fd00000) >> 13; break; - default: - case 2: index = (hix - 0x3fc30000) >> 14; break; - } -*/ - INSERT_WORDS64 (hhi, ((uint64_t)hix) << 32); - h = hhi; - if (iy) - l = (ix < 0 ? -y : y) - (h - x); - else - l = x - h; - z = l * l; - sin_l = l*(ONE+z*(SSIN1+z*(SSIN2+z*(SSIN3+z*(SSIN4+z*SSIN5))))); - cos_l_m1 = z*(SCOS1+z*(SCOS2+z*(SCOS3+z*(SCOS4+z*SCOS5)))); - z = __sincosl_table [index + SINCOSL_SIN_HI] - + (__sincosl_table [index + SINCOSL_SIN_LO] - + (__sincosl_table [index + SINCOSL_SIN_HI] * cos_l_m1) - + (__sincosl_table [index + SINCOSL_COS_HI] * sin_l)); - return (ix < 0) ? -z : z; - } -} diff --git a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c b/sysdeps/ieee754/ldbl-128ibm/k_tanl.c deleted file mode 100644 index 232e00c345..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/k_tanl.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* - Long double expansions are - Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author - reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under - the following terms: - - This 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. - - This 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 this library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* __kernel_tanl( x, y, k ) - * kernel tan function on [-pi/4, pi/4], pi/4 ~ 0.7854 - * Input x is assumed to be bounded by ~pi/4 in magnitude. - * Input y is the tail of x. - * Input k indicates whether tan (if k=1) or - * -1/tan (if k= -1) is returned. - * - * Algorithm - * 1. Since tan(-x) = -tan(x), we need only to consider positive x. - * 2. if x < 2^-57, return x with inexact if x!=0. - * 3. tan(x) is approximated by a rational form x + x^3 / 3 + x^5 R(x^2) - * on [0,0.67433]. - * - * Note: tan(x+y) = tan(x) + tan'(x)*y - * ~ tan(x) + (1+x*x)*y - * Therefore, for better accuracy in computing tan(x+y), let - * r = x^3 * R(x^2) - * then - * tan(x+y) = x + (x^3 / 3 + (x^2 *(r+y)+y)) - * - * 4. For x in [0.67433,pi/4], let y = pi/4 - x, then - * tan(x) = tan(pi/4-y) = (1-tan(y))/(1+tan(y)) - * = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y))) - */ - -#include <float.h> -#include <math.h> -#include <math_private.h> -#include <libc-diag.h> - -static const long double - one = 1.0L, - pio4hi = 7.8539816339744830961566084581987569936977E-1L, - pio4lo = 2.1679525325309452561992610065108379921906E-35L, - - /* tan x = x + x^3 / 3 + x^5 T(x^2)/U(x^2) - 0 <= x <= 0.6743316650390625 - Peak relative error 8.0e-36 */ - TH = 3.333333333333333333333333333333333333333E-1L, - T0 = -1.813014711743583437742363284336855889393E7L, - T1 = 1.320767960008972224312740075083259247618E6L, - T2 = -2.626775478255838182468651821863299023956E4L, - T3 = 1.764573356488504935415411383687150199315E2L, - T4 = -3.333267763822178690794678978979803526092E-1L, - - U0 = -1.359761033807687578306772463253710042010E8L, - U1 = 6.494370630656893175666729313065113194784E7L, - U2 = -4.180787672237927475505536849168729386782E6L, - U3 = 8.031643765106170040139966622980914621521E4L, - U4 = -5.323131271912475695157127875560667378597E2L; - /* 1.000000000000000000000000000000000000000E0 */ - - -long double -__kernel_tanl (long double x, long double y, int iy) -{ - long double z, r, v, w, s; - int32_t ix, sign, hx, lx; - double xhi; - - xhi = ldbl_high (x); - EXTRACT_WORDS (hx, lx, xhi); - ix = hx & 0x7fffffff; - if (ix < 0x3c600000) /* x < 2**-57 */ - { - if ((int) x == 0) /* generate inexact */ - { - if ((ix | lx | (iy + 1)) == 0) - return one / fabs (x); - else if (iy == 1) - { - math_check_force_underflow (x); - return x; - } - else - return -one / x; - } - } - if (ix >= 0x3fe59420) /* |x| >= 0.6743316650390625 */ - { - if ((hx & 0x80000000) != 0) - { - x = -x; - y = -y; - sign = -1; - } - else - sign = 1; - z = pio4hi - x; - w = pio4lo - y; - x = z + w; - y = 0.0; - } - z = x * x; - r = T0 + z * (T1 + z * (T2 + z * (T3 + z * T4))); - v = U0 + z * (U1 + z * (U2 + z * (U3 + z * (U4 + z)))); - r = r / v; - - s = z * x; - r = y + z * (s * r + y); - r += TH * s; - w = x + r; - if (ix >= 0x3fe59420) - { - v = (long double) iy; - w = (v - 2.0 * (x - (w * w / (w + v) - r))); - /* SIGN is set for arguments that reach this code, but not - otherwise, resulting in warnings that it may be used - uninitialized although in the cases where it is used it has - always been set. */ - DIAG_PUSH_NEEDS_COMMENT; - DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized"); - if (sign < 0) - w = -w; - DIAG_POP_NEEDS_COMMENT; - return w; - } - if (iy == 1) - return w; - else - { /* if allow error up to 2 ulp, - simply return -1.0/(x+r) here */ - /* compute -1.0/(x+r) accurately */ - long double u1, z1; - - u1 = ldbl_high (w); - v = r - (u1 - x); /* u1+v = r+x */ - z = -1.0 / w; - z1 = ldbl_high (z); - s = 1.0 + z1 * u1; - return z1 + z * (s + z1 * v); - } -} diff --git a/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c b/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c deleted file mode 100644 index 4146e5c2d4..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/ldbl2mpn.c +++ /dev/null @@ -1,197 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" -#include <ieee754.h> -#include <float.h> -#include <math.h> -#include <stdlib.h> - -/* Convert a `long double' in IBM extended format to a multi-precision - integer representing the significand scaled up by its number of - bits (106 for long double) and an integral power of two (MPN - frexpl). */ - - -/* When signs differ, the actual value is the difference between the - significant double and the less significant double. Sometimes a - bit can be lost when we borrow from the significant mantissa. */ -#define EXTRA_INTERNAL_PRECISION (7) - -mp_size_t -__mpn_extract_long_double (mp_ptr res_ptr, mp_size_t size, - int *expt, int *is_neg, - long double value) -{ - union ibm_extended_long_double u; - unsigned long long hi, lo; - int ediff; - - u.ld = value; - - *is_neg = u.d[0].ieee.negative; - *expt = (int) u.d[0].ieee.exponent - IEEE754_DOUBLE_BIAS; - - lo = ((long long) u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1; - hi = ((long long) u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1; - - /* Hold 7 extra bits of precision in the mantissa. This allows - the normalizing shifts below to prevent losing precision when - the signs differ and the exponents are sufficiently far apart. */ - lo <<= EXTRA_INTERNAL_PRECISION; - - /* If the lower double is not a denormal or zero then set the hidden - 53rd bit. */ - if (u.d[1].ieee.exponent != 0) - lo |= 1ULL << (52 + EXTRA_INTERNAL_PRECISION); - else - lo = lo << 1; - - /* The lower double is normalized separately from the upper. We may - need to adjust the lower manitissa to reflect this. */ - ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent - 53; - if (ediff > 0) - { - if (ediff < 64) - lo = lo >> ediff; - else - lo = 0; - } - else if (ediff < 0) - lo = lo << -ediff; - - /* The high double may be rounded and the low double reflects the - difference between the long double and the rounded high double - value. This is indicated by a differnce between the signs of the - high and low doubles. */ - if (u.d[0].ieee.negative != u.d[1].ieee.negative - && lo != 0) - { - lo = (1ULL << (53 + EXTRA_INTERNAL_PRECISION)) - lo; - if (hi == 0) - { - /* we have a borrow from the hidden bit, so shift left 1. */ - hi = 0x000ffffffffffffeLL | (lo >> (52 + EXTRA_INTERNAL_PRECISION)); - lo = 0x0fffffffffffffffLL & (lo << 1); - (*expt)--; - } - else - hi--; - } -#if BITS_PER_MP_LIMB == 32 - /* Combine the mantissas to be contiguous. */ - res_ptr[0] = lo >> EXTRA_INTERNAL_PRECISION; - res_ptr[1] = (hi << (53 - 32)) | (lo >> (32 + EXTRA_INTERNAL_PRECISION)); - res_ptr[2] = hi >> 11; - res_ptr[3] = hi >> (32 + 11); - #define N 4 -#elif BITS_PER_MP_LIMB == 64 - /* Combine the two mantissas to be contiguous. */ - res_ptr[0] = (hi << 53) | (lo >> EXTRA_INTERNAL_PRECISION); - res_ptr[1] = hi >> 11; - #define N 2 -#else - #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" -#endif -/* The format does not fill the last limb. There are some zeros. */ -#define NUM_LEADING_ZEROS (BITS_PER_MP_LIMB \ - - (LDBL_MANT_DIG - ((N - 1) * BITS_PER_MP_LIMB))) - - if (u.d[0].ieee.exponent == 0) - { - /* A biased exponent of zero is a special case. - Either it is a zero or it is a denormal number. */ - if (res_ptr[0] == 0 && res_ptr[1] == 0 - && res_ptr[N - 2] == 0 && res_ptr[N - 1] == 0) /* Assumes N<=4. */ - /* It's zero. */ - *expt = 0; - else - { - /* It is a denormal number, meaning it has no implicit leading - one bit, and its exponent is in fact the format minimum. We - use DBL_MIN_EXP instead of LDBL_MIN_EXP below because the - latter describes the properties of both parts together, but - the exponent is computed from the high part only. */ - int cnt; - -#if N == 2 - if (res_ptr[N - 1] != 0) - { - count_leading_zeros (cnt, res_ptr[N - 1]); - cnt -= NUM_LEADING_ZEROS; - res_ptr[N - 1] = res_ptr[N - 1] << cnt - | (res_ptr[0] >> (BITS_PER_MP_LIMB - cnt)); - res_ptr[0] <<= cnt; - *expt = DBL_MIN_EXP - 1 - cnt; - } - else - { - count_leading_zeros (cnt, res_ptr[0]); - if (cnt >= NUM_LEADING_ZEROS) - { - res_ptr[N - 1] = res_ptr[0] << (cnt - NUM_LEADING_ZEROS); - res_ptr[0] = 0; - } - else - { - res_ptr[N - 1] = res_ptr[0] >> (NUM_LEADING_ZEROS - cnt); - res_ptr[0] <<= BITS_PER_MP_LIMB - (NUM_LEADING_ZEROS - cnt); - } - *expt = DBL_MIN_EXP - 1 - - (BITS_PER_MP_LIMB - NUM_LEADING_ZEROS) - cnt; - } -#else - int j, k, l; - - for (j = N - 1; j > 0; j--) - if (res_ptr[j] != 0) - break; - - count_leading_zeros (cnt, res_ptr[j]); - cnt -= NUM_LEADING_ZEROS; - l = N - 1 - j; - if (cnt < 0) - { - cnt += BITS_PER_MP_LIMB; - l--; - } - if (!cnt) - for (k = N - 1; k >= l; k--) - res_ptr[k] = res_ptr[k-l]; - else - { - for (k = N - 1; k > l; k--) - res_ptr[k] = res_ptr[k-l] << cnt - | res_ptr[k-l-1] >> (BITS_PER_MP_LIMB - cnt); - res_ptr[k--] = res_ptr[0] << cnt; - } - - for (; k >= 0; k--) - res_ptr[k] = 0; - *expt = DBL_MIN_EXP - 1 - l * BITS_PER_MP_LIMB - cnt; -#endif - } - } - else - /* Add the implicit leading one bit for a normalized number. */ - res_ptr[N - 1] |= (mp_limb_t) 1 << (LDBL_MANT_DIG - 1 - - ((N - 1) * BITS_PER_MP_LIMB)); - - return N; -} diff --git a/sysdeps/ieee754/ldbl-128ibm/lgamma_negl.c b/sysdeps/ieee754/ldbl-128ibm/lgamma_negl.c deleted file mode 100644 index 638812c50b..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/lgamma_negl.c +++ /dev/null @@ -1,532 +0,0 @@ -/* lgammal expanding around zeros. - Copyright (C) 2015-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <float.h> -#include <math.h> -#include <math_private.h> - -static const long double lgamma_zeros[][2] = - { - { -0x2.74ff92c01f0d82abec9f315f1ap+0L, -0x7.12c334804d9a79cb5d46094d46p-112L }, - { -0x2.bf6821437b20197995a4b4641fp+0L, 0x5.140b4ff4b7d6069e1bd7acc196p-108L }, - { -0x3.24c1b793cb35efb8be699ad3dap+0L, 0x4.59abab3480539f1c0e926287cp-108L }, - { -0x3.f48e2a8f85fca170d456129123p+0L, -0x6.cc320a4887d1cb4c711828a75ep-108L }, - { -0x4.0a139e16656030c39f0b0de182p+0L, 0xe.d53e84029416e1242006b2b3dp-108L }, - { -0x4.fdd5de9bbabf3510d0aa407698p+0L, -0x8.501d7d78125286f78d1e501f14p-108L }, - { -0x5.021a95fc2db6432a4c56e5953ap+0L, 0xb.2133950fbcf2b01a8b9058dcccp-108L }, - { -0x5.ffa4bd647d0357dd4ed62cbd32p+0L, 0x1.2071c071a2145d2982428f2269p-108L }, - { -0x6.005ac9625f233b607c2d96d164p+0L, 0x7.a347953a96cbf30e1a0db20856p-108L }, - { -0x6.fff2fddae1bbff3d626b65c24p+0L, 0x2.de0bfcff5c457ebcf4d3ad9674p-108L }, - { -0x7.000cff7b7f87adf4482dcdb988p+0L, 0x7.d54d99e35a74d6407b80292df2p-108L }, - { -0x7.fffe5fe05673c3ca9e82b522bp+0L, -0xc.a9d2e8837cd1f14bd3d05002e4p-108L }, - { -0x8.0001a01459fc9f60cb3cec1cecp+0L, -0x8.576677ca538d88084310983b8p-108L }, - { -0x8.ffffd1c425e80ffc864e957494p+0L, 0x1.a6181dfdef1807e3087e4bb163p-104L }, - { -0x9.00002e3bb47d86d6d843fedc34p+0L, -0x1.1deb7ad09ec5e9d6e8ae2d548bp-104L }, - { -0x9.fffffb606bdfdcd062ae77a504p+0L, -0x1.47c69d2eb6f33d170fce38ff818p-104L }, - { -0xa.0000049f93bb9927b45d95e154p+0L, -0x4.1e03086db9146a9287bd4f2172p-108L }, - { -0xa.ffffff9466e9f1b36dacd2adbcp+0L, -0x1.18d05a4e458062f3f95345a4dap-104L }, - { -0xb.0000006b9915315d965a6ffea4p+0L, -0xe.4bea39000dcc1848023c5f6bdcp-112L }, - { -0xb.fffffff7089387387de41acc3cp+0L, -0x1.3c978bd839c8c428b5efcf91ef8p-104L }, - { -0xc.00000008f76c7731567c0f025p+0L, -0xf.387920df5675833859190eb128p-108L }, - { -0xc.ffffffff4f6dcf617f97a5ffc8p+0L, 0xa.82ab72d76f32eaee2d1a42ed5p-108L }, - { -0xd.00000000b092309c06683dd1b8p+0L, -0x1.03e3700857a15c19ac5a611de98p-104L }, - { -0xd.fffffffff36345ab9e184a3e08p+0L, -0x1.d1176dc48e47f62d917973dd45p-104L }, - { -0xe.000000000c9cba545e94e75ec4p+0L, -0x1.718f753e2501e757a17cf2ecbfp-104L }, - { -0xe.ffffffffff28c060c6604ef304p+0L, 0x8.e0762c8ca8361c23e8393919c4p-108L }, - { -0xf.0000000000d73f9f399bd0e42p+0L, -0xf.85e9ee31b0b890744fc0e3fbcp-108L }, - { -0xf.fffffffffff28c060c6621f514p+0L, 0x1.18d1b2eec9d960bd9adc5be5f6p-104L }, - { -0x1.000000000000d73f9f399da1428p+4L, 0x3.406c46e0e88305d2800f0e414cp-104L }, - { -0x1.0ffffffffffff3569c47e7a93ep+4L, -0x1.c46a08a2e008a998ebabb8087fp-104L }, - { -0x1.1000000000000ca963b81856888p+4L, -0x7.6ca5a3a64ec15db0a95caf2cap-108L }, - { -0x1.1fffffffffffff4bec3ce23413p+4L, -0x2.d08b2b726187c841cb92cd5222p-104L }, - { -0x1.20000000000000b413c31dcbec8p+4L, -0x2.4c3b2ffacbb4932f18dceedfd7p-104L }, - { -0x1.2ffffffffffffff685b25cbf5f8p+4L, 0x2.ba3126cd1c7b7a0822d694705cp-104L }, - { -0x1.30000000000000097a4da340a08p+4L, -0x2.b81b7b1f1f001c72bf914141efp-104L }, - { -0x1.3fffffffffffffff86af516ff8p+4L, 0x8.9429818df2a87abafd48248a2p-108L }, - { -0x1.40000000000000007950ae9008p+4L, -0x8.9413ccc8a353fda263f8ce973cp-108L }, - { -0x1.4ffffffffffffffffa391c4249p+4L, 0x3.d5c63022b62b5484ba346524dbp-104L }, - { -0x1.500000000000000005c6e3bdb7p+4L, -0x3.d5c62f55ed5322b2685c5e9a52p-104L }, - { -0x1.5fffffffffffffffffbcc71a49p+4L, -0x2.01eb5aeb96c74d7ad25e060529p-104L }, - { -0x1.6000000000000000004338e5b7p+4L, 0x2.01eb5aec04b2f2eb663e4e3d8ap-104L }, - { -0x1.6ffffffffffffffffffd13c97d8p+4L, -0x1.d38fcc4d08d6fe5aa56ab04308p-104L }, - { -0x1.70000000000000000002ec36828p+4L, 0x1.d38fcc4d090cee2f5d0b69a99cp-104L }, - { -0x1.7fffffffffffffffffffe0d31p+4L, 0x1.972f577cca4b4c8cb1dc14001bp-104L }, - { -0x1.800000000000000000001f2cfp+4L, -0x1.972f577cca4b3442e35f0040b38p-104L }, - { -0x1.8ffffffffffffffffffffec0c3p+4L, -0x3.22e9a0572b1bb5b95f346a92d6p-104L }, - { -0x1.90000000000000000000013f3dp+4L, 0x3.22e9a0572b1bb5c371ddb35617p-104L }, - { -0x1.9ffffffffffffffffffffff3b88p+4L, -0x3.d01cad8d32e386fd783e97296dp-104L }, - { -0x1.a0000000000000000000000c478p+4L, 0x3.d01cad8d32e386fd7c1ab8c1fep-104L }, - { -0x1.afffffffffffffffffffffff8b8p+4L, -0x1.538f48cc5737d5979c39db806c8p-104L }, - { -0x1.b00000000000000000000000748p+4L, 0x1.538f48cc5737d5979c3b3a6bdap-104L }, - { -0x1.bffffffffffffffffffffffffcp+4L, 0x2.862898d42174dcf171470d8c8cp-104L }, - { -0x1.c0000000000000000000000004p+4L, -0x2.862898d42174dcf171470d18bap-104L }, - { -0x1.dp+4L, 0x2.4b3f31686b15af57c61ceecdf4p-104L }, - { -0x1.dp+4L, -0x2.4b3f31686b15af57c61ceecdd1p-104L }, - { -0x1.ep+4L, 0x1.3932c5047d60e60caded4c298ap-108L }, - { -0x1.ep+4L, -0x1.3932c5047d60e60caded4c29898p-108L }, - { -0x1.fp+4L, 0xa.1a6973c1fade2170f7237d36p-116L }, - { -0x1.fp+4L, -0xa.1a6973c1fade2170f7237d36p-116L }, - { -0x2p+4L, 0x5.0d34b9e0fd6f10b87b91be9bp-120L }, - { -0x2p+4L, -0x5.0d34b9e0fd6f10b87b91be9bp-120L }, - { -0x2.1p+4L, 0x2.73024a9ba1aa36a7059bff52e8p-124L }, - { -0x2.1p+4L, -0x2.73024a9ba1aa36a7059bff52e8p-124L }, - { -0x2.2p+4L, 0x1.2710231c0fd7a13f8a2b4af9d68p-128L }, - { -0x2.2p+4L, -0x1.2710231c0fd7a13f8a2b4af9d68p-128L }, - { -0x2.3p+4L, 0x8.6e2ce38b6c8f9419e3fad3f03p-136L }, - { -0x2.3p+4L, -0x8.6e2ce38b6c8f9419e3fad3f03p-136L }, - { -0x2.4p+4L, 0x3.bf30652185952560d71a254e4fp-140L }, - { -0x2.4p+4L, -0x3.bf30652185952560d71a254e4fp-140L }, - { -0x2.5p+4L, 0x1.9ec8d1c94e85af4c78b15c3d8ap-144L }, - { -0x2.5p+4L, -0x1.9ec8d1c94e85af4c78b15c3d8ap-144L }, - { -0x2.6p+4L, 0xa.ea565ce061d57489e9b8527628p-152L }, - { -0x2.6p+4L, -0xa.ea565ce061d57489e9b8527628p-152L }, - { -0x2.7p+4L, 0x4.7a6512692eb37804111dabad3p-156L }, - { -0x2.7p+4L, -0x4.7a6512692eb37804111dabad3p-156L }, - { -0x2.8p+4L, 0x1.ca8ed42a12ae3001a07244abadp-160L }, - { -0x2.8p+4L, -0x1.ca8ed42a12ae3001a07244abadp-160L }, - { -0x2.9p+4L, 0xb.2f30e1ce812063f12e7e8d8d98p-168L }, - { -0x2.9p+4L, -0xb.2f30e1ce812063f12e7e8d8d98p-168L }, - { -0x2.ap+4L, 0x4.42bd49d4c37a0db136489772e4p-172L }, - { -0x2.ap+4L, -0x4.42bd49d4c37a0db136489772e4p-172L }, - { -0x2.bp+4L, 0x1.95db45257e5122dcbae56def37p-176L }, - { -0x2.bp+4L, -0x1.95db45257e5122dcbae56def37p-176L }, - { -0x2.cp+4L, 0x9.3958d81ff63527ecf993f3fb7p-184L }, - { -0x2.cp+4L, -0x9.3958d81ff63527ecf993f3fb7p-184L }, - { -0x2.dp+4L, 0x3.47970e4440c8f1c058bd238c99p-188L }, - { -0x2.dp+4L, -0x3.47970e4440c8f1c058bd238c99p-188L }, - { -0x2.ep+4L, 0x1.240804f65951062ca46e4f25c6p-192L }, - { -0x2.ep+4L, -0x1.240804f65951062ca46e4f25c6p-192L }, - { -0x2.fp+4L, 0x6.36a382849fae6de2d15362d8a4p-200L }, - { -0x2.fp+4L, -0x6.36a382849fae6de2d15362d8a4p-200L }, - { -0x3p+4L, 0x2.123680d6dfe4cf4b9b1bcb9d8cp-204L }, - }; - -static const long double e_hi = 0x2.b7e151628aed2a6abf7158809dp+0L; -static const long double e_lo = -0xb.0c389d18e9f0c74b25a9587b28p-112L; - -/* Coefficients B_2k / 2k(2k-1) of x^-(2k-1) in Stirling's - approximation to lgamma function. */ - -static const long double lgamma_coeff[] = - { - 0x1.555555555555555555555555558p-4L, - -0xb.60b60b60b60b60b60b60b60b6p-12L, - 0x3.4034034034034034034034034p-12L, - -0x2.7027027027027027027027027p-12L, - 0x3.72a3c5631fe46ae1d4e700dca9p-12L, - -0x7.daac36664f1f207daac36664f2p-12L, - 0x1.a41a41a41a41a41a41a41a41a4p-8L, - -0x7.90a1b2c3d4e5f708192a3b4c5ep-8L, - 0x2.dfd2c703c0cfff430edfd2c704p-4L, - -0x1.6476701181f39edbdb9ce625988p+0L, - 0xd.672219167002d3a7a9c886459cp+0L, - -0x9.cd9292e6660d55b3f712eb9e08p+4L, - 0x8.911a740da740da740da740da74p+8L, - -0x8.d0cc570e255bf59ff6eec24b48p+12L, - 0xa.8d1044d3708d1c219ee4fdc448p+16L, - -0xe.8844d8a169abbc406169abbc4p+20L, - 0x1.6d29a0f6433b79890cede624338p+28L, - -0x2.88a233b3c8cddaba9809357126p+32L, - 0x5.0dde6f27500939a85c40939a86p+36L, - -0xb.4005bde03d4642a243581714bp+40L, - 0x1.bc8cd6f8f1f755c78753cdb5d6p+48L, - -0x4.bbebb143bb94de5a0284fa7ec4p+52L, - 0xe.2e1337f5af0bed90b6b0a352d4p+56L, - -0x2.e78250162b62405ad3e4bfe61bp+64L, - 0xa.5f7eef9e71ac7c80326ab4cc8cp+68L, - -0x2.83be0395e550213369924971b2p+76L, - }; - -#define NCOEFF (sizeof (lgamma_coeff) / sizeof (lgamma_coeff[0])) - -/* Polynomial approximations to (|gamma(x)|-1)(x-n)/(x-x0), where n is - the integer end-point of the half-integer interval containing x and - x0 is the zero of lgamma in that half-integer interval. Each - polynomial is expressed in terms of x-xm, where xm is the midpoint - of the interval for which the polynomial applies. */ - -static const long double poly_coeff[] = - { - /* Interval [-2.125, -2] (polynomial degree 21). */ - -0x1.0b71c5c54d42eb6c17f30b7aa9p+0L, - -0xc.73a1dc05f34951602554c6d76cp-4L, - -0x1.ec841408528b51473e6c42f1c58p-4L, - -0xe.37c9da26fc3c9a3c1844c04b84p-4L, - -0x1.03cd87c519305703b00b046ce4p-4L, - -0xe.ae9ada65e09aa7f1c817c91048p-4L, - 0x9.b11855a4864b571b6a4f571c88p-8L, - -0xe.f28c133e697a95ba2dabb97584p-4L, - 0x2.6ec14a1c586a7ddb6c4be90fe1p-4L, - -0xf.57cab973e14496f0900851c0d4p-4L, - 0x4.5b0fc25f16b0df37175495c70cp-4L, - -0xf.f50e59f1a8fb8c402091e3cd3cp-4L, - 0x6.5f5eae1681d1e50e575c3d4d36p-4L, - -0x1.0d2422dac7ea8a52db6bf0d14fp+0L, - 0x8.820008f221eae5a36e15913bacp-4L, - -0x1.1f492eec53b9481ea23a7e944ep+0L, - 0xa.cb55b4d662945e8cf1f81ee5b4p-4L, - -0x1.3616863983e131d7935700ccd48p+0L, - 0xd.43c783ebab66074d18709d5cap-4L, - -0x1.51d5dbc56bc85976871c6e51f78p+0L, - 0x1.06253af656eb6b2ed998387aabp+0L, - -0x1.7d910a0aadc63d7a1ef7690dbb8p+0L, - /* Interval [-2.25, -2.125] (polynomial degree 22). */ - -0xf.2930890d7d675a80c36afb0fd4p-4L, - -0xc.a5cfde054eab5c6770daeca684p-4L, - 0x3.9c9e0fdebb07cdf89c61d434adp-4L, - -0x1.02a5ad35605fcf4af65a67fe8a8p+0L, - 0x9.6e9b1185bb48be9de18d8bbeb8p-4L, - -0x1.4d8332f3cfbfa116fdf648372cp+0L, - 0x1.1c0c8cb4d9f4b1d495142b53ebp+0L, - -0x1.c9a6f5ae9130ccfb9b7e39136f8p+0L, - 0x1.d7e9307fd58a2e85209d0e83eap+0L, - -0x2.921cb3473d96462f22c171712fp+0L, - 0x2.e8d59113b6f3fc1ed3b556b62cp+0L, - -0x3.cbab931624e3b6cf299cea1213p+0L, - 0x4.7d9f0f05d2c4cf91e41ea1f048p+0L, - -0x5.ade9cba31affa276fe516135eep+0L, - 0x6.dc983a62cf6ddc935ae3c5b9ap+0L, - -0x8.8d9ed100b2a7813f82cbd83e3cp+0L, - 0xa.6fa0926892835a9a29c9b8db8p+0L, - -0xc.ebc90aff4ffe319d70bef0d61p+0L, - 0xf.d69cf50ab226bacece014c0b44p+0L, - -0x1.389964ac7cfef4578eec028e5c8p+4L, - 0x1.7ff0d2090164e25901f97cab3bp+4L, - -0x1.e9e6d282da6bd004619d073071p+4L, - 0x2.5d719ab6ad4be8b5c32b0fba2ap+4L, - /* Interval [-2.375, -2.25] (polynomial degree 24). */ - -0xd.7d28d505d6181218a25f31d5e4p-4L, - -0xe.69649a3040985140cdf946827cp-4L, - 0xb.0d74a2827d053a8d4459500f88p-4L, - -0x1.924b0922853617cac181b097e48p+0L, - 0x1.d49b12bccf0a568582e2dbf8ep+0L, - -0x3.0898bb7d8c4093e6360d26bbc5p+0L, - 0x4.207a6cac711cb538684f74619ep+0L, - -0x6.39ee63ea4fb1dcac86ab337e3cp+0L, - 0x8.e2e2556a797b64a1b9328a3978p+0L, - -0xd.0e83ac82552ee5596df1706ff4p+0L, - 0x1.2e4525e0ce666e48fac68ddcdep+4L, - -0x1.b8e350d6a8f6597ed2eb3c2eff8p+4L, - 0x2.805cd69b9197ee0089dd1b1c46p+4L, - -0x3.a42585423e4d00db075f2d687ep+4L, - 0x5.4b4f409f874e2a7dcd8aa4a62ap+4L, - -0x7.b3c5829962ca1b95535db9cc4ep+4L, - 0xb.33b7b928986ec6b219e2e15a98p+4L, - -0x1.04b76dec4115106bb16316d9cd8p+8L, - 0x1.7b366d8d46f179d5c5302d6534p+8L, - -0x2.2799846ddc54813d40da622b99p+8L, - 0x3.2253a862c1078a3ccabac65bebp+8L, - -0x4.8d92cebc90a4a29816f4952f4ep+8L, - 0x6.9ebb8f9d72c66c80c4f4492e7ap+8L, - -0xa.2850a483f9ba0e43f5848b5cd8p+8L, - 0xe.e1b6bdce83b27944edab8c428p+8L, - /* Interval [-2.5, -2.375] (polynomial degree 25). */ - -0xb.74ea1bcfff94b2c01afba9daa8p-4L, - -0x1.2a82bd590c37538cab143308e3p+0L, - 0x1.88020f828b966fec66b8648d16p+0L, - -0x3.32279f040eb694970e9db0308bp+0L, - 0x5.57ac82517767e68a72142041b4p+0L, - -0x9.c2aedcfe22833de438786dc658p+0L, - 0x1.12c132f1f5577f99dbfb7ecb408p+4L, - -0x1.ea94e26628a3de3557dc349db8p+4L, - 0x3.66b4ac4fa582f5cbe7e19d10c6p+4L, - -0x6.0cf746a9cf4cbcb0004cb01f66p+4L, - 0xa.c102ef2c20d5a313cbfd37f5b8p+4L, - -0x1.31ebff06e8f08f58d1c35eacfdp+8L, - 0x2.1fd6f0c0e788660ba1f1573722p+8L, - -0x3.c6d760404305e75356a86a11d6p+8L, - 0x6.b6d18e0c31a2ba4d5b5ac78676p+8L, - -0xb.efaf5426343e6b41a823ed6c44p+8L, - 0x1.53852db2fe01305b9f336d132d8p+12L, - -0x2.5b977cb2b568382e71ca93a36bp+12L, - 0x4.310d090a6119c7d85a2786a616p+12L, - -0x7.73a518387ef1d4d04917dfb25cp+12L, - 0xd.3f965798601aabd24bdaa6e68cp+12L, - -0x1.78db20b0b166480c93cf0031198p+16L, - 0x2.9be0068b65cf13bd1cf71f0eccp+16L, - -0x4.a221230466b9cd51d5b811d6b6p+16L, - 0x8.f6f8c13e2b52aa3e30a4ce6898p+16L, - -0x1.02145337ff16b44fa7c2adf7f28p+20L, - /* Interval [-2.625, -2.5] (polynomial degree 26). */ - -0x3.d10108c27ebafad533c20eac33p-4L, - 0x1.cd557caff7d2b2085f41dbec538p+0L, - 0x3.819b4856d399520dad9776ebb9p+0L, - 0x6.8505cbad03dc34c5e42e89c4b4p+0L, - 0xb.c1b2e653a9e38f82b3997134a8p+0L, - 0x1.50a53a38f1481381051544750ep+4L, - 0x2.57ae00cbe5232cbeef4e94eb2cp+4L, - 0x4.2b156301b8604db82856d5767p+4L, - 0x7.6989ed23ca3ca751fc9c32eb88p+4L, - 0xd.2dd29765579396f3a456772c44p+4L, - 0x1.76e1c3430eb8630991d1aa8a248p+8L, - 0x2.9a77bf548873743fe65d025f56p+8L, - 0x4.a0d62ed7266389753842d7be74p+8L, - 0x8.3a6184dd32d31ec73fc6f2d37cp+8L, - 0xe.a0ade153a3bf0247db49e11ae8p+8L, - 0x1.a01359fa74d4eaf8858bbc35f68p+12L, - 0x2.e3b0a32845cbc135bae4a5216cp+12L, - 0x5.23012653815fe88456170a7dc6p+12L, - 0x9.21c92dcde748ec199bc9c65738p+12L, - 0x1.03c0f3621b4c67d2d86e5e813d8p+16L, - 0x1.cdc884edcc9f5404f2708551cb8p+16L, - 0x3.35025f0b1624d1ffc86688bf03p+16L, - 0x5.b3bd9562ebf2409c5ce99929ep+16L, - 0xa.1a229b1986d9f89cb80abccfdp+16L, - 0x1.1e69136ebd520146d51837f3308p+20L, - 0x2.2d2738c72449db2524171b9271p+20L, - 0x4.036e80cc6621b836f94f426834p+20L, - /* Interval [-2.75, -2.625] (polynomial degree 24). */ - -0x6.b5d252a56e8a75458a27ed1c2ep-4L, - 0x1.28d60383da3ac721aed3c57949p+0L, - 0x1.db6513ada8a66ea77d87d9a796p+0L, - 0x2.e217118f9d348a27f7506c4b4fp+0L, - 0x4.450112c5cbf725a0fb982fc44cp+0L, - 0x6.4af99151eae7810a75a5fceac8p+0L, - 0x9.2db598b4a97a7f69ab7be31128p+0L, - 0xd.62bef9c22471f5f17955733c6p+0L, - 0x1.379f294e412bd6255506135f4a8p+4L, - 0x1.c5827349d8865d858d4f85f3c38p+4L, - 0x2.93a7e7a75b755bbea1785a1349p+4L, - 0x3.bf9bb882afed66a08b22ed7a45p+4L, - 0x5.73c737828d2044aca95fdef33ep+4L, - 0x7.ee46534920f1c81574db260f0ep+4L, - 0xb.891c6b837b513eaf1592fe78ccp+4L, - 0x1.0c775d815bf741526a3dd66ded8p+8L, - 0x1.867ee44cf11f26455a8924a56bp+8L, - 0x2.37fe968baa1018e55cae680f1dp+8L, - 0x3.3a2c557f686679eb5d8e960fd1p+8L, - 0x4.b1ba0539d4d80cc9174738b992p+8L, - 0x6.d3fd80155b6d2211956cb6bc5ap+8L, - 0x9.eb5a96b0ee3d9ca523f5fbc1fp+8L, - 0xe.6b37429c1acc7dc19ef312dda4p+8L, - 0x1.621132d6aa138b203a28e4792fp+12L, - 0x2.09610219270e2ce11a985d4d36p+12L, - /* Interval [-2.875, -2.75] (polynomial degree 23). */ - -0x8.a41b1e4f36ff88dc820815607cp-4L, - 0xc.da87d3b69dc0f2f9c6f368b8c8p-4L, - 0x1.1474ad5c36158a7bea04fd30b28p+0L, - 0x1.761ecb90c555df6555b7dbb9ce8p+0L, - 0x1.d279bff9ae291caf6c4b17497f8p+0L, - 0x2.4e5d00559a6e2b9b5d7e35b575p+0L, - 0x2.d57545a75cee8743b1ff6e22b8p+0L, - 0x3.8514eee3aac88b89d2d4ddef4ep+0L, - 0x4.5235e3b6e1891fd9c975383318p+0L, - 0x5.562acdb10eef3c14a780490e3cp+0L, - 0x6.8ec8965c76f0b261bc41b5e532p+0L, - 0x8.15251aca144a98a1e1c0981388p+0L, - 0x9.f08d56ab9e7eee9515a457214cp+0L, - 0xc.3dbbeda2620d5be4fe8621ce6p+0L, - 0xf.0f5bfd65b3feb6d745a2cdbf9cp+0L, - 0x1.28a6ccd8dd27fb90fcaa31d37dp+4L, - 0x1.6d0a3a3091c3d64cfd1a3c5769p+4L, - 0x1.c1570107e02d5ab0b8bea6d6c98p+4L, - 0x2.28fc9b295b583fa469de7acceap+4L, - 0x2.a8a4cac0217026bbdbce34f4adp+4L, - 0x3.4532c98bce75262ac0ede53edep+4L, - 0x4.062fd9ba18e00e55c25a4f0688p+4L, - 0x5.22e00e6d9846a3451fad5587f8p+4L, - 0x6.5d0f7ce92a0bf928d4a30e92c6p+4L, - /* Interval [-3, -2.875] (polynomial degree 22). */ - -0xa.046d667e468f3e44dcae1afcc8p-4L, - 0x9.70b88dcc006c214d8d996fdf7p-4L, - 0xa.a8a39421c86d3ff24931a093c4p-4L, - 0xd.2f4d1363f324da2b357c850124p-4L, - 0xd.ca9aa1a3a5c00de11bf5d7047p-4L, - 0xf.cf09c31eeb52a45dfb25e50ebcp-4L, - 0x1.04b133a39ed8a096914cc78812p+0L, - 0x1.22b547a06edda9447f516a2ee7p+0L, - 0x1.2c57fce7db86a91c8d0f12077b8p+0L, - 0x1.4aade4894708fb8b78365e9bf88p+0L, - 0x1.579c8b7b67ec5179ecc4e9c7dp+0L, - 0x1.776820e7fc7361c50e7ef40a88p+0L, - 0x1.883ab28c72ef238ada6c480ab18p+0L, - 0x1.aa2ef6e1d11b9fcea06a1dcab1p+0L, - 0x1.bf4ad50f2dd2aeb02395ea08648p+0L, - 0x1.e40206a5477615838e02279dfc8p+0L, - 0x1.fdcbcfd4b0777fb173b85d5b398p+0L, - 0x2.25e32b3b3c89e833029169a17bp+0L, - 0x2.44ce344ff0bda6570fe3d0a76dp+0L, - 0x2.70bfba6fa079faf2dbf31d2216p+0L, - 0x2.953e22a97725cc179ad21024fap+0L, - 0x2.d8ccc51524659a499eee0f267p+0L, - 0x3.080fbb09c14936c2171c8a51bcp+0L, - }; - -static const size_t poly_deg[] = - { - 21, - 22, - 24, - 25, - 26, - 24, - 23, - 22, - }; - -static const size_t poly_end[] = - { - 21, - 44, - 69, - 95, - 122, - 147, - 171, - 194, - }; - -/* Compute sin (pi * X) for -0.25 <= X <= 0.5. */ - -static long double -lg_sinpi (long double x) -{ - if (x <= 0.25L) - return __sinl (M_PIl * x); - else - return __cosl (M_PIl * (0.5L - x)); -} - -/* Compute cos (pi * X) for -0.25 <= X <= 0.5. */ - -static long double -lg_cospi (long double x) -{ - if (x <= 0.25L) - return __cosl (M_PIl * x); - else - return __sinl (M_PIl * (0.5L - x)); -} - -/* Compute cot (pi * X) for -0.25 <= X <= 0.5. */ - -static long double -lg_cotpi (long double x) -{ - return lg_cospi (x) / lg_sinpi (x); -} - -/* Compute lgamma of a negative argument -48 < X < -2, setting - *SIGNGAMP accordingly. */ - -long double -__lgamma_negl (long double x, int *signgamp) -{ - /* Determine the half-integer region X lies in, handle exact - integers and determine the sign of the result. */ - int i = __floorl (-2 * x); - if ((i & 1) == 0 && i == -2 * x) - return 1.0L / 0.0L; - long double xn = ((i & 1) == 0 ? -i / 2 : (-i - 1) / 2); - i -= 4; - *signgamp = ((i & 2) == 0 ? -1 : 1); - - SET_RESTORE_ROUNDL (FE_TONEAREST); - - /* Expand around the zero X0 = X0_HI + X0_LO. */ - long double x0_hi = lgamma_zeros[i][0], x0_lo = lgamma_zeros[i][1]; - long double xdiff = x - x0_hi - x0_lo; - - /* For arguments in the range -3 to -2, use polynomial - approximations to an adjusted version of the gamma function. */ - if (i < 2) - { - int j = __floorl (-8 * x) - 16; - long double xm = (-33 - 2 * j) * 0.0625L; - long double x_adj = x - xm; - size_t deg = poly_deg[j]; - size_t end = poly_end[j]; - long double g = poly_coeff[end]; - for (size_t j = 1; j <= deg; j++) - g = g * x_adj + poly_coeff[end - j]; - return __log1pl (g * xdiff / (x - xn)); - } - - /* The result we want is log (sinpi (X0) / sinpi (X)) - + log (gamma (1 - X0) / gamma (1 - X)). */ - long double x_idiff = fabsl (xn - x), x0_idiff = fabsl (xn - x0_hi - x0_lo); - long double log_sinpi_ratio; - if (x0_idiff < x_idiff * 0.5L) - /* Use log not log1p to avoid inaccuracy from log1p of arguments - close to -1. */ - log_sinpi_ratio = __ieee754_logl (lg_sinpi (x0_idiff) - / lg_sinpi (x_idiff)); - else - { - /* Use log1p not log to avoid inaccuracy from log of arguments - close to 1. X0DIFF2 has positive sign if X0 is further from - XN than X is from XN, negative sign otherwise. */ - long double x0diff2 = ((i & 1) == 0 ? xdiff : -xdiff) * 0.5L; - long double sx0d2 = lg_sinpi (x0diff2); - long double cx0d2 = lg_cospi (x0diff2); - log_sinpi_ratio = __log1pl (2 * sx0d2 - * (-sx0d2 + cx0d2 * lg_cotpi (x_idiff))); - } - - long double log_gamma_ratio; - long double y0 = 1 - x0_hi; - long double y0_eps = -x0_hi + (1 - y0) - x0_lo; - long double y = 1 - x; - long double y_eps = -x + (1 - y); - /* We now wish to compute LOG_GAMMA_RATIO - = log (gamma (Y0 + Y0_EPS) / gamma (Y + Y_EPS)). XDIFF - accurately approximates the difference Y0 + Y0_EPS - Y - - Y_EPS. Use Stirling's approximation. First, we may need to - adjust into the range where Stirling's approximation is - sufficiently accurate. */ - long double log_gamma_adj = 0; - if (i < 18) - { - int n_up = (19 - i) / 2; - long double ny0, ny0_eps, ny, ny_eps; - ny0 = y0 + n_up; - ny0_eps = y0 - (ny0 - n_up) + y0_eps; - y0 = ny0; - y0_eps = ny0_eps; - ny = y + n_up; - ny_eps = y - (ny - n_up) + y_eps; - y = ny; - y_eps = ny_eps; - long double prodm1 = __lgamma_productl (xdiff, y - n_up, y_eps, n_up); - log_gamma_adj = -__log1pl (prodm1); - } - long double log_gamma_high - = (xdiff * __log1pl ((y0 - e_hi - e_lo + y0_eps) / e_hi) - + (y - 0.5L + y_eps) * __log1pl (xdiff / y) + log_gamma_adj); - /* Compute the sum of (B_2k / 2k(2k-1))(Y0^-(2k-1) - Y^-(2k-1)). */ - long double y0r = 1 / y0, yr = 1 / y; - long double y0r2 = y0r * y0r, yr2 = yr * yr; - long double rdiff = -xdiff / (y * y0); - long double bterm[NCOEFF]; - long double dlast = rdiff, elast = rdiff * yr * (yr + y0r); - bterm[0] = dlast * lgamma_coeff[0]; - for (size_t j = 1; j < NCOEFF; j++) - { - long double dnext = dlast * y0r2 + elast; - long double enext = elast * yr2; - bterm[j] = dnext * lgamma_coeff[j]; - dlast = dnext; - elast = enext; - } - long double log_gamma_low = 0; - for (size_t j = 0; j < NCOEFF; j++) - log_gamma_low += bterm[NCOEFF - 1 - j]; - log_gamma_ratio = log_gamma_high + log_gamma_low; - - return log_sinpi_ratio + log_gamma_ratio; -} diff --git a/sysdeps/ieee754/ldbl-128ibm/lgamma_productl.c b/sysdeps/ieee754/ldbl-128ibm/lgamma_productl.c deleted file mode 100644 index 92c1cffd67..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/lgamma_productl.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Compute a product of 1 + (T/X), 1 + (T/(X+1)), .... - Copyright (C) 2015-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_private.h> -#include <float.h> - -/* Compute the product of 1 + (T / (X + X_EPS)), 1 + (T / (X + X_EPS + - 1)), ..., 1 + (T / (X + X_EPS + N - 1)), minus 1. X is such that - all the values X + 1, ..., X + N - 1 are exactly representable, and - X_EPS / X is small enough that factors quadratic in it can be - neglected. */ - -long double -__lgamma_productl (long double t, long double x, long double x_eps, int n) -{ - long double x_full = x + x_eps; - long double ret = 0; - for (int i = 0; i < n; i++) - /* FIXME: no extra precision used. */ - ret += (t / (x_full + i)) * (1 + ret); - return ret; -} diff --git a/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h b/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h deleted file mode 100644 index 8f2984e924..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h +++ /dev/null @@ -1,290 +0,0 @@ -/* Manipulation of the bit representation of 'long double' quantities. - Copyright (C) 2006-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _MATH_LDBL_H_ -#define _MATH_LDBL_H_ 1 - -#include <ieee754.h> -#include <stdint.h> - -/* To suit our callers we return *hi64 and *lo64 as if they came from - an ieee854 112 bit mantissa, that is, 48 bits in *hi64 (plus one - implicit bit) and 64 bits in *lo64. */ - -static inline void -ldbl_extract_mantissa (int64_t *hi64, uint64_t *lo64, int *exp, long double x) -{ - /* We have 105 bits of mantissa plus one implicit digit. Since - 106 bits are representable we use the first implicit digit for - the number before the decimal point and the second implicit bit - as bit 53 of the mantissa. */ - uint64_t hi, lo; - union ibm_extended_long_double u; - - u.ld = x; - *exp = u.d[0].ieee.exponent - IEEE754_DOUBLE_BIAS; - - lo = ((uint64_t) u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1; - hi = ((uint64_t) u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1; - - if (u.d[0].ieee.exponent != 0) - { - int ediff; - - /* If not a denormal or zero then we have an implicit 53rd bit. */ - hi |= (uint64_t) 1 << 52; - - if (u.d[1].ieee.exponent != 0) - lo |= (uint64_t) 1 << 52; - else - /* A denormal is to be interpreted as having a biased exponent - of 1. */ - lo = lo << 1; - - /* We are going to shift 4 bits out of hi later, because we only - want 48 bits in *hi64. That means we want 60 bits in lo, but - we currently only have 53. Shift the value up. */ - lo = lo << 7; - - /* The lower double is normalized separately from the upper. - We may need to adjust the lower mantissa to reflect this. - The difference between the exponents can be larger than 53 - when the low double is much less than 1ULP of the upper - (in which case there are significant bits, all 0's or all - 1's, between the two significands). The difference between - the exponents can be less than 53 when the upper double - exponent is nearing its minimum value (in which case the low - double is denormal ie. has an exponent of zero). */ - ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent - 53; - if (ediff > 0) - { - if (ediff < 64) - lo = lo >> ediff; - else - lo = 0; - } - else if (ediff < 0) - lo = lo << -ediff; - - if (u.d[0].ieee.negative != u.d[1].ieee.negative - && lo != 0) - { - hi--; - lo = ((uint64_t) 1 << 60) - lo; - if (hi < (uint64_t) 1 << 52) - { - /* We have a borrow from the hidden bit, so shift left 1. */ - hi = (hi << 1) | (lo >> 59); - lo = (((uint64_t) 1 << 60) - 1) & (lo << 1); - *exp = *exp - 1; - } - } - } - else - /* If the larger magnitude double is denormal then the smaller - one must be zero. */ - hi = hi << 1; - - *lo64 = (hi << 60) | lo; - *hi64 = hi >> 4; -} - -static inline long double -ldbl_insert_mantissa (int sign, int exp, int64_t hi64, uint64_t lo64) -{ - union ibm_extended_long_double u; - int expnt2; - uint64_t hi, lo; - - u.d[0].ieee.negative = sign; - u.d[1].ieee.negative = sign; - u.d[0].ieee.exponent = exp + IEEE754_DOUBLE_BIAS; - u.d[1].ieee.exponent = 0; - expnt2 = exp - 53 + IEEE754_DOUBLE_BIAS; - - /* Expect 113 bits (112 bits + hidden) right justified in two longs. - The low order 53 bits (52 + hidden) go into the lower double */ - lo = (lo64 >> 7) & (((uint64_t) 1 << 53) - 1); - /* The high order 53 bits (52 + hidden) go into the upper double */ - hi = lo64 >> 60; - hi |= hi64 << 4; - - if (lo != 0) - { - int lzcount; - - /* hidden bit of low double controls rounding of the high double. - If hidden is '1' and either the explicit mantissa is non-zero - or hi is odd, then round up hi and adjust lo (2nd mantissa) - plus change the sign of the low double to compensate. */ - if ((lo & ((uint64_t) 1 << 52)) != 0 - && ((hi & 1) != 0 || (lo & (((uint64_t) 1 << 52) - 1)) != 0)) - { - hi++; - if ((hi & ((uint64_t) 1 << 53)) != 0) - { - hi = hi >> 1; - u.d[0].ieee.exponent++; - } - u.d[1].ieee.negative = !sign; - lo = ((uint64_t) 1 << 53) - lo; - } - - /* Normalize the low double. Shift the mantissa left until - the hidden bit is '1' and adjust the exponent accordingly. */ - - if (sizeof (lo) == sizeof (long)) - lzcount = __builtin_clzl (lo); - else if ((lo >> 32) != 0) - lzcount = __builtin_clzl ((long) (lo >> 32)); - else - lzcount = __builtin_clzl ((long) lo) + 32; - lzcount = lzcount - (64 - 53); - lo <<= lzcount; - expnt2 -= lzcount; - - if (expnt2 >= 1) - /* Not denormal. */ - u.d[1].ieee.exponent = expnt2; - else - { - /* Is denormal. Note that biased exponent of 0 is treated - as if it was 1, hence the extra shift. */ - if (expnt2 > -53) - lo >>= 1 - expnt2; - else - lo = 0; - } - } - else - u.d[1].ieee.negative = 0; - - u.d[1].ieee.mantissa1 = lo; - u.d[1].ieee.mantissa0 = lo >> 32; - u.d[0].ieee.mantissa1 = hi; - u.d[0].ieee.mantissa0 = hi >> 32; - return u.ld; -} - -/* Handy utility functions to pack/unpack/cononicalize and find the nearbyint - of long double implemented as double double. */ -static inline long double -default_ldbl_pack (double a, double aa) -{ - union ibm_extended_long_double u; - u.d[0].d = a; - u.d[1].d = aa; - return u.ld; -} - -static inline void -default_ldbl_unpack (long double l, double *a, double *aa) -{ - union ibm_extended_long_double u; - u.ld = l; - *a = u.d[0].d; - *aa = u.d[1].d; -} - -#ifndef ldbl_pack -# define ldbl_pack default_ldbl_pack -#endif -#ifndef ldbl_unpack -# define ldbl_unpack default_ldbl_unpack -#endif - -/* Extract high double. */ -#define ldbl_high(x) ((double) x) - -/* Convert a finite long double to canonical form. - Does not handle +/-Inf properly. */ -static inline void -ldbl_canonicalize (double *a, double *aa) -{ - double xh, xl; - - xh = *a + *aa; - xl = (*a - xh) + *aa; - *a = xh; - *aa = xl; -} - -/* Simple inline nearbyint (double) function. - Only works in the default rounding mode - but is useful in long double rounding functions. */ -static inline double -ldbl_nearbyint (double a) -{ - double two52 = 0x1p52; - - if (__glibc_likely ((__builtin_fabs (a) < two52))) - { - if (__glibc_likely ((a > 0.0))) - { - a += two52; - a -= two52; - } - else if (__glibc_likely ((a < 0.0))) - { - a = two52 - a; - a = -(a - two52); - } - } - return a; -} - -/* Canonicalize a result from an integer rounding function, in any - rounding mode. *A and *AA are finite and integers, with *A being - nonzero; if the result is not already canonical, *AA is plus or - minus a power of 2 that does not exceed the least set bit in - *A. */ -static inline void -ldbl_canonicalize_int (double *a, double *aa) -{ - /* Previously we used EXTRACT_WORDS64 from math_private.h, but in order - to avoid including internal headers we duplicate that code here. */ - uint64_t ax, aax; - union { double value; uint64_t word; } extractor; - extractor.value = *a; - ax = extractor.word; - extractor.value = *aa; - aax = extractor.word; - - int expdiff = ((ax >> 52) & 0x7ff) - ((aax >> 52) & 0x7ff); - if (expdiff <= 53) - { - if (expdiff == 53) - { - /* Half way between two double values; noncanonical iff the - low bit of A's mantissa is 1. */ - if ((ax & 1) != 0) - { - *a += 2 * *aa; - *aa = -*aa; - } - } - else - { - /* The sum can be represented in a single double. */ - *a += *aa; - *aa = 0; - } - } -} - -#endif /* math_ldbl.h */ diff --git a/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c b/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c deleted file mode 100644 index 92b28b8b5d..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/mpn2ldbl.c +++ /dev/null @@ -1,161 +0,0 @@ -/* Copyright (C) 1995-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <ieee754.h> -#include <errno.h> -#include <float.h> -#include <math.h> - -/* Need to set this when including gmp headers after system headers. */ -#define HAVE_ALLOCA 1 - -#include "gmp.h" -#include "gmp-impl.h" - -/* Convert a multi-precision integer of the needed number of bits (106 - for long double) and an integral power of two to a `long double' in - IBM extended format. */ - -long double -__mpn_construct_long_double (mp_srcptr frac_ptr, int expt, int sign) -{ - union ibm_extended_long_double u; - unsigned long lzcount; - unsigned long long hi, lo; - int exponent2; - - u.d[0].ieee.negative = sign; - u.d[1].ieee.negative = sign; - u.d[0].ieee.exponent = expt + IEEE754_DOUBLE_BIAS; - u.d[1].ieee.exponent = 0; - exponent2 = expt - 53 + IEEE754_DOUBLE_BIAS; - -#if BITS_PER_MP_LIMB == 32 - /* The low order 53 bits (52 + hidden) go into the lower double */ - lo = frac_ptr[0]; - lo |= (frac_ptr[1] & ((1LL << (53 - 32)) - 1)) << 32; - /* The high order 53 bits (52 + hidden) go into the upper double */ - hi = (frac_ptr[1] >> (53 - 32)) & ((1 << 11) - 1); - hi |= ((unsigned long long) frac_ptr[2]) << 11; - hi |= ((unsigned long long) frac_ptr[3]) << (32 + 11); -#elif BITS_PER_MP_LIMB == 64 - /* The low order 53 bits (52 + hidden) go into the lower double */ - lo = frac_ptr[0] & (((mp_limb_t) 1 << 53) - 1); - /* The high order 53 bits (52 + hidden) go into the upper double */ - hi = (frac_ptr[0] >> 53) & (((mp_limb_t) 1 << 11) - 1); - hi |= (frac_ptr[1] << 11); -#else - #error "mp_limb size " BITS_PER_MP_LIMB "not accounted for" -#endif - - if ((hi & (1LL << 52)) == 0 && (hi | lo) != 0) - { - /* denormal number */ - unsigned long long val = hi ? hi : lo; - - if (sizeof (val) == sizeof (long)) - lzcount = __builtin_clzl (val); - else if ((val >> 32) != 0) - lzcount = __builtin_clzl ((long) (val >> 32)); - else - lzcount = __builtin_clzl ((long) val) + 32; - if (hi) - lzcount = lzcount - (64 - 53); - else - lzcount = lzcount + 53 - (64 - 53); - - if (lzcount > u.d[0].ieee.exponent) - { - lzcount = u.d[0].ieee.exponent; - u.d[0].ieee.exponent = 0; - exponent2 -= lzcount; - } - else - { - u.d[0].ieee.exponent -= (lzcount - 1); - exponent2 -= (lzcount - 1); - } - - if (lzcount <= 53) - { - hi = (hi << lzcount) | (lo >> (53 - lzcount)); - lo = (lo << lzcount) & ((1LL << 53) - 1); - } - else - { - hi = lo << (lzcount - 53); - lo = 0; - } - } - - if (lo != 0) - { - /* hidden bit of low double controls rounding of the high double. - If hidden is '1' and either the explicit mantissa is non-zero - or hi is odd, then round up hi and adjust lo (2nd mantissa) - plus change the sign of the low double to compensate. */ - if ((lo & (1LL << 52)) != 0 - && ((hi & 1) != 0 || (lo & ((1LL << 52) - 1)) != 0)) - { - hi++; - if ((hi & (1LL << 53)) != 0) - { - hi >>= 1; - u.d[0].ieee.exponent++; - if (u.d[0].ieee.exponent == IEEE754_DOUBLE_BIAS + DBL_MAX_EXP) - { - /* Overflow. The appropriate overflowed result must - be produced (if an infinity, that means the low - part must be zero). */ - __set_errno (ERANGE); - return (sign ? -LDBL_MAX : LDBL_MAX) * LDBL_MAX; - } - } - u.d[1].ieee.negative = !sign; - lo = (1LL << 53) - lo; - } - - /* Normalize the low double. Shift the mantissa left until - the hidden bit is '1' and adjust the exponent accordingly. */ - - if (sizeof (lo) == sizeof (long)) - lzcount = __builtin_clzl (lo); - else if ((lo >> 32) != 0) - lzcount = __builtin_clzl ((long) (lo >> 32)); - else - lzcount = __builtin_clzl ((long) lo) + 32; - lzcount = lzcount - (64 - 53); - lo <<= lzcount; - exponent2 -= lzcount; - - if (exponent2 > 0) - u.d[1].ieee.exponent = exponent2; - else if (exponent2 > -53) - lo >>= 1 - exponent2; - else - lo = 0; - } - else - u.d[1].ieee.negative = 0; - - u.d[1].ieee.mantissa1 = lo; - u.d[1].ieee.mantissa0 = lo >> 32; - u.d[0].ieee.mantissa1 = hi; - u.d[0].ieee.mantissa0 = hi >> 32; - - return u.ld; -} diff --git a/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c b/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c deleted file mode 100644 index 2f87ec17cc..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/printf_fphex.c +++ /dev/null @@ -1,139 +0,0 @@ -/* Print floating point number in hexadecimal notation according to ISO C99. - Copyright (C) 1997-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#define PRINT_FPHEX_LONG_DOUBLE \ -do { \ - /* We have 105 bits of mantissa plus one implicit digit. Since \ - 106 bits are representable without rest using hexadecimal \ - digits we use only the implicit digits for the number before \ - the decimal point. */ \ - unsigned long long int num0, num1; \ - unsigned long long hi, lo; \ - int ediff; \ - union ibm_extended_long_double u; \ - u.ld = fpnum.ldbl; \ - \ - assert (sizeof (long double) == 16); \ - \ - lo = ((long long)u.d[1].ieee.mantissa0 << 32) | u.d[1].ieee.mantissa1; \ - hi = ((long long)u.d[0].ieee.mantissa0 << 32) | u.d[0].ieee.mantissa1; \ - lo <<= 7; /* pre-shift lo to match ieee854. */ \ - /* If the lower double is not a denormal or zero then set the hidden \ - 53rd bit. */ \ - if (u.d[1].ieee.exponent != 0) \ - lo |= (1ULL << (52 + 7)); \ - else \ - lo <<= 1; \ - /* The lower double is normalized separately from the upper. We \ - may need to adjust the lower manitissa to reflect this. */ \ - ediff = u.d[0].ieee.exponent - u.d[1].ieee.exponent - 53; \ - if (ediff > 63) \ - lo = 0; \ - else if (ediff > 0) \ - lo = lo >> ediff; \ - else if (ediff < 0) \ - lo = lo << -ediff; \ - if (u.d[0].ieee.negative != u.d[1].ieee.negative \ - && lo != 0) \ - { \ - lo = (1ULL << 60) - lo; \ - if (hi == 0L) \ - { \ - /* we have a borrow from the hidden bit, so shift left 1. */ \ - hi = 0xffffffffffffeLL | (lo >> 59); \ - lo = 0xfffffffffffffffLL & (lo << 1); \ - u.d[0].ieee.exponent--; \ - } \ - else \ - hi--; \ - } \ - num1 = (hi << 60) | lo; \ - num0 = hi >> 4; \ - \ - zero_mantissa = (num0|num1) == 0; \ - \ - if (sizeof (unsigned long int) > 6) \ - { \ - numstr = _itoa_word (num1, numbuf + sizeof numbuf, 16, \ - info->spec == 'A'); \ - wnumstr = _itowa_word (num1, \ - wnumbuf + sizeof (wnumbuf) / sizeof (wchar_t),\ - 16, info->spec == 'A'); \ - } \ - else \ - { \ - numstr = _itoa (num1, numbuf + sizeof numbuf, 16, \ - info->spec == 'A'); \ - wnumstr = _itowa (num1, \ - wnumbuf + sizeof (wnumbuf) / sizeof (wchar_t), \ - 16, info->spec == 'A'); \ - } \ - \ - while (numstr > numbuf + (sizeof numbuf - 64 / 4)) \ - { \ - *--numstr = '0'; \ - *--wnumstr = L'0'; \ - } \ - \ - if (sizeof (unsigned long int) > 6) \ - { \ - numstr = _itoa_word (num0, numstr, 16, info->spec == 'A'); \ - wnumstr = _itowa_word (num0, wnumstr, 16, info->spec == 'A'); \ - } \ - else \ - { \ - numstr = _itoa (num0, numstr, 16, info->spec == 'A'); \ - wnumstr = _itowa (num0, wnumstr, 16, info->spec == 'A'); \ - } \ - \ - /* Fill with zeroes. */ \ - while (numstr > numbuf + (sizeof numbuf - 112 / 4)) \ - { \ - *--numstr = '0'; \ - *--wnumstr = L'0'; \ - } \ - \ - leading = u.d[0].ieee.exponent == 0 ? '0' : '1'; \ - \ - exponent = u.d[0].ieee.exponent; \ - \ - if (exponent == 0) \ - { \ - if (zero_mantissa) \ - expnegative = 0; \ - else \ - { \ - /* This is a denormalized number. */ \ - expnegative = 1; \ - exponent = IEEE754_DOUBLE_BIAS - 1; \ - } \ - } \ - else if (exponent >= IEEE754_DOUBLE_BIAS) \ - { \ - expnegative = 0; \ - exponent -= IEEE754_DOUBLE_BIAS; \ - } \ - else \ - { \ - expnegative = 1; \ - exponent = -(exponent - IEEE754_DOUBLE_BIAS); \ - } \ -} while (0) - -#include <stdio-common/printf_fphex.c> diff --git a/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c b/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c deleted file mode 100644 index aa9a9ba213..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_asinhl.c +++ /dev/null @@ -1,63 +0,0 @@ -/* @(#)s_asinh.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_asinh.c,v 1.9 1995/05/12 04:57:37 jtc Exp $"; -#endif - -/* asinh(x) - * Method : - * Based on - * asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ] - * we have - * asinh(x) := x if 1+x*x=1, - * := sign(x)*(log(x)+ln2)) for large |x|, else - * := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else - * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2))) - */ - -#include <float.h> -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -static const long double -one = 1.00000000000000000000e+00L, /* 0x3ff0000000000000, 0 */ -ln2 = 0.6931471805599453094172321214581766L, /* 0x3fe62e42fefa39ef, 0x3c7abc9e3b398040 */ -huge= 1.00000000000000000000e+300L; - -long double __asinhl(long double x) -{ - long double t,w; - int64_t hx,ix; - double xhi; - - xhi = ldbl_high (x); - EXTRACT_WORDS64 (hx, xhi); - ix = hx&0x7fffffffffffffffLL; - if(ix>=0x7ff0000000000000LL) return x+x; /* x is inf or NaN */ - if(ix< 0x3c70000000000000LL) { /* |x|<2**-56 */ - math_check_force_underflow (x); - if(huge+x>one) return x; /* return x inexact except 0 */ - } - if(ix>0x4370000000000000LL) { /* |x| > 2**56 */ - w = __ieee754_logl(fabsl(x))+ln2; - } else if (ix>0x4000000000000000LL) { /* 2**56 >= |x| > 2.0 */ - t = fabs(x); - w = __ieee754_logl(2.0*t+one/(__ieee754_sqrtl(x*x+one)+t)); - } else { /* 2.0 >= |x| >= 2**-56 */ - t = x*x; - w =__log1pl(fabsl(x)+t/(one+__ieee754_sqrtl(one+t))); - } - if(hx>0) return w; else return -w; -} -long_double_symbol (libm, __asinhl, asinhl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_atanl.c b/sysdeps/ieee754/ldbl-128ibm/s_atanl.c deleted file mode 100644 index 0560d820ae..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_atanl.c +++ /dev/null @@ -1,250 +0,0 @@ -/* s_atanl.c - * - * Inverse circular tangent for 128-bit long double precision - * (arctangent) - * - * - * - * SYNOPSIS: - * - * long double x, y, atanl(); - * - * y = atanl( x ); - * - * - * - * DESCRIPTION: - * - * Returns radian angle between -pi/2 and +pi/2 whose tangent is x. - * - * The function uses a rational approximation of the form - * t + t^3 P(t^2)/Q(t^2), optimized for |t| < 0.09375. - * - * The argument is reduced using the identity - * arctan x - arctan u = arctan ((x-u)/(1 + ux)) - * and an 83-entry lookup table for arctan u, with u = 0, 1/8, ..., 10.25. - * Use of the table improves the execution speed of the routine. - * - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE -19, 19 4e5 1.7e-34 5.4e-35 - * - * - * WARNING: - * - * This program uses integer operations on bit fields of floating-point - * numbers. It does not work with data structures other than the - * structure assumed. - * - */ - -/* Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov> - - This 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. - - This 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 this library; if not, see - <http://www.gnu.org/licenses/>. */ - - -#include <float.h> -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -/* arctan(k/8), k = 0, ..., 82 */ -static const long double atantbl[84] = { - 0.0000000000000000000000000000000000000000E0L, - 1.2435499454676143503135484916387102557317E-1L, /* arctan(0.125) */ - 2.4497866312686415417208248121127581091414E-1L, - 3.5877067027057222039592006392646049977698E-1L, - 4.6364760900080611621425623146121440202854E-1L, - 5.5859931534356243597150821640166127034645E-1L, - 6.4350110879328438680280922871732263804151E-1L, - 7.1882999962162450541701415152590465395142E-1L, - 7.8539816339744830961566084581987572104929E-1L, - 8.4415398611317100251784414827164750652594E-1L, - 8.9605538457134395617480071802993782702458E-1L, - 9.4200004037946366473793717053459358607166E-1L, - 9.8279372324732906798571061101466601449688E-1L, - 1.0191413442663497346383429170230636487744E0L, - 1.0516502125483736674598673120862998296302E0L, - 1.0808390005411683108871567292171998202703E0L, - 1.1071487177940905030170654601785370400700E0L, - 1.1309537439791604464709335155363278047493E0L, - 1.1525719972156675180401498626127513797495E0L, - 1.1722738811284763866005949441337046149712E0L, - 1.1902899496825317329277337748293183376012E0L, - 1.2068173702852525303955115800565576303133E0L, - 1.2220253232109896370417417439225704908830E0L, - 1.2360594894780819419094519711090786987027E0L, - 1.2490457723982544258299170772810901230778E0L, - 1.2610933822524404193139408812473357720101E0L, - 1.2722973952087173412961937498224804940684E0L, - 1.2827408797442707473628852511364955306249E0L, - 1.2924966677897852679030914214070816845853E0L, - 1.3016288340091961438047858503666855921414E0L, - 1.3101939350475556342564376891719053122733E0L, - 1.3182420510168370498593302023271362531155E0L, - 1.3258176636680324650592392104284756311844E0L, - 1.3329603993374458675538498697331558093700E0L, - 1.3397056595989995393283037525895557411039E0L, - 1.3460851583802539310489409282517796256512E0L, - 1.3521273809209546571891479413898128509842E0L, - 1.3578579772154994751124898859640585287459E0L, - 1.3633001003596939542892985278250991189943E0L, - 1.3684746984165928776366381936948529556191E0L, - 1.3734007669450158608612719264449611486510E0L, - 1.3780955681325110444536609641291551522494E0L, - 1.3825748214901258580599674177685685125566E0L, - 1.3868528702577214543289381097042486034883E0L, - 1.3909428270024183486427686943836432060856E0L, - 1.3948567013423687823948122092044222644895E0L, - 1.3986055122719575950126700816114282335732E0L, - 1.4021993871854670105330304794336492676944E0L, - 1.4056476493802697809521934019958079881002E0L, - 1.4089588955564736949699075250792569287156E0L, - 1.4121410646084952153676136718584891599630E0L, - 1.4152014988178669079462550975833894394929E0L, - 1.4181469983996314594038603039700989523716E0L, - 1.4209838702219992566633046424614466661176E0L, - 1.4237179714064941189018190466107297503086E0L, - 1.4263547484202526397918060597281265695725E0L, - 1.4288992721907326964184700745371983590908E0L, - 1.4313562697035588982240194668401779312122E0L, - 1.4337301524847089866404719096698873648610E0L, - 1.4360250423171655234964275337155008780675E0L, - 1.4382447944982225979614042479354815855386E0L, - 1.4403930189057632173997301031392126865694E0L, - 1.4424730991091018200252920599377292525125E0L, - 1.4444882097316563655148453598508037025938E0L, - 1.4464413322481351841999668424758804165254E0L, - 1.4483352693775551917970437843145232637695E0L, - 1.4501726582147939000905940595923466567576E0L, - 1.4519559822271314199339700039142990228105E0L, - 1.4536875822280323362423034480994649820285E0L, - 1.4553696664279718992423082296859928222270E0L, - 1.4570043196511885530074841089245667532358E0L, - 1.4585935117976422128825857356750737658039E0L, - 1.4601391056210009726721818194296893361233E0L, - 1.4616428638860188872060496086383008594310E0L, - 1.4631064559620759326975975316301202111560E0L, - 1.4645314639038178118428450961503371619177E0L, - 1.4659193880646627234129855241049975398470E0L, - 1.4672716522843522691530527207287398276197E0L, - 1.4685896086876430842559640450619880951144E0L, - 1.4698745421276027686510391411132998919794E0L, - 1.4711276743037345918528755717617308518553E0L, - 1.4723501675822635384916444186631899205983E0L, - 1.4735431285433308455179928682541563973416E0L, /* arctan(10.25) */ - 1.5707963267948966192313216916397514420986E0L /* pi/2 */ -}; - - -/* arctan t = t + t^3 p(t^2) / q(t^2) - |t| <= 0.09375 - peak relative error 5.3e-37 */ - -static const long double - p0 = -4.283708356338736809269381409828726405572E1L, - p1 = -8.636132499244548540964557273544599863825E1L, - p2 = -5.713554848244551350855604111031839613216E1L, - p3 = -1.371405711877433266573835355036413750118E1L, - p4 = -8.638214309119210906997318946650189640184E-1L, - q0 = 1.285112506901621042780814422948906537959E2L, - q1 = 3.361907253914337187957855834229672347089E2L, - q2 = 3.180448303864130128268191635189365331680E2L, - q3 = 1.307244136980865800160844625025280344686E2L, - q4 = 2.173623741810414221251136181221172551416E1L; - /* q5 = 1.000000000000000000000000000000000000000E0 */ - - -long double -__atanl (long double x) -{ - int32_t k, sign, lx; - long double t, u, p, q; - double xhi; - - xhi = ldbl_high (x); - EXTRACT_WORDS (k, lx, xhi); - sign = k & 0x80000000; - - /* Check for IEEE special cases. */ - k &= 0x7fffffff; - if (k >= 0x7ff00000) - { - /* NaN. */ - if (((k - 0x7ff00000) | lx) != 0) - return (x + x); - - /* Infinity. */ - if (sign) - return -atantbl[83]; - else - return atantbl[83]; - } - - if (k <= 0x3c800000) /* |x| <= 2**-55. */ - { - math_check_force_underflow (x); - /* Raise inexact. */ - if (1e300L + x > 0.0) - return x; - } - - if (k >= 0x46c00000) /* |x| >= 2**109. */ - { - /* Saturate result to {-,+}pi/2. */ - if (sign) - return -atantbl[83]; - else - return atantbl[83]; - } - - if (sign) - x = -x; - - if (k >= 0x40248000) /* 10.25 */ - { - k = 83; - t = -1.0/x; - } - else - { - /* Index of nearest table element. - Roundoff to integer is asymmetrical to avoid cancellation when t < 0 - (cf. fdlibm). */ - k = 8.0 * x + 0.25; - u = 0.125 * k; - /* Small arctan argument. */ - t = (x - u) / (1.0 + x * u); - } - - /* Arctan of small argument t. */ - u = t * t; - p = ((((p4 * u) + p3) * u + p2) * u + p1) * u + p0; - q = ((((u + q4) * u + q3) * u + q2) * u + q1) * u + q0; - u = t * u * p / q + t; - - /* arctan x = arctan u + arctan t */ - u = atantbl[k] + u; - if (sign) - return (-u); - else - return u; -} - -long_double_symbol (libm, __atanl, atanl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c b/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c deleted file mode 100644 index 64bfc46414..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_cbrtl.c +++ /dev/null @@ -1,10 +0,0 @@ -/* Looks like we can use ieee854 s_cbrtl.c as is for IBM extended format. */ -#include <math_ldbl_opt.h> -#undef weak_alias -#define weak_alias(n,a) - -#define _Float128 long double -#define L(x) x ## L - -#include <sysdeps/ieee754/ldbl-128/s_cbrtl.c> -long_double_symbol (libm, __cbrtl, cbrtl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_ceill.c b/sysdeps/ieee754/ldbl-128ibm/s_ceill.c deleted file mode 100644 index c451825c62..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_ceill.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Ceil (round to +inf) long double floating-point values. - IBM extended format long double version. - Copyright (C) 2006-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_ldbl_opt.h> -#include <float.h> -#include <ieee754.h> - - -long double -__ceill (long double x) -{ - double xh, xl, hi, lo; - - ldbl_unpack (x, &xh, &xl); - - /* Return Inf, Nan, +/-0 unchanged. */ - if (__builtin_expect (xh != 0.0 - && __builtin_isless (__builtin_fabs (xh), - __builtin_inf ()), 1)) - { - hi = __ceil (xh); - if (hi != xh) - { - /* The high part is not an integer; the low part does not - affect the result. */ - xh = hi; - xl = 0; - } - else - { - /* The high part is a nonzero integer. */ - lo = __ceil (xl); - xh = hi; - xl = lo; - ldbl_canonicalize_int (&xh, &xl); - } - } - else - /* Quiet signaling NaN arguments. */ - xh += xh; - - return ldbl_pack (xh, xl); -} - -long_double_symbol (libm, __ceill, ceill); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c b/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c deleted file mode 100644 index 3b8ec1a74d..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_copysignl.c +++ /dev/null @@ -1,41 +0,0 @@ -/* s_copysignl.c -- long double version of s_copysign.c. - * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * copysignl(long double x, long double y) - * copysignl(x,y) returns a value with the magnitude of x and - * with the sign bit of y. - */ - -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -long double __copysignl(long double x, long double y) -{ - if (signbit (x) != signbit (y)) - x = -x; - return x; -} - -#if IS_IN (libm) -long_double_symbol (libm, __copysignl, copysignl); -#else -long_double_symbol (libc, __copysignl, copysignl); -#endif diff --git a/sysdeps/ieee754/ldbl-128ibm/s_cosl.c b/sysdeps/ieee754/ldbl-128ibm/s_cosl.c deleted file mode 100644 index 54c6cc77d2..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_cosl.c +++ /dev/null @@ -1,88 +0,0 @@ -/* s_cosl.c -- long double version of s_cos.c. - * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* cosl(x) - * Return cosine function of x. - * - * kernel function: - * __kernel_sinl ... sine function on [-pi/4,pi/4] - * __kernel_cosl ... cosine function on [-pi/4,pi/4] - * __ieee754_rem_pio2l ... argument reduction routine - * - * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 - * in [-pi/4 , +pi/4], and let n = k mod 4. - * We have - * - * n sin(x) cos(x) tan(x) - * ---------------------------------------------------------- - * 0 S C T - * 1 C -S -1/T - * 2 -S -C T - * 3 -C S -1/T - * ---------------------------------------------------------- - * - * Special cases: - * Let trig be any of sin, cos, or tan. - * trig(+-INF) is NaN, with signals; - * trig(NaN) is that NaN; - * - * Accuracy: - * TRIG(x) returns trig(x) nearly rounded - */ - -#include <errno.h> -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -long double __cosl(long double x) -{ - long double y[2],z=0.0L; - int64_t n, ix; - double xhi; - - /* High word of x. */ - xhi = ldbl_high (x); - EXTRACT_WORDS64 (ix, xhi); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffffffffffffLL; - if(ix <= 0x3fe921fb54442d18LL) - return __kernel_cosl(x,z); - - /* cos(Inf or NaN) is NaN */ - else if (ix>=0x7ff0000000000000LL) { - if (ix == 0x7ff0000000000000LL) - __set_errno (EDOM); - return x-x; - } - /* argument reduction needed */ - else { - n = __ieee754_rem_pio2l(x,y); - switch(n&3) { - case 0: - return __kernel_cosl(y[0],y[1]); - case 1: - return -__kernel_sinl(y[0],y[1],1); - case 2: - return -__kernel_cosl(y[0],y[1]); - default: - return __kernel_sinl(y[0],y[1],1); - } - } -} -long_double_symbol (libm, __cosl, cosl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_erfl.c b/sysdeps/ieee754/ldbl-128ibm/s_erfl.c deleted file mode 100644 index 7b761b0afa..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_erfl.c +++ /dev/null @@ -1,970 +0,0 @@ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* Modifications and expansions for 128-bit long double are - Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov> - and are incorporated herein by permission of the author. The author - reserves the right to distribute this material elsewhere under different - copying permissions. These modifications are distributed here under - the following terms: - - This 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. - - This 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 this library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* double erf(double x) - * double erfc(double x) - * x - * 2 |\ - * erf(x) = --------- | exp(-t*t)dt - * sqrt(pi) \| - * 0 - * - * erfc(x) = 1-erf(x) - * Note that - * erf(-x) = -erf(x) - * erfc(-x) = 2 - erfc(x) - * - * Method: - * 1. erf(x) = x + x*R(x^2) for |x| in [0, 7/8] - * Remark. The formula is derived by noting - * erf(x) = (2/sqrt(pi))*(x - x^3/3 + x^5/10 - x^7/42 + ....) - * and that - * 2/sqrt(pi) = 1.128379167095512573896158903121545171688 - * is close to one. - * - * 1a. erf(x) = 1 - erfc(x), for |x| > 1.0 - * erfc(x) = 1 - erf(x) if |x| < 1/4 - * - * 2. For |x| in [7/8, 1], let s = |x| - 1, and - * c = 0.84506291151 rounded to single (24 bits) - * erf(s + c) = sign(x) * (c + P1(s)/Q1(s)) - * Remark: here we use the taylor series expansion at x=1. - * erf(1+s) = erf(1) + s*Poly(s) - * = 0.845.. + P1(s)/Q1(s) - * Note that |P1/Q1|< 0.078 for x in [0.84375,1.25] - * - * 3. For x in [1/4, 5/4], - * erfc(s + const) = erfc(const) + s P1(s)/Q1(s) - * for const = 1/4, 3/8, ..., 9/8 - * and 0 <= s <= 1/8 . - * - * 4. For x in [5/4, 107], - * erfc(x) = (1/x)*exp(-x*x-0.5625 + R(z)) - * z=1/x^2 - * The interval is partitioned into several segments - * of width 1/8 in 1/x. - * erf(x) = 1.0 - erfc(x) if x < 25.6283 else - * erf(x) = sign(x)*(1.0 - tiny) - * - * Note1: - * To compute exp(-x*x-0.5625+R/S), let s be a single - * precision number and s := x; then - * -x*x = -s*s + (s-x)*(s+x) - * exp(-x*x-0.5626+R/S) = - * exp(-s*s-0.5625)*exp((s-x)*(s+x)+R/S); - * Note2: - * Here 4 and 5 make use of the asymptotic series - * exp(-x*x) - * erfc(x) ~ ---------- * ( 1 + Poly(1/x^2) ) - * x*sqrt(pi) - * - * Note3: - * For x higher than 25.6283, erf(x) underflows. - * - * 5. For inf > x >= 107 - * erf(x) = sign(x) *(1 - tiny) (raise inexact) - * erfc(x) = tiny*tiny (raise underflow) if x > 0 - * = 2 - tiny if x<0 - * - * 7. Special case: - * erf(0) = 0, erf(inf) = 1, erf(-inf) = -1, - * erfc(0) = 1, erfc(inf) = 0, erfc(-inf) = 2, - * erfc/erf(NaN) is NaN - */ - -#include <errno.h> -#include <float.h> -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> -#include <fix-int-fp-convert-zero.h> - -/* Evaluate P[n] x^n + P[n-1] x^(n-1) + ... + P[0] */ - -static long double -neval (long double x, const long double *p, int n) -{ - long double y; - - p += n; - y = *p--; - do - { - y = y * x + *p--; - } - while (--n > 0); - return y; -} - - -/* Evaluate x^n+1 + P[n] x^(n) + P[n-1] x^(n-1) + ... + P[0] */ - -static long double -deval (long double x, const long double *p, int n) -{ - long double y; - - p += n; - y = x + *p--; - do - { - y = y * x + *p--; - } - while (--n > 0); - return y; -} - - - -static const long double -tiny = 1e-300L, - one = 1.0L, - two = 2.0L, - /* 2/sqrt(pi) - 1 */ - efx = 1.2837916709551257389615890312154517168810E-1L; - - -/* erf(x) = x + x R(x^2) - 0 <= x <= 7/8 - Peak relative error 1.8e-35 */ -#define NTN1 8 -static const long double TN1[NTN1 + 1] = -{ - -3.858252324254637124543172907442106422373E10L, - 9.580319248590464682316366876952214879858E10L, - 1.302170519734879977595901236693040544854E10L, - 2.922956950426397417800321486727032845006E9L, - 1.764317520783319397868923218385468729799E8L, - 1.573436014601118630105796794840834145120E7L, - 4.028077380105721388745632295157816229289E5L, - 1.644056806467289066852135096352853491530E4L, - 3.390868480059991640235675479463287886081E1L -}; -#define NTD1 8 -static const long double TD1[NTD1 + 1] = -{ - -3.005357030696532927149885530689529032152E11L, - -1.342602283126282827411658673839982164042E11L, - -2.777153893355340961288511024443668743399E10L, - -3.483826391033531996955620074072768276974E9L, - -2.906321047071299585682722511260895227921E8L, - -1.653347985722154162439387878512427542691E7L, - -6.245520581562848778466500301865173123136E5L, - -1.402124304177498828590239373389110545142E4L, - -1.209368072473510674493129989468348633579E2L -/* 1.0E0 */ -}; - - -/* erf(z+1) = erf_const + P(z)/Q(z) - -.125 <= z <= 0 - Peak relative error 7.3e-36 */ -static const long double erf_const = 0.845062911510467529296875L; -#define NTN2 8 -static const long double TN2[NTN2 + 1] = -{ - -4.088889697077485301010486931817357000235E1L, - 7.157046430681808553842307502826960051036E3L, - -2.191561912574409865550015485451373731780E3L, - 2.180174916555316874988981177654057337219E3L, - 2.848578658049670668231333682379720943455E2L, - 1.630362490952512836762810462174798925274E2L, - 6.317712353961866974143739396865293596895E0L, - 2.450441034183492434655586496522857578066E1L, - 5.127662277706787664956025545897050896203E-1L -}; -#define NTD2 8 -static const long double TD2[NTD2 + 1] = -{ - 1.731026445926834008273768924015161048885E4L, - 1.209682239007990370796112604286048173750E4L, - 1.160950290217993641320602282462976163857E4L, - 5.394294645127126577825507169061355698157E3L, - 2.791239340533632669442158497532521776093E3L, - 8.989365571337319032943005387378993827684E2L, - 2.974016493766349409725385710897298069677E2L, - 6.148192754590376378740261072533527271947E1L, - 1.178502892490738445655468927408440847480E1L - /* 1.0E0 */ -}; - - -/* erfc(x + 0.25) = erfc(0.25) + x R(x) - 0 <= x < 0.125 - Peak relative error 1.4e-35 */ -#define NRNr13 8 -static const long double RNr13[NRNr13 + 1] = -{ - -2.353707097641280550282633036456457014829E3L, - 3.871159656228743599994116143079870279866E2L, - -3.888105134258266192210485617504098426679E2L, - -2.129998539120061668038806696199343094971E1L, - -8.125462263594034672468446317145384108734E1L, - 8.151549093983505810118308635926270319660E0L, - -5.033362032729207310462422357772568553670E0L, - -4.253956621135136090295893547735851168471E-2L, - -8.098602878463854789780108161581050357814E-2L -}; -#define NRDr13 7 -static const long double RDr13[NRDr13 + 1] = -{ - 2.220448796306693503549505450626652881752E3L, - 1.899133258779578688791041599040951431383E2L, - 1.061906712284961110196427571557149268454E3L, - 7.497086072306967965180978101974566760042E1L, - 2.146796115662672795876463568170441327274E2L, - 1.120156008362573736664338015952284925592E1L, - 2.211014952075052616409845051695042741074E1L, - 6.469655675326150785692908453094054988938E-1L - /* 1.0E0 */ -}; -/* erfc(0.25) = C13a + C13b to extra precision. */ -static const long double C13a = 0.723663330078125L; -static const long double C13b = 1.0279753638067014931732235184287934646022E-5L; - - -/* erfc(x + 0.375) = erfc(0.375) + x R(x) - 0 <= x < 0.125 - Peak relative error 1.2e-35 */ -#define NRNr14 8 -static const long double RNr14[NRNr14 + 1] = -{ - -2.446164016404426277577283038988918202456E3L, - 6.718753324496563913392217011618096698140E2L, - -4.581631138049836157425391886957389240794E2L, - -2.382844088987092233033215402335026078208E1L, - -7.119237852400600507927038680970936336458E1L, - 1.313609646108420136332418282286454287146E1L, - -6.188608702082264389155862490056401365834E0L, - -2.787116601106678287277373011101132659279E-2L, - -2.230395570574153963203348263549700967918E-2L -}; -#define NRDr14 7 -static const long double RDr14[NRDr14 + 1] = -{ - 2.495187439241869732696223349840963702875E3L, - 2.503549449872925580011284635695738412162E2L, - 1.159033560988895481698051531263861842461E3L, - 9.493751466542304491261487998684383688622E1L, - 2.276214929562354328261422263078480321204E2L, - 1.367697521219069280358984081407807931847E1L, - 2.276988395995528495055594829206582732682E1L, - 7.647745753648996559837591812375456641163E-1L - /* 1.0E0 */ -}; -/* erfc(0.375) = C14a + C14b to extra precision. */ -static const long double C14a = 0.5958709716796875L; -static const long double C14b = 1.2118885490201676174914080878232469565953E-5L; - -/* erfc(x + 0.5) = erfc(0.5) + x R(x) - 0 <= x < 0.125 - Peak relative error 4.7e-36 */ -#define NRNr15 8 -static const long double RNr15[NRNr15 + 1] = -{ - -2.624212418011181487924855581955853461925E3L, - 8.473828904647825181073831556439301342756E2L, - -5.286207458628380765099405359607331669027E2L, - -3.895781234155315729088407259045269652318E1L, - -6.200857908065163618041240848728398496256E1L, - 1.469324610346924001393137895116129204737E1L, - -6.961356525370658572800674953305625578903E0L, - 5.145724386641163809595512876629030548495E-3L, - 1.990253655948179713415957791776180406812E-2L -}; -#define NRDr15 7 -static const long double RDr15[NRDr15 + 1] = -{ - 2.986190760847974943034021764693341524962E3L, - 5.288262758961073066335410218650047725985E2L, - 1.363649178071006978355113026427856008978E3L, - 1.921707975649915894241864988942255320833E2L, - 2.588651100651029023069013885900085533226E2L, - 2.628752920321455606558942309396855629459E1L, - 2.455649035885114308978333741080991380610E1L, - 1.378826653595128464383127836412100939126E0L - /* 1.0E0 */ -}; -/* erfc(0.5) = C15a + C15b to extra precision. */ -static const long double C15a = 0.4794921875L; -static const long double C15b = 7.9346869534623172533461080354712635484242E-6L; - -/* erfc(x + 0.625) = erfc(0.625) + x R(x) - 0 <= x < 0.125 - Peak relative error 5.1e-36 */ -#define NRNr16 8 -static const long double RNr16[NRNr16 + 1] = -{ - -2.347887943200680563784690094002722906820E3L, - 8.008590660692105004780722726421020136482E2L, - -5.257363310384119728760181252132311447963E2L, - -4.471737717857801230450290232600243795637E1L, - -4.849540386452573306708795324759300320304E1L, - 1.140885264677134679275986782978655952843E1L, - -6.731591085460269447926746876983786152300E0L, - 1.370831653033047440345050025876085121231E-1L, - 2.022958279982138755020825717073966576670E-2L, -}; -#define NRDr16 7 -static const long double RDr16[NRDr16 + 1] = -{ - 3.075166170024837215399323264868308087281E3L, - 8.730468942160798031608053127270430036627E2L, - 1.458472799166340479742581949088453244767E3L, - 3.230423687568019709453130785873540386217E2L, - 2.804009872719893612081109617983169474655E2L, - 4.465334221323222943418085830026979293091E1L, - 2.612723259683205928103787842214809134746E1L, - 2.341526751185244109722204018543276124997E0L, - /* 1.0E0 */ -}; -/* erfc(0.625) = C16a + C16b to extra precision. */ -static const long double C16a = 0.3767547607421875L; -static const long double C16b = 4.3570693945275513594941232097252997287766E-6L; - -/* erfc(x + 0.75) = erfc(0.75) + x R(x) - 0 <= x < 0.125 - Peak relative error 1.7e-35 */ -#define NRNr17 8 -static const long double RNr17[NRNr17 + 1] = -{ - -1.767068734220277728233364375724380366826E3L, - 6.693746645665242832426891888805363898707E2L, - -4.746224241837275958126060307406616817753E2L, - -2.274160637728782675145666064841883803196E1L, - -3.541232266140939050094370552538987982637E1L, - 6.988950514747052676394491563585179503865E0L, - -5.807687216836540830881352383529281215100E0L, - 3.631915988567346438830283503729569443642E-1L, - -1.488945487149634820537348176770282391202E-2L -}; -#define NRDr17 7 -static const long double RDr17[NRDr17 + 1] = -{ - 2.748457523498150741964464942246913394647E3L, - 1.020213390713477686776037331757871252652E3L, - 1.388857635935432621972601695296561952738E3L, - 3.903363681143817750895999579637315491087E2L, - 2.784568344378139499217928969529219886578E2L, - 5.555800830216764702779238020065345401144E1L, - 2.646215470959050279430447295801291168941E1L, - 2.984905282103517497081766758550112011265E0L, - /* 1.0E0 */ -}; -/* erfc(0.75) = C17a + C17b to extra precision. */ -static const long double C17a = 0.2888336181640625L; -static const long double C17b = 1.0748182422368401062165408589222625794046E-5L; - - -/* erfc(x + 0.875) = erfc(0.875) + x R(x) - 0 <= x < 0.125 - Peak relative error 2.2e-35 */ -#define NRNr18 8 -static const long double RNr18[NRNr18 + 1] = -{ - -1.342044899087593397419622771847219619588E3L, - 6.127221294229172997509252330961641850598E2L, - -4.519821356522291185621206350470820610727E2L, - 1.223275177825128732497510264197915160235E1L, - -2.730789571382971355625020710543532867692E1L, - 4.045181204921538886880171727755445395862E0L, - -4.925146477876592723401384464691452700539E0L, - 5.933878036611279244654299924101068088582E-1L, - -5.557645435858916025452563379795159124753E-2L -}; -#define NRDr18 7 -static const long double RDr18[NRDr18 + 1] = -{ - 2.557518000661700588758505116291983092951E3L, - 1.070171433382888994954602511991940418588E3L, - 1.344842834423493081054489613250688918709E3L, - 4.161144478449381901208660598266288188426E2L, - 2.763670252219855198052378138756906980422E2L, - 5.998153487868943708236273854747564557632E1L, - 2.657695108438628847733050476209037025318E1L, - 3.252140524394421868923289114410336976512E0L, - /* 1.0E0 */ -}; -/* erfc(0.875) = C18a + C18b to extra precision. */ -static const long double C18a = 0.215911865234375L; -static const long double C18b = 1.3073705765341685464282101150637224028267E-5L; - -/* erfc(x + 1.0) = erfc(1.0) + x R(x) - 0 <= x < 0.125 - Peak relative error 1.6e-35 */ -#define NRNr19 8 -static const long double RNr19[NRNr19 + 1] = -{ - -1.139180936454157193495882956565663294826E3L, - 6.134903129086899737514712477207945973616E2L, - -4.628909024715329562325555164720732868263E2L, - 4.165702387210732352564932347500364010833E1L, - -2.286979913515229747204101330405771801610E1L, - 1.870695256449872743066783202326943667722E0L, - -4.177486601273105752879868187237000032364E0L, - 7.533980372789646140112424811291782526263E-1L, - -8.629945436917752003058064731308767664446E-2L -}; -#define NRDr19 7 -static const long double RDr19[NRDr19 + 1] = -{ - 2.744303447981132701432716278363418643778E3L, - 1.266396359526187065222528050591302171471E3L, - 1.466739461422073351497972255511919814273E3L, - 4.868710570759693955597496520298058147162E2L, - 2.993694301559756046478189634131722579643E2L, - 6.868976819510254139741559102693828237440E1L, - 2.801505816247677193480190483913753613630E1L, - 3.604439909194350263552750347742663954481E0L, - /* 1.0E0 */ -}; -/* erfc(1.0) = C19a + C19b to extra precision. */ -static const long double C19a = 0.15728759765625L; -static const long double C19b = 1.1609394035130658779364917390740703933002E-5L; - -/* erfc(x + 1.125) = erfc(1.125) + x R(x) - 0 <= x < 0.125 - Peak relative error 3.6e-36 */ -#define NRNr20 8 -static const long double RNr20[NRNr20 + 1] = -{ - -9.652706916457973956366721379612508047640E2L, - 5.577066396050932776683469951773643880634E2L, - -4.406335508848496713572223098693575485978E2L, - 5.202893466490242733570232680736966655434E1L, - -1.931311847665757913322495948705563937159E1L, - -9.364318268748287664267341457164918090611E-2L, - -3.306390351286352764891355375882586201069E0L, - 7.573806045289044647727613003096916516475E-1L, - -9.611744011489092894027478899545635991213E-2L -}; -#define NRDr20 7 -static const long double RDr20[NRDr20 + 1] = -{ - 3.032829629520142564106649167182428189014E3L, - 1.659648470721967719961167083684972196891E3L, - 1.703545128657284619402511356932569292535E3L, - 6.393465677731598872500200253155257708763E2L, - 3.489131397281030947405287112726059221934E2L, - 8.848641738570783406484348434387611713070E1L, - 3.132269062552392974833215844236160958502E1L, - 4.430131663290563523933419966185230513168E0L - /* 1.0E0 */ -}; -/* erfc(1.125) = C20a + C20b to extra precision. */ -static const long double C20a = 0.111602783203125L; -static const long double C20b = 8.9850951672359304215530728365232161564636E-6L; - -/* erfc(1/x) = 1/x exp (-1/x^2 - 0.5625 + R(1/x^2)) - 7/8 <= 1/x < 1 - Peak relative error 1.4e-35 */ -#define NRNr8 9 -static const long double RNr8[NRNr8 + 1] = -{ - 3.587451489255356250759834295199296936784E1L, - 5.406249749087340431871378009874875889602E2L, - 2.931301290625250886238822286506381194157E3L, - 7.359254185241795584113047248898753470923E3L, - 9.201031849810636104112101947312492532314E3L, - 5.749697096193191467751650366613289284777E3L, - 1.710415234419860825710780802678697889231E3L, - 2.150753982543378580859546706243022719599E2L, - 8.740953582272147335100537849981160931197E0L, - 4.876422978828717219629814794707963640913E-2L -}; -#define NRDr8 8 -static const long double RDr8[NRDr8 + 1] = -{ - 6.358593134096908350929496535931630140282E1L, - 9.900253816552450073757174323424051765523E2L, - 5.642928777856801020545245437089490805186E3L, - 1.524195375199570868195152698617273739609E4L, - 2.113829644500006749947332935305800887345E4L, - 1.526438562626465706267943737310282977138E4L, - 5.561370922149241457131421914140039411782E3L, - 9.394035530179705051609070428036834496942E2L, - 6.147019596150394577984175188032707343615E1L - /* 1.0E0 */ -}; - -/* erfc(1/x) = 1/x exp (-1/x^2 - 0.5625 + R(1/x^2)) - 0.75 <= 1/x <= 0.875 - Peak relative error 2.0e-36 */ -#define NRNr7 9 -static const long double RNr7[NRNr7 + 1] = -{ - 1.686222193385987690785945787708644476545E1L, - 1.178224543567604215602418571310612066594E3L, - 1.764550584290149466653899886088166091093E4L, - 1.073758321890334822002849369898232811561E5L, - 3.132840749205943137619839114451290324371E5L, - 4.607864939974100224615527007793867585915E5L, - 3.389781820105852303125270837910972384510E5L, - 1.174042187110565202875011358512564753399E5L, - 1.660013606011167144046604892622504338313E4L, - 6.700393957480661937695573729183733234400E2L -}; -#define NRDr7 9 -static const long double RDr7[NRDr7 + 1] = -{ --1.709305024718358874701575813642933561169E3L, --3.280033887481333199580464617020514788369E4L, --2.345284228022521885093072363418750835214E5L, --8.086758123097763971926711729242327554917E5L, --1.456900414510108718402423999575992450138E6L, --1.391654264881255068392389037292702041855E6L, --6.842360801869939983674527468509852583855E5L, --1.597430214446573566179675395199807533371E5L, --1.488876130609876681421645314851760773480E4L, --3.511762950935060301403599443436465645703E2L - /* 1.0E0 */ -}; - -/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2)) - 5/8 <= 1/x < 3/4 - Peak relative error 1.9e-35 */ -#define NRNr6 9 -static const long double RNr6[NRNr6 + 1] = -{ - 1.642076876176834390623842732352935761108E0L, - 1.207150003611117689000664385596211076662E2L, - 2.119260779316389904742873816462800103939E3L, - 1.562942227734663441801452930916044224174E4L, - 5.656779189549710079988084081145693580479E4L, - 1.052166241021481691922831746350942786299E5L, - 9.949798524786000595621602790068349165758E4L, - 4.491790734080265043407035220188849562856E4L, - 8.377074098301530326270432059434791287601E3L, - 4.506934806567986810091824791963991057083E2L -}; -#define NRDr6 9 -static const long double RDr6[NRDr6 + 1] = -{ --1.664557643928263091879301304019826629067E2L, --3.800035902507656624590531122291160668452E3L, --3.277028191591734928360050685359277076056E4L, --1.381359471502885446400589109566587443987E5L, --3.082204287382581873532528989283748656546E5L, --3.691071488256738343008271448234631037095E5L, --2.300482443038349815750714219117566715043E5L, --6.873955300927636236692803579555752171530E4L, --8.262158817978334142081581542749986845399E3L, --2.517122254384430859629423488157361983661E2L - /* 1.00 */ -}; - -/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2)) - 1/2 <= 1/x < 5/8 - Peak relative error 4.6e-36 */ -#define NRNr5 10 -static const long double RNr5[NRNr5 + 1] = -{ --3.332258927455285458355550878136506961608E-3L, --2.697100758900280402659586595884478660721E-1L, --6.083328551139621521416618424949137195536E0L, --6.119863528983308012970821226810162441263E1L, --3.176535282475593173248810678636522589861E2L, --8.933395175080560925809992467187963260693E2L, --1.360019508488475978060917477620199499560E3L, --1.075075579828188621541398761300910213280E3L, --4.017346561586014822824459436695197089916E2L, --5.857581368145266249509589726077645791341E1L, --2.077715925587834606379119585995758954399E0L -}; -#define NRDr5 9 -static const long double RDr5[NRDr5 + 1] = -{ - 3.377879570417399341550710467744693125385E-1L, - 1.021963322742390735430008860602594456187E1L, - 1.200847646592942095192766255154827011939E2L, - 7.118915528142927104078182863387116942836E2L, - 2.318159380062066469386544552429625026238E3L, - 4.238729853534009221025582008928765281620E3L, - 4.279114907284825886266493994833515580782E3L, - 2.257277186663261531053293222591851737504E3L, - 5.570475501285054293371908382916063822957E2L, - 5.142189243856288981145786492585432443560E1L - /* 1.0E0 */ -}; - -/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2)) - 3/8 <= 1/x < 1/2 - Peak relative error 2.0e-36 */ -#define NRNr4 10 -static const long double RNr4[NRNr4 + 1] = -{ - 3.258530712024527835089319075288494524465E-3L, - 2.987056016877277929720231688689431056567E-1L, - 8.738729089340199750734409156830371528862E0L, - 1.207211160148647782396337792426311125923E2L, - 8.997558632489032902250523945248208224445E2L, - 3.798025197699757225978410230530640879762E3L, - 9.113203668683080975637043118209210146846E3L, - 1.203285891339933238608683715194034900149E4L, - 8.100647057919140328536743641735339740855E3L, - 2.383888249907144945837976899822927411769E3L, - 2.127493573166454249221983582495245662319E2L -}; -#define NRDr4 10 -static const long double RDr4[NRDr4 + 1] = -{ --3.303141981514540274165450687270180479586E-1L, --1.353768629363605300707949368917687066724E1L, --2.206127630303621521950193783894598987033E2L, --1.861800338758066696514480386180875607204E3L, --8.889048775872605708249140016201753255599E3L, --2.465888106627948210478692168261494857089E4L, --3.934642211710774494879042116768390014289E4L, --3.455077258242252974937480623730228841003E4L, --1.524083977439690284820586063729912653196E4L, --2.810541887397984804237552337349093953857E3L, --1.343929553541159933824901621702567066156E2L - /* 1.0E0 */ -}; - -/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2)) - 1/4 <= 1/x < 3/8 - Peak relative error 8.4e-37 */ -#define NRNr3 11 -static const long double RNr3[NRNr3 + 1] = -{ --1.952401126551202208698629992497306292987E-6L, --2.130881743066372952515162564941682716125E-4L, --8.376493958090190943737529486107282224387E-3L, --1.650592646560987700661598877522831234791E-1L, --1.839290818933317338111364667708678163199E0L, --1.216278715570882422410442318517814388470E1L, --4.818759344462360427612133632533779091386E1L, --1.120994661297476876804405329172164436784E2L, --1.452850765662319264191141091859300126931E2L, --9.485207851128957108648038238656777241333E1L, --2.563663855025796641216191848818620020073E1L, --1.787995944187565676837847610706317833247E0L -}; -#define NRDr3 10 -static const long double RDr3[NRDr3 + 1] = -{ - 1.979130686770349481460559711878399476903E-4L, - 1.156941716128488266238105813374635099057E-2L, - 2.752657634309886336431266395637285974292E-1L, - 3.482245457248318787349778336603569327521E0L, - 2.569347069372696358578399521203959253162E1L, - 1.142279000180457419740314694631879921561E2L, - 3.056503977190564294341422623108332700840E2L, - 4.780844020923794821656358157128719184422E2L, - 4.105972727212554277496256802312730410518E2L, - 1.724072188063746970865027817017067646246E2L, - 2.815939183464818198705278118326590370435E1L - /* 1.0E0 */ -}; - -/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2)) - 1/8 <= 1/x < 1/4 - Peak relative error 1.5e-36 */ -#define NRNr2 11 -static const long double RNr2[NRNr2 + 1] = -{ --2.638914383420287212401687401284326363787E-8L, --3.479198370260633977258201271399116766619E-6L, --1.783985295335697686382487087502222519983E-4L, --4.777876933122576014266349277217559356276E-3L, --7.450634738987325004070761301045014986520E-2L, --7.068318854874733315971973707247467326619E-1L, --4.113919921935944795764071670806867038732E0L, --1.440447573226906222417767283691888875082E1L, --2.883484031530718428417168042141288943905E1L, --2.990886974328476387277797361464279931446E1L, --1.325283914915104866248279787536128997331E1L, --1.572436106228070195510230310658206154374E0L -}; -#define NRDr2 10 -static const long double RDr2[NRDr2 + 1] = -{ - 2.675042728136731923554119302571867799673E-6L, - 2.170997868451812708585443282998329996268E-4L, - 7.249969752687540289422684951196241427445E-3L, - 1.302040375859768674620410563307838448508E-1L, - 1.380202483082910888897654537144485285549E0L, - 8.926594113174165352623847870299170069350E0L, - 3.521089584782616472372909095331572607185E1L, - 8.233547427533181375185259050330809105570E1L, - 1.072971579885803033079469639073292840135E2L, - 6.943803113337964469736022094105143158033E1L, - 1.775695341031607738233608307835017282662E1L - /* 1.0E0 */ -}; - -/* erfc(1/x) = 1/x exp(-1/x^2 - 0.5625 + R(1/x^2)) - 1/128 <= 1/x < 1/8 - Peak relative error 2.2e-36 */ -#define NRNr1 9 -static const long double RNr1[NRNr1 + 1] = -{ --4.250780883202361946697751475473042685782E-8L, --5.375777053288612282487696975623206383019E-6L, --2.573645949220896816208565944117382460452E-4L, --6.199032928113542080263152610799113086319E-3L, --8.262721198693404060380104048479916247786E-2L, --6.242615227257324746371284637695778043982E-1L, --2.609874739199595400225113299437099626386E0L, --5.581967563336676737146358534602770006970E0L, --5.124398923356022609707490956634280573882E0L, --1.290865243944292370661544030414667556649E0L -}; -#define NRDr1 8 -static const long double RDr1[NRDr1 + 1] = -{ - 4.308976661749509034845251315983612976224E-6L, - 3.265390126432780184125233455960049294580E-4L, - 9.811328839187040701901866531796570418691E-3L, - 1.511222515036021033410078631914783519649E-1L, - 1.289264341917429958858379585970225092274E0L, - 6.147640356182230769548007536914983522270E0L, - 1.573966871337739784518246317003956180750E1L, - 1.955534123435095067199574045529218238263E1L, - 9.472613121363135472247929109615785855865E0L - /* 1.0E0 */ -}; - - -long double -__erfl (long double x) -{ - long double a, y, z; - int32_t i, ix, hx; - double xhi; - - xhi = ldbl_high (x); - GET_HIGH_WORD (hx, xhi); - ix = hx & 0x7fffffff; - - if (ix >= 0x7ff00000) - { /* erf(nan)=nan */ - i = ((uint32_t) hx >> 31) << 1; - return (long double) (1 - i) + one / x; /* erf(+-inf)=+-1 */ - } - - if (ix >= 0x3ff00000) /* |x| >= 1.0 */ - { - if (ix >= 0x4039A0DE) - { - /* __erfcl (x) underflows if x > 25.6283 */ - if ((hx & 0x80000000) == 0) - return one-tiny; - else - return tiny-one; - } - else - { - y = __erfcl (x); - return (one - y); - } - } - a = x; - if ((hx & 0x80000000) != 0) - a = -a; - z = x * x; - if (ix < 0x3fec0000) /* a < 0.875 */ - { - if (ix < 0x3c600000) /* |x|<2**-57 */ - { - if (ix < 0x00800000) - { - /* erf (-0) = -0. Unfortunately, for IBM extended double - 0.0625 * (16.0 * x + (16.0 * efx) * x) for x = -0 - evaluates to 0. */ - if (x == 0) - return x; - long double ret = 0.0625 * (16.0 * x + (16.0 * efx) * x); - math_check_force_underflow (ret); - return ret; - } - return x + efx * x; - } - y = a + a * neval (z, TN1, NTN1) / deval (z, TD1, NTD1); - } - else - { - a = a - one; - y = erf_const + neval (a, TN2, NTN2) / deval (a, TD2, NTD2); - } - - if (hx & 0x80000000) /* x < 0 */ - y = -y; - return( y ); -} - -long_double_symbol (libm, __erfl, erfl); -long double -__erfcl (long double x) -{ - long double y, z, p, r; - int32_t i, ix; - uint32_t hx; - double xhi; - - xhi = ldbl_high (x); - GET_HIGH_WORD (hx, xhi); - ix = hx & 0x7fffffff; - - if (ix >= 0x7ff00000) - { /* erfc(nan)=nan */ - /* erfc(+-inf)=0,2 */ - long double ret = (long double) ((hx >> 31) << 1) + one / x; - if (FIX_INT_FP_CONVERT_ZERO && ret == 0.0L) - return 0.0L; - return ret; - } - - if (ix < 0x3fd00000) /* |x| <1/4 */ - { - if (ix < 0x38d00000) /* |x|<2**-114 */ - return one - x; - return one - __erfl (x); - } - if (ix < 0x3ff40000) /* 1.25 */ - { - if ((hx & 0x80000000) != 0) - x = -x; - i = 8.0 * x; - switch (i) - { - case 2: - z = x - 0.25L; - y = C13b + z * neval (z, RNr13, NRNr13) / deval (z, RDr13, NRDr13); - y += C13a; - break; - case 3: - z = x - 0.375L; - y = C14b + z * neval (z, RNr14, NRNr14) / deval (z, RDr14, NRDr14); - y += C14a; - break; - case 4: - z = x - 0.5L; - y = C15b + z * neval (z, RNr15, NRNr15) / deval (z, RDr15, NRDr15); - y += C15a; - break; - case 5: - z = x - 0.625L; - y = C16b + z * neval (z, RNr16, NRNr16) / deval (z, RDr16, NRDr16); - y += C16a; - break; - case 6: - z = x - 0.75L; - y = C17b + z * neval (z, RNr17, NRNr17) / deval (z, RDr17, NRDr17); - y += C17a; - break; - case 7: - z = x - 0.875L; - y = C18b + z * neval (z, RNr18, NRNr18) / deval (z, RDr18, NRDr18); - y += C18a; - break; - case 8: - z = x - 1.0L; - y = C19b + z * neval (z, RNr19, NRNr19) / deval (z, RDr19, NRDr19); - y += C19a; - break; - default: /* i == 9. */ - z = x - 1.125L; - y = C20b + z * neval (z, RNr20, NRNr20) / deval (z, RDr20, NRDr20); - y += C20a; - break; - } - if (hx & 0x80000000) - y = 2.0L - y; - return y; - } - /* 1.25 < |x| < 107 */ - if (ix < 0x405ac000) - { - /* x < -9 */ - if (hx >= 0xc0220000) - return two - tiny; - - if ((hx & 0x80000000) != 0) - x = -x; - z = one / (x * x); - i = 8.0 / x; - switch (i) - { - default: - case 0: - p = neval (z, RNr1, NRNr1) / deval (z, RDr1, NRDr1); - break; - case 1: - p = neval (z, RNr2, NRNr2) / deval (z, RDr2, NRDr2); - break; - case 2: - p = neval (z, RNr3, NRNr3) / deval (z, RDr3, NRDr3); - break; - case 3: - p = neval (z, RNr4, NRNr4) / deval (z, RDr4, NRDr4); - break; - case 4: - p = neval (z, RNr5, NRNr5) / deval (z, RDr5, NRDr5); - break; - case 5: - p = neval (z, RNr6, NRNr6) / deval (z, RDr6, NRDr6); - break; - case 6: - p = neval (z, RNr7, NRNr7) / deval (z, RDr7, NRDr7); - break; - case 7: - p = neval (z, RNr8, NRNr8) / deval (z, RDr8, NRDr8); - break; - } - z = (float) x; - r = __ieee754_expl (-z * z - 0.5625) * - __ieee754_expl ((z - x) * (z + x) + p); - if ((hx & 0x80000000) == 0) - { - long double ret = r / x; - if (ret == 0) - __set_errno (ERANGE); - return ret; - } - else - return two - r / x; - } - else - { - if ((hx & 0x80000000) == 0) - { - __set_errno (ERANGE); - return tiny * tiny; - } - else - return two - tiny; - } -} - -long_double_symbol (libm, __erfcl, erfcl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c b/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c deleted file mode 100644 index 42d57c6eec..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_expm1l.c +++ /dev/null @@ -1,152 +0,0 @@ -/* expm1l.c - * - * Exponential function, minus 1 - * 128-bit long double precision - * - * - * - * SYNOPSIS: - * - * long double x, y, expm1l(); - * - * y = expm1l( x ); - * - * - * - * DESCRIPTION: - * - * Returns e (2.71828...) raised to the x power, minus one. - * - * Range reduction is accomplished by separating the argument - * into an integer k and fraction f such that - * - * x k f - * e = 2 e. - * - * An expansion x + .5 x^2 + x^3 R(x) approximates exp(f) - 1 - * in the basic range [-0.5 ln 2, 0.5 ln 2]. - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE -79,+MAXLOG 100,000 1.7e-34 4.5e-35 - * - */ - -/* Copyright 2001 by Stephen L. Moshier - - This 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. - - This 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 this library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -/* exp(x) - 1 = x + 0.5 x^2 + x^3 P(x)/Q(x) - -.5 ln 2 < x < .5 ln 2 - Theoretical peak relative error = 8.1e-36 */ - -static const long double - P0 = 2.943520915569954073888921213330863757240E8L, - P1 = -5.722847283900608941516165725053359168840E7L, - P2 = 8.944630806357575461578107295909719817253E6L, - P3 = -7.212432713558031519943281748462837065308E5L, - P4 = 4.578962475841642634225390068461943438441E4L, - P5 = -1.716772506388927649032068540558788106762E3L, - P6 = 4.401308817383362136048032038528753151144E1L, - P7 = -4.888737542888633647784737721812546636240E-1L, - Q0 = 1.766112549341972444333352727998584753865E9L, - Q1 = -7.848989743695296475743081255027098295771E8L, - Q2 = 1.615869009634292424463780387327037251069E8L, - Q3 = -2.019684072836541751428967854947019415698E7L, - Q4 = 1.682912729190313538934190635536631941751E6L, - Q5 = -9.615511549171441430850103489315371768998E4L, - Q6 = 3.697714952261803935521187272204485251835E3L, - Q7 = -8.802340681794263968892934703309274564037E1L, - /* Q8 = 1.000000000000000000000000000000000000000E0 */ -/* C1 + C2 = ln 2 */ - - C1 = 6.93145751953125E-1L, - C2 = 1.428606820309417232121458176568075500134E-6L, -/* ln 2^-114 */ - minarg = -7.9018778583833765273564461846232128760607E1L, big = 1e290L; - - -long double -__expm1l (long double x) -{ - long double px, qx, xx; - int32_t ix, lx, sign; - int k; - double xhi; - - /* Detect infinity and NaN. */ - xhi = ldbl_high (x); - EXTRACT_WORDS (ix, lx, xhi); - sign = ix & 0x80000000; - ix &= 0x7fffffff; - if (!sign && ix >= 0x40600000) - return __expl (x); - if (ix >= 0x7ff00000) - { - /* Infinity (which must be negative infinity). */ - if (((ix - 0x7ff00000) | lx) == 0) - return -1.0L; - /* NaN. Invalid exception if signaling. */ - return x + x; - } - - /* expm1(+- 0) = +- 0. */ - if ((ix | lx) == 0) - return x; - - /* Minimum value. */ - if (x < minarg) - return (4.0/big - 1.0L); - - /* Express x = ln 2 (k + remainder), remainder not exceeding 1/2. */ - xx = C1 + C2; /* ln 2. */ - px = __floorl (0.5 + x / xx); - k = px; - /* remainder times ln 2 */ - x -= px * C1; - x -= px * C2; - - /* Approximate exp(remainder ln 2). */ - px = (((((((P7 * x - + P6) * x - + P5) * x + P4) * x + P3) * x + P2) * x + P1) * x + P0) * x; - - qx = (((((((x - + Q7) * x - + Q6) * x + Q5) * x + Q4) * x + Q3) * x + Q2) * x + Q1) * x + Q0; - - xx = x * x; - qx = x + (0.5 * xx + xx * px / qx); - - /* exp(x) = exp(k ln 2) exp(remainder ln 2) = 2^k exp(remainder ln 2). - - We have qx = exp(remainder ln 2) - 1, so - exp(x) - 1 = 2^k (qx + 1) - 1 - = 2^k qx + 2^k - 1. */ - - px = __ldexpl (1.0L, k); - x = px * qx + (px - 1.0); - return x; -} -libm_hidden_def (__expm1l) -long_double_symbol (libm, __expm1l, expm1l); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c b/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c deleted file mode 100644 index c801c97065..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_fabsl.c +++ /dev/null @@ -1,44 +0,0 @@ -/* s_fabsl.c -- long double version of s_fabs.c. - * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - - -/* - * fabsl(x) returns the absolute value of x. - */ - -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -long double __fabsl(long double x) -{ - u_int64_t hx, lx; - double xhi, xlo; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - EXTRACT_WORDS64 (lx, xlo); - lx = lx ^ ( hx & 0x8000000000000000LL ); - hx = hx & 0x7fffffffffffffffLL; - INSERT_WORDS64 (xhi, hx); - INSERT_WORDS64 (xlo, lx); - x = ldbl_pack (xhi, xlo); - return x; -} -long_double_symbol (libm, __fabsl, fabsl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_finitel.c b/sysdeps/ieee754/ldbl-128ibm/s_finitel.c deleted file mode 100644 index 3b9e3de292..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_finitel.c +++ /dev/null @@ -1,49 +0,0 @@ -/* s_finitel.c -- long double version of s_finite.c. - * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * finitel(x) returns 1 is x is finite, else 0; - * no branching! - */ - -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -int -___finitel (long double x) -{ - uint64_t hx; - double xhi; - - xhi = ldbl_high (x); - EXTRACT_WORDS64 (hx, xhi); - hx &= 0x7ff0000000000000LL; - hx -= 0x7ff0000000000000LL; - return hx >> 63; -} -hidden_ver (___finitel, __finitel) -weak_alias (___finitel, ____finitel) -#if IS_IN (libm) -long_double_symbol (libm, ____finitel, finitel); -long_double_symbol (libm, ___finitel, __finitel); -#else -long_double_symbol (libc, ____finitel, finitel); -long_double_symbol (libc, ___finitel, __finitel); -#endif diff --git a/sysdeps/ieee754/ldbl-128ibm/s_floorl.c b/sysdeps/ieee754/ldbl-128ibm/s_floorl.c deleted file mode 100644 index 6b837c7bcd..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_floorl.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Round to int long double floating-point values. - IBM extended format long double version. - Copyright (C) 2006-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_ldbl_opt.h> -#include <float.h> -#include <ieee754.h> - - -long double -__floorl (long double x) -{ - double xh, xl, hi, lo; - - ldbl_unpack (x, &xh, &xl); - - /* Return Inf, Nan, +/-0 unchanged. */ - if (__builtin_expect (xh != 0.0 - && __builtin_isless (__builtin_fabs (xh), - __builtin_inf ()), 1)) - { - hi = __floor (xh); - if (hi != xh) - { - /* The high part is not an integer; the low part does not - affect the result. */ - xh = hi; - xl = 0; - } - else - { - /* The high part is a nonzero integer. */ - lo = __floor (xl); - xh = hi; - xl = lo; - ldbl_canonicalize_int (&xh, &xl); - } - } - else - /* Quiet signaling NaN arguments. */ - xh += xh; - - return ldbl_pack (xh, xl); -} - -long_double_symbol (libm, __floorl, floorl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_fmal.c b/sysdeps/ieee754/ldbl-128ibm/s_fmal.c deleted file mode 100644 index 9098e79df9..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_fmal.c +++ /dev/null @@ -1,257 +0,0 @@ -/* Compute x * y + z as ternary operation. - Copyright (C) 2011-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by David Flaherty <flaherty@linux.vnet.ibm.com>. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <fenv.h> -#include <float.h> -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> -#include <mul_split.h> -#include <stdlib.h> - -/* Calculate X + Y exactly and store the result in *HI + *LO. It is - given that |X| >= |Y| and the values are small enough that no - overflow occurs. */ - -static void -add_split (double *hi, double *lo, double x, double y) -{ - /* Apply Dekker's algorithm. */ - *hi = x + y; - *lo = (x - *hi) + y; -} - -/* Value with extended range, used in intermediate computations. */ -typedef struct -{ - /* Value in [0.5, 1), as from frexp, or 0. */ - double val; - /* Exponent of power of 2 it is multiplied by, or 0 for zero. */ - int exp; -} ext_val; - -/* Store D as an ext_val value. */ - -static void -store_ext_val (ext_val *v, double d) -{ - v->val = __frexp (d, &v->exp); -} - -/* Store X * Y as ext_val values *V0 and *V1. */ - -static void -mul_ext_val (ext_val *v0, ext_val *v1, double x, double y) -{ - int xexp, yexp; - x = __frexp (x, &xexp); - y = __frexp (y, &yexp); - double hi, lo; - mul_split (&hi, &lo, x, y); - store_ext_val (v0, hi); - if (hi != 0) - v0->exp += xexp + yexp; - store_ext_val (v1, lo); - if (lo != 0) - v1->exp += xexp + yexp; -} - -/* Compare absolute values of ext_val values pointed to by P and Q for - qsort. */ - -static int -compare (const void *p, const void *q) -{ - const ext_val *pe = p; - const ext_val *qe = q; - if (pe->val == 0) - return qe->val == 0 ? 0 : -1; - else if (qe->val == 0) - return 1; - else if (pe->exp < qe->exp) - return -1; - else if (pe->exp > qe->exp) - return 1; - else - { - double pd = fabs (pe->val); - double qd = fabs (qe->val); - if (pd < qd) - return -1; - else if (pd == qd) - return 0; - else - return 1; - } -} - -/* Calculate *X + *Y exactly, storing the high part in *X (rounded to - nearest) and the low part in *Y. It is given that |X| >= |Y|. */ - -static void -add_split_ext (ext_val *x, ext_val *y) -{ - int xexp = x->exp, yexp = y->exp; - if (y->val == 0 || xexp - yexp > 53) - return; - double hi = x->val; - double lo = __scalbn (y->val, yexp - xexp); - add_split (&hi, &lo, hi, lo); - store_ext_val (x, hi); - if (hi != 0) - x->exp += xexp; - store_ext_val (y, lo); - if (lo != 0) - y->exp += xexp; -} - -long double -__fmal (long double x, long double y, long double z) -{ - double xhi, xlo, yhi, ylo, zhi, zlo; - int64_t hx, hy, hz; - int xexp, yexp, zexp; - double scale_val; - int scale_exp; - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - xexp = (hx & 0x7ff0000000000000LL) >> 52; - ldbl_unpack (y, &yhi, &ylo); - EXTRACT_WORDS64 (hy, yhi); - yexp = (hy & 0x7ff0000000000000LL) >> 52; - ldbl_unpack (z, &zhi, &zlo); - EXTRACT_WORDS64 (hz, zhi); - zexp = (hz & 0x7ff0000000000000LL) >> 52; - - /* If z is Inf or NaN, but x and y are finite, avoid any exceptions - from computing x * y. */ - if (zexp == 0x7ff && xexp != 0x7ff && yexp != 0x7ff) - return (z + x) + y; - - /* If z is zero and x are y are nonzero, compute the result as x * y - to avoid the wrong sign of a zero result if x * y underflows to - 0. */ - if (z == 0 && x != 0 && y != 0) - return x * y; - - /* If x or y or z is Inf/NaN, or if x * y is zero, compute as x * y - + z. */ - if (xexp == 0x7ff || yexp == 0x7ff || zexp == 0x7ff - || x == 0 || y == 0) - return (x * y) + z; - - { - SET_RESTORE_ROUND (FE_TONEAREST); - - ext_val vals[10]; - store_ext_val (&vals[0], zhi); - store_ext_val (&vals[1], zlo); - mul_ext_val (&vals[2], &vals[3], xhi, yhi); - mul_ext_val (&vals[4], &vals[5], xhi, ylo); - mul_ext_val (&vals[6], &vals[7], xlo, yhi); - mul_ext_val (&vals[8], &vals[9], xlo, ylo); - qsort (vals, 10, sizeof (ext_val), compare); - /* Add up the values so that each element of VALS has absolute - value at most equal to the last set bit of the next nonzero - element. */ - for (size_t i = 0; i <= 8; i++) - { - add_split_ext (&vals[i + 1], &vals[i]); - qsort (vals + i + 1, 9 - i, sizeof (ext_val), compare); - } - /* Add up the values in the other direction, so that each element - of VALS has absolute value less than 5ulp of the next - value. */ - size_t dstpos = 9; - for (size_t i = 1; i <= 9; i++) - { - if (vals[dstpos].val == 0) - { - vals[dstpos] = vals[9 - i]; - vals[9 - i].val = 0; - vals[9 - i].exp = 0; - } - else - { - add_split_ext (&vals[dstpos], &vals[9 - i]); - if (vals[9 - i].val != 0) - { - if (9 - i < dstpos - 1) - { - vals[dstpos - 1] = vals[9 - i]; - vals[9 - i].val = 0; - vals[9 - i].exp = 0; - } - dstpos--; - } - } - } - /* If the result is an exact zero, it results from adding two - values with opposite signs; recompute in the original rounding - mode. */ - if (vals[9].val == 0) - goto zero_out; - /* Adding the top three values will now give a result as accurate - as the underlying long double arithmetic. */ - add_split_ext (&vals[9], &vals[8]); - if (compare (&vals[8], &vals[7]) < 0) - { - ext_val tmp = vals[7]; - vals[7] = vals[8]; - vals[8] = tmp; - } - add_split_ext (&vals[8], &vals[7]); - add_split_ext (&vals[9], &vals[8]); - if (vals[9].exp > DBL_MAX_EXP || vals[9].exp < DBL_MIN_EXP) - { - /* Overflow or underflow, with the result depending on the - original rounding mode, but not on the low part computed - here. */ - scale_val = vals[9].val; - scale_exp = vals[9].exp; - goto scale_out; - } - double hi = __scalbn (vals[9].val, vals[9].exp); - double lo = __scalbn (vals[8].val, vals[8].exp); - /* It is possible that the low part became subnormal and was - rounded so that the result is no longer canonical. */ - ldbl_canonicalize (&hi, &lo); - long double ret = ldbl_pack (hi, lo); - math_check_force_underflow (ret); - return ret; - } - - scale_out: - scale_val = math_opt_barrier (scale_val); - scale_val = __scalbn (scale_val, scale_exp); - if (fabs (scale_val) == DBL_MAX) - return __copysignl (LDBL_MAX, scale_val); - math_check_force_underflow (scale_val); - return scale_val; - - zero_out:; - double zero = 0.0; - zero = math_opt_barrier (zero); - return zero - zero; -} -#if IS_IN (libm) -long_double_symbol (libm, __fmal, fmal); -#else -long_double_symbol (libc, __fmal, fmal); -#endif diff --git a/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c b/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c deleted file mode 100644 index 82d520bc7f..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_fpclassifyl.c +++ /dev/null @@ -1,97 +0,0 @@ -/* Return classification value corresponding to argument. - Copyright (C) 1997-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and - Jakub Jelinek <jj@ultra.linux.cz>, 1999. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> - -#include <math_private.h> -#include <math_ldbl_opt.h> - - /* - * hx lx - * +NaN 7ffn nnnn nnnn nnnn xxxx xxxx xxxx xxxx - * -NaN fffn nnnn nnnn nnnn xxxx xxxx xxxx xxxx - * +Inf 7ff0 0000 0000 0000 xxxx xxxx xxxx xxxx - * -Inf fff0 0000 0000 0000 xxxx xxxx xxxx xxxx - * +0 0000 0000 0000 0000 xxxx xxxx xxxx xxxx - * -0 8000 0000 0000 0000 xxxx xxxx xxxx xxxx - * +normal 0360 0000 0000 0000 0000 0000 0000 0000 (smallest) - * -normal 8360 0000 0000 0000 0000 0000 0000 0000 (smallest) - * +normal 7fef ffff ffff ffff 7c8f ffff ffff fffe (largest) - * +normal ffef ffff ffff ffff fc8f ffff ffff fffe (largest) - * +denorm 0360 0000 0000 0000 8000 0000 0000 0001 (largest) - * -denorm 8360 0000 0000 0000 0000 0000 0000 0001 (largest) - * +denorm 000n nnnn nnnn nnnn xxxx xxxx xxxx xxxx - * -denorm 800n nnnn nnnn nnnn xxxx xxxx xxxx xxxx - */ - -int -___fpclassifyl (long double x) -{ - u_int64_t hx, lx; - int retval = FP_NORMAL; - double xhi, xlo; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - if ((hx & 0x7ff0000000000000ULL) == 0x7ff0000000000000ULL) { - /* +/-NaN or +/-Inf */ - if (hx & 0x000fffffffffffffULL) { - /* +/-NaN */ - retval = FP_NAN; - } else { - retval = FP_INFINITE; - } - } else { - /* +/-zero or +/- normal or +/- denormal */ - if (hx & 0x7fffffffffffffffULL) { - /* +/- normal or +/- denormal */ - if ((hx & 0x7ff0000000000000ULL) > 0x0360000000000000ULL) { - /* +/- normal */ - retval = FP_NORMAL; - } else { - if ((hx & 0x7ff0000000000000ULL) == 0x0360000000000000ULL) { - EXTRACT_WORDS64 (lx, xlo); - if ((lx & 0x7fffffffffffffff) /* lower is non-zero */ - && ((lx^hx) & 0x8000000000000000ULL)) { /* and sign differs */ - /* +/- denormal */ - retval = FP_SUBNORMAL; - } else { - /* +/- normal */ - retval = FP_NORMAL; - } - } else { - /* +/- denormal */ - retval = FP_SUBNORMAL; - } - } - } else { - /* +/- zero */ - retval = FP_ZERO; - } - } - - return retval; -} -long_double_symbol (libm, ___fpclassifyl, __fpclassifyl); -#ifdef __LONG_DOUBLE_MATH_OPTIONAL -libm_hidden_ver (___fpclassifyl, __fpclassifyl) -#else -libm_hidden_def (__fpclassifyl) -#endif diff --git a/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c b/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c deleted file mode 100644 index 210c5d2ed4..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c +++ /dev/null @@ -1,148 +0,0 @@ -/* s_frexpl.c -- long double version of s_frexp.c. - * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * for non-zero x - * x = frexpl(arg,&exp); - * return a long double fp quantity x such that 0.5 <= |x| <1.0 - * and the corresponding binary exponent "exp". That is - * arg = x*2^exp. - * If arg is inf, 0.0, or NaN, then frexpl(arg,&exp) returns arg - * with *exp=0. - */ - -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -long double __frexpl(long double x, int *eptr) -{ - uint64_t hx, lx, ix, ixl; - int64_t explo, expon; - double xhi, xlo; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - EXTRACT_WORDS64 (lx, xlo); - ixl = 0x7fffffffffffffffULL & lx; - ix = 0x7fffffffffffffffULL & hx; - expon = 0; - if (ix >= 0x7ff0000000000000ULL || ix == 0) - { - /* 0,inf,nan. */ - *eptr = expon; - return x + x; - } - expon = ix >> 52; - if (expon == 0) - { - /* Denormal high double, the low double must be 0.0. */ - int cnt; - - /* Normalize. */ - if (sizeof (ix) == sizeof (long)) - cnt = __builtin_clzl (ix); - else if ((ix >> 32) != 0) - cnt = __builtin_clzl ((long) (ix >> 32)); - else - cnt = __builtin_clzl ((long) ix) + 32; - cnt = cnt - 12; - expon -= cnt; - ix <<= cnt + 1; - } - expon -= 1022; - ix &= 0x000fffffffffffffULL; - hx &= 0x8000000000000000ULL; - hx |= (1022LL << 52) | ix; - - if (ixl != 0) - { - /* If the high double is an exact power of two and the low - double has the opposite sign, then the exponent calculated - from the high double is one too big. */ - if (ix == 0 - && (int64_t) (hx ^ lx) < 0) - { - hx += 1LL << 52; - expon -= 1; - } - - explo = ixl >> 52; - if (explo == 0) - { - /* The low double started out as a denormal. Normalize its - mantissa and adjust the exponent. */ - int cnt; - - if (sizeof (ixl) == sizeof (long)) - cnt = __builtin_clzl (ixl); - else if ((ixl >> 32) != 0) - cnt = __builtin_clzl ((long) (ixl >> 32)); - else - cnt = __builtin_clzl ((long) ixl) + 32; - cnt = cnt - 12; - explo -= cnt; - ixl <<= cnt + 1; - } - - /* With variable precision we can't assume much about the - magnitude of the returned low double. It may even be a - denormal. */ - explo -= expon; - ixl &= 0x000fffffffffffffULL; - lx &= 0x8000000000000000ULL; - if (explo <= 0) - { - /* Handle denormal low double. */ - if (explo > -52) - { - ixl |= 1LL << 52; - ixl >>= 1 - explo; - } - else - { - ixl = 0; - lx = 0; - if ((hx & 0x7ff0000000000000ULL) == (1023LL << 52)) - { - /* Oops, the adjustment we made above for values a - little smaller than powers of two turned out to - be wrong since the returned low double will be - zero. This can happen if the input was - something weird like 0x1p1000 - 0x1p-1000. */ - hx -= 1LL << 52; - expon += 1; - } - } - explo = 0; - } - lx |= (explo << 52) | ixl; - } - - INSERT_WORDS64 (xhi, hx); - INSERT_WORDS64 (xlo, lx); - x = ldbl_pack (xhi, xlo); - *eptr = expon; - return x; -} -#if IS_IN (libm) -long_double_symbol (libm, __frexpl, frexpl); -#else -long_double_symbol (libc, __frexpl, frexpl); -#endif diff --git a/sysdeps/ieee754/ldbl-128ibm/s_fromfpl.c b/sysdeps/ieee754/ldbl-128ibm/s_fromfpl.c deleted file mode 100644 index e323b4c25b..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_fromfpl.c +++ /dev/null @@ -1,4 +0,0 @@ -#define UNSIGNED 0 -#define INEXACT 0 -#define FUNC fromfpl -#include <s_fromfpl_main.c> diff --git a/sysdeps/ieee754/ldbl-128ibm/s_fromfpl_main.c b/sysdeps/ieee754/ldbl-128ibm/s_fromfpl_main.c deleted file mode 100644 index 8b9108e84d..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_fromfpl_main.c +++ /dev/null @@ -1,147 +0,0 @@ -/* Round to integer type. ldbl-128ibm version. - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <fenv.h> -#include <math.h> -#include <math_private.h> -#include <stdbool.h> -#include <stdint.h> - -#define BIAS 0x3ff -#define MANT_DIG 53 - -#if UNSIGNED -# define RET_TYPE uintmax_t -#else -# define RET_TYPE intmax_t -#endif - -#include <fromfp.h> - -RET_TYPE -FUNC (long double x, int round, unsigned int width) -{ - double hi, lo; - if (width > INTMAX_WIDTH) - width = INTMAX_WIDTH; - uint64_t hx, lx; - ldbl_unpack (x, &hi, &lo); - EXTRACT_WORDS64 (hx, hi); - EXTRACT_WORDS64 (lx, lo); - bool negative = (hx & 0x8000000000000000ULL) != 0; - bool lo_negative = (lx & 0x8000000000000000ULL) != 0; - if (width == 0) - return fromfp_domain_error (negative, width); - hx &= 0x7fffffffffffffffULL; - lx &= 0x7fffffffffffffffULL; - if ((hx | lx) == 0) - return 0; - int hi_exponent = hx >> (MANT_DIG - 1); - hi_exponent -= BIAS; - int exponent = hi_exponent; - hx &= ((1ULL << (MANT_DIG - 1)) - 1); - if (hx == 0 && lx != 0 && lo_negative != negative) - exponent--; - int max_exponent = fromfp_max_exponent (negative, width); - if (exponent > max_exponent) - return fromfp_domain_error (negative, width); - int lo_exponent = lx >> (MANT_DIG - 1); - lo_exponent -= BIAS; - - /* Convert the high part to integer. */ - hx |= 1ULL << (MANT_DIG - 1); - uintmax_t uret; - bool half_bit, more_bits; - if (hi_exponent >= MANT_DIG - 1) - { - uret = hx; - uret <<= hi_exponent - (MANT_DIG - 1); - half_bit = false; - more_bits = false; - } - else if (hi_exponent >= -1) - { - uint64_t h = 1ULL << (MANT_DIG - 2 - hi_exponent); - half_bit = (hx & h) != 0; - more_bits = (hx & (h - 1)) != 0; - uret = hx >> (MANT_DIG - 1 - hi_exponent); - } - else - { - uret = 0; - half_bit = false; - more_bits = true; - } - - /* Likewise, the low part. */ - if (lx != 0) - { - uintmax_t lo_uret; - bool lo_half_bit, lo_more_bits; - lx &= ((1ULL << (MANT_DIG - 1)) - 1); - lx |= 1ULL << (MANT_DIG - 1); - /* The high part exponent is at most 64, so the low part - exponent is at most 11. */ - if (lo_exponent >= -1) - { - uint64_t h = 1ULL << (MANT_DIG - 2 - lo_exponent); - lo_half_bit = (lx & h) != 0; - lo_more_bits = (lx & (h - 1)) != 0; - lo_uret = lx >> (MANT_DIG - 1 - lo_exponent); - } - else - { - lo_uret = 0; - lo_half_bit = false; - lo_more_bits = true; - } - if (lo_negative == negative) - { - uret += lo_uret; - half_bit |= lo_half_bit; - more_bits |= lo_more_bits; - } - else - { - uret -= lo_uret; - if (lo_half_bit) - { - uret--; - half_bit = true; - } - if (lo_more_bits && !more_bits) - { - if (half_bit) - { - half_bit = false; - more_bits = true; - } - else - { - uret--; - half_bit = true; - more_bits = true; - } - } - } - } - - return fromfp_round_and_return (negative, uret, half_bit, more_bits, round, - exponent, max_exponent, width); -} diff --git a/sysdeps/ieee754/ldbl-128ibm/s_fromfpxl.c b/sysdeps/ieee754/ldbl-128ibm/s_fromfpxl.c deleted file mode 100644 index 2f3189d7de..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_fromfpxl.c +++ /dev/null @@ -1,4 +0,0 @@ -#define UNSIGNED 0 -#define INEXACT 1 -#define FUNC fromfpxl -#include <s_fromfpl_main.c> diff --git a/sysdeps/ieee754/ldbl-128ibm/s_getpayloadl.c b/sysdeps/ieee754/ldbl-128ibm/s_getpayloadl.c deleted file mode 100644 index 420b17837e..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_getpayloadl.c +++ /dev/null @@ -1,34 +0,0 @@ -/* Get NaN payload. ldbl-128ibm version. - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <fix-int-fp-convert-zero.h> -#include <math.h> -#include <math_private.h> -#include <stdint.h> - -long double -getpayloadl (const long double *x) -{ - double xhi = ldbl_high (*x); - uint64_t ix; - EXTRACT_WORDS64 (ix, xhi); - ix &= 0x7ffffffffffffULL; - if (FIX_INT_FP_CONVERT_ZERO && ix == 0) - return 0.0L; - return (long double) ix; -} diff --git a/sysdeps/ieee754/ldbl-128ibm/s_iscanonicall.c b/sysdeps/ieee754/ldbl-128ibm/s_iscanonicall.c deleted file mode 100644 index 24999a920d..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_iscanonicall.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Test whether long double value is canonical. ldbl-128ibm version. - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_private.h> -#include <stdint.h> - -int -__iscanonicall (long double x) -{ - double xhi, xlo; - uint64_t hx, lx; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - EXTRACT_WORDS64 (lx, xlo); - int64_t ix = hx & 0x7fffffffffffffffULL; - int64_t iy = lx & 0x7fffffffffffffffULL; - int hexp = (ix & 0x7ff0000000000000LL) >> 52; - int lexp = (iy & 0x7ff0000000000000LL) >> 52; - - if (iy == 0) - /* Low part 0 is always OK. */ - return 1; - - if (hexp == 0x7ff) - /* If a NaN, the low part does not matter. If an infinity, the - low part must be 0, in which case we have already returned. */ - return ix != 0x7ff0000000000000LL; - - /* The high part is finite and the low part is nonzero. There must - be sufficient difference between the exponents. */ - bool low_p2; - if (lexp == 0) - { - /* Adjust the exponent for subnormal low part. */ - lexp = 12 - __builtin_clzll (iy); - low_p2 = iy == (1LL << (51 + lexp)); - } - else - low_p2 = (iy & 0xfffffffffffffLL) == 0; - int expdiff = hexp - lexp; - return expdiff > 53 || (expdiff == 53 && low_p2 && (ix & 1) == 0); -} -libm_hidden_def (__iscanonicall) diff --git a/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c b/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c deleted file mode 100644 index 730aa4d8d1..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_isinfl.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Written by J.T. Conklin <jtc@netbsd.org>. - * Change for long double by Jakub Jelinek <jj@ultra.linux.cz> - * Public domain. - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0; - * no branching! - * slightly dodgy in relying on signed shift right copying sign bit - */ - -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -int -___isinfl (long double x) -{ - double xhi; - int64_t hx, mask; - - xhi = ldbl_high (x); - EXTRACT_WORDS64 (hx, xhi); - - mask = (hx & 0x7fffffffffffffffLL) ^ 0x7ff0000000000000LL; - mask |= -mask; - mask >>= 63; - return ~mask & (hx >> 62); -} -hidden_ver (___isinfl, __isinfl) -#if !IS_IN (libm) -weak_alias (___isinfl, ____isinfl) -long_double_symbol (libc, ___isinfl, isinfl); -long_double_symbol (libc, ____isinfl, __isinfl); -#endif diff --git a/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c b/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c deleted file mode 100644 index 9980875df2..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_isnanl.c +++ /dev/null @@ -1,46 +0,0 @@ -/* s_isnanl.c -- long double version of s_isnan.c. - * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * isnanl(x) returns 1 is x is nan, else 0; - * no branching! - */ - -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -int -___isnanl (long double x) -{ - uint64_t hx; - double xhi; - - xhi = ldbl_high (x); - EXTRACT_WORDS64 (hx, xhi); - hx &= 0x7fffffffffffffffLL; - hx = 0x7ff0000000000000LL - hx; - return (int) (hx >> 63); -} -hidden_ver (___isnanl, __isnanl) -#if !IS_IN (libm) -weak_alias (___isnanl, ____isnanl) -long_double_symbol (libc, ___isnanl, isnanl); -long_double_symbol (libc, ____isnanl, __isnanl); -#endif diff --git a/sysdeps/ieee754/ldbl-128ibm/s_issignalingl.c b/sysdeps/ieee754/ldbl-128ibm/s_issignalingl.c deleted file mode 100644 index feb7edea5d..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_issignalingl.c +++ /dev/null @@ -1,49 +0,0 @@ -/* Test for signaling NaN. - Copyright (C) 2013-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_private.h> -#include <nan-high-order-bit.h> - -int -__issignalingl (long double x) -{ - uint64_t xi; - /* For inspecting NaN status, we only have to look at the first of the pair - of IEEE 754 64-bit precision numbers. */ - double xhi; - - xhi = ldbl_high (x); - EXTRACT_WORDS64 (xi, xhi); -#if HIGH_ORDER_BIT_IS_SET_FOR_SNAN -# error untested - /* We only have to care about the high-order bit of x's significand, because - having it set (sNaN) already makes the significand different from that - used to designate infinity. */ - return (xi & UINT64_C (0x7ff8000000000000)) == UINT64_C (0x7ff8000000000000); -#else - /* To keep the following comparison simple, toggle the quiet/signaling bit, - so that it is set for sNaNs. This is inverse to IEEE 754-2008 (as well as - common practice for IEEE 754-1985). */ - xi ^= UINT64_C (0x0008000000000000); - /* We have to compare for greater (instead of greater or equal), because x's - significand being all-zero designates infinity not NaN. */ - return (xi & UINT64_C (0x7fffffffffffffff)) > UINT64_C (0x7ff8000000000000); -#endif -} -libm_hidden_def (__issignalingl) diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c deleted file mode 100644 index fbf38bf717..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_llrintl.c +++ /dev/null @@ -1,140 +0,0 @@ -/* Round to long long int long double floating-point values. - IBM extended format long double version. - Copyright (C) 2006-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <fenv.h> -#include <math_ldbl_opt.h> -#include <float.h> -#include <ieee754.h> - - -long long -__llrintl (long double x) -{ - double xh, xl; - long long res, hi, lo; - int save_round; - - ldbl_unpack (x, &xh, &xl); - - /* Limit the range of values handled by the conversion to long long. - We do this because we aren't sure whether that conversion properly - raises FE_INVALID. */ - if (__builtin_expect - ((__builtin_fabs (xh) <= -(double) (-__LONG_LONG_MAX__ - 1)), 1) -#if !defined (FE_INVALID) - || 1 -#endif - ) - { - save_round = fegetround (); - - if (__glibc_unlikely ((xh == -(double) (-__LONG_LONG_MAX__ - 1)))) - { - /* When XH is 9223372036854775808.0, converting to long long will - overflow, resulting in an invalid operation. However, XL might - be negative and of sufficient magnitude that the overall long - double is in fact in range. Avoid raising an exception. In any - case we need to convert this value specially, because - the converted value is not exactly represented as a double - thus subtracting HI from XH suffers rounding error. */ - hi = __LONG_LONG_MAX__; - xh = 1.0; - } - else - { - hi = (long long) xh; - xh -= hi; - } - ldbl_canonicalize (&xh, &xl); - - lo = (long long) xh; - - /* Peg at max/min values, assuming that the above conversions do so. - Strictly speaking, we can return anything for values that overflow, - but this is more useful. */ - res = hi + lo; - - /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi). */ - if (__glibc_unlikely (((~(hi ^ lo) & (res ^ hi)) < 0))) - goto overflow; - - xh -= lo; - ldbl_canonicalize (&xh, &xl); - - hi = res; - switch (save_round) - { - case FE_TONEAREST: - if (fabs (xh) < 0.5 - || (fabs (xh) == 0.5 - && ((xh > 0.0 && xl < 0.0) - || (xh < 0.0 && xl > 0.0) - || (xl == 0.0 && (res & 1) == 0)))) - return res; - - if (xh < 0.0) - res -= 1; - else - res += 1; - break; - - case FE_TOWARDZERO: - if (res > 0 && (xh < 0.0 || (xh == 0.0 && xl < 0.0))) - res -= 1; - else if (res < 0 && (xh > 0.0 || (xh == 0.0 && xl > 0.0))) - res += 1; - return res; - break; - - case FE_UPWARD: - if (xh > 0.0 || (xh == 0.0 && xl > 0.0)) - res += 1; - break; - - case FE_DOWNWARD: - if (xh < 0.0 || (xh == 0.0 && xl < 0.0)) - res -= 1; - break; - } - - if (__glibc_unlikely (((~(hi ^ (res - hi)) & (res ^ hi)) < 0))) - goto overflow; - - return res; - } - else - { - if (xh > 0.0) - hi = __LONG_LONG_MAX__; - else if (xh < 0.0) - hi = -__LONG_LONG_MAX__ - 1; - else - /* Nan */ - hi = 0; - } - -overflow: -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - return hi; -} - -long_double_symbol (libm, __llrintl, llrintl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c deleted file mode 100644 index 609cc864de..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_llroundl.c +++ /dev/null @@ -1,120 +0,0 @@ -/* Round to long long int long double floating-point values. - IBM extended format long double version. - Copyright (C) 2006-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <fenv.h> -#include <math_ldbl_opt.h> -#include <float.h> -#include <ieee754.h> - -long long -__llroundl (long double x) -{ - double xh, xl; - long long res, hi, lo; - - ldbl_unpack (x, &xh, &xl); - - /* Limit the range of values handled by the conversion to long long. - We do this because we aren't sure whether that conversion properly - raises FE_INVALID. */ - if (__builtin_expect - ((__builtin_fabs (xh) <= -(double) (-__LONG_LONG_MAX__ - 1)), 1) -#if !defined (FE_INVALID) - || 1 -#endif - ) - { - if (__glibc_unlikely ((xh == -(double) (-__LONG_LONG_MAX__ - 1)))) - { - /* When XH is 9223372036854775808.0, converting to long long will - overflow, resulting in an invalid operation. However, XL might - be negative and of sufficient magnitude that the overall long - double is in fact in range. Avoid raising an exception. In any - case we need to convert this value specially, because - the converted value is not exactly represented as a double - thus subtracting HI from XH suffers rounding error. */ - hi = __LONG_LONG_MAX__; - xh = 1.0; - } - else - { - hi = (long long) xh; - xh -= hi; - } - ldbl_canonicalize (&xh, &xl); - - lo = (long long) xh; - - /* Peg at max/min values, assuming that the above conversions do so. - Strictly speaking, we can return anything for values that overflow, - but this is more useful. */ - res = hi + lo; - - /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi). */ - if (__glibc_unlikely (((~(hi ^ lo) & (res ^ hi)) < 0))) - goto overflow; - - xh -= lo; - ldbl_canonicalize (&xh, &xl); - - hi = res; - if (xh > 0.5) - { - res += 1; - } - else if (xh == 0.5) - { - if (xl > 0.0 || (xl == 0.0 && res >= 0)) - res += 1; - } - else if (-xh > 0.5) - { - res -= 1; - } - else if (-xh == 0.5) - { - if (xl < 0.0 || (xl == 0.0 && res <= 0)) - res -= 1; - } - - if (__glibc_unlikely (((~(hi ^ (res - hi)) & (res ^ hi)) < 0))) - goto overflow; - - return res; - } - else - { - if (xh > 0.0) - hi = __LONG_LONG_MAX__; - else if (xh < 0.0) - hi = -__LONG_LONG_MAX__ - 1; - else - /* Nan */ - hi = 0; - } - -overflow: -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - return hi; -} - -long_double_symbol (libm, __llroundl, llroundl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c b/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c deleted file mode 100644 index 5457892a98..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_log1pl.c +++ /dev/null @@ -1,249 +0,0 @@ -/* log1pl.c - * - * Relative error logarithm - * Natural logarithm of 1+x, 128-bit long double precision - * - * - * - * SYNOPSIS: - * - * long double x, y, log1pl(); - * - * y = log1pl( x ); - * - * - * - * DESCRIPTION: - * - * Returns the base e (2.718...) logarithm of 1+x. - * - * The argument 1+x is separated into its exponent and fractional - * parts. If the exponent is between -1 and +1, the logarithm - * of the fraction is approximated by - * - * log(1+x) = x - 0.5 x^2 + x^3 P(x)/Q(x). - * - * Otherwise, setting z = 2(w-1)/(w+1), - * - * log(w) = z + z^3 P(z)/Q(z). - * - * - * - * ACCURACY: - * - * Relative error: - * arithmetic domain # trials peak rms - * IEEE -1, 8 100000 1.9e-34 4.3e-35 - */ - -/* Copyright 2001 by Stephen L. Moshier - - This 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. - - This 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 this library; if not, see - <http://www.gnu.org/licenses/>. */ - - -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -/* Coefficients for log(1+x) = x - x^2 / 2 + x^3 P(x)/Q(x) - * 1/sqrt(2) <= 1+x < sqrt(2) - * Theoretical peak relative error = 5.3e-37, - * relative peak error spread = 2.3e-14 - */ -static const long double - P12 = 1.538612243596254322971797716843006400388E-6L, - P11 = 4.998469661968096229986658302195402690910E-1L, - P10 = 2.321125933898420063925789532045674660756E1L, - P9 = 4.114517881637811823002128927449878962058E2L, - P8 = 3.824952356185897735160588078446136783779E3L, - P7 = 2.128857716871515081352991964243375186031E4L, - P6 = 7.594356839258970405033155585486712125861E4L, - P5 = 1.797628303815655343403735250238293741397E5L, - P4 = 2.854829159639697837788887080758954924001E5L, - P3 = 3.007007295140399532324943111654767187848E5L, - P2 = 2.014652742082537582487669938141683759923E5L, - P1 = 7.771154681358524243729929227226708890930E4L, - P0 = 1.313572404063446165910279910527789794488E4L, - /* Q12 = 1.000000000000000000000000000000000000000E0L, */ - Q11 = 4.839208193348159620282142911143429644326E1L, - Q10 = 9.104928120962988414618126155557301584078E2L, - Q9 = 9.147150349299596453976674231612674085381E3L, - Q8 = 5.605842085972455027590989944010492125825E4L, - Q7 = 2.248234257620569139969141618556349415120E5L, - Q6 = 6.132189329546557743179177159925690841200E5L, - Q5 = 1.158019977462989115839826904108208787040E6L, - Q4 = 1.514882452993549494932585972882995548426E6L, - Q3 = 1.347518538384329112529391120390701166528E6L, - Q2 = 7.777690340007566932935753241556479363645E5L, - Q1 = 2.626900195321832660448791748036714883242E5L, - Q0 = 3.940717212190338497730839731583397586124E4L; - -/* Coefficients for log(x) = z + z^3 P(z^2)/Q(z^2), - * where z = 2(x-1)/(x+1) - * 1/sqrt(2) <= x < sqrt(2) - * Theoretical peak relative error = 1.1e-35, - * relative peak error spread 1.1e-9 - */ -static const long double - R5 = -8.828896441624934385266096344596648080902E-1L, - R4 = 8.057002716646055371965756206836056074715E1L, - R3 = -2.024301798136027039250415126250455056397E3L, - R2 = 2.048819892795278657810231591630928516206E4L, - R1 = -8.977257995689735303686582344659576526998E4L, - R0 = 1.418134209872192732479751274970992665513E5L, - /* S6 = 1.000000000000000000000000000000000000000E0L, */ - S5 = -1.186359407982897997337150403816839480438E2L, - S4 = 3.998526750980007367835804959888064681098E3L, - S3 = -5.748542087379434595104154610899551484314E4L, - S2 = 4.001557694070773974936904547424676279307E5L, - S1 = -1.332535117259762928288745111081235577029E6L, - S0 = 1.701761051846631278975701529965589676574E6L; - -/* C1 + C2 = ln 2 */ -static const long double C1 = 6.93145751953125E-1L; -static const long double C2 = 1.428606820309417232121458176568075500134E-6L; - -static const long double sqrth = 0.7071067811865475244008443621048490392848L; -/* ln (2^16384 * (1 - 2^-113)) */ -static const long double zero = 0.0L; - - -long double -__log1pl (long double xm1) -{ - long double x, y, z, r, s; - double xhi; - int32_t hx, lx; - int e; - - /* Test for NaN or infinity input. */ - xhi = ldbl_high (xm1); - EXTRACT_WORDS (hx, lx, xhi); - if (hx >= 0x7ff00000) - return xm1 + xm1; - - /* log1p(+- 0) = +- 0. */ - if (((hx & 0x7fffffff) | lx) == 0) - return xm1; - - if (xm1 >= 0x1p107L) - x = xm1; - else - x = xm1 + 1.0L; - - /* log1p(-1) = -inf */ - if (x <= 0.0L) - { - if (x == 0.0L) - return (-1.0L / 0.0L); - else - return (zero / (x - x)); - } - - /* Separate mantissa from exponent. */ - - /* Use frexp used so that denormal numbers will be handled properly. */ - x = __frexpl (x, &e); - - /* Logarithm using log(x) = z + z^3 P(z^2)/Q(z^2), - where z = 2(x-1)/x+1). */ - if ((e > 2) || (e < -2)) - { - if (x < sqrth) - { /* 2( 2x-1 )/( 2x+1 ) */ - e -= 1; - z = x - 0.5L; - y = 0.5L * z + 0.5L; - } - else - { /* 2 (x-1)/(x+1) */ - z = x - 0.5L; - z -= 0.5L; - y = 0.5L * x + 0.5L; - } - x = z / y; - z = x * x; - r = ((((R5 * z - + R4) * z - + R3) * z - + R2) * z - + R1) * z - + R0; - s = (((((z - + S5) * z - + S4) * z - + S3) * z - + S2) * z - + S1) * z - + S0; - z = x * (z * r / s); - z = z + e * C2; - z = z + x; - z = z + e * C1; - return (z); - } - - - /* Logarithm using log(1+x) = x - .5x^2 + x^3 P(x)/Q(x). */ - - if (x < sqrth) - { - e -= 1; - if (e != 0) - x = 2.0L * x - 1.0L; /* 2x - 1 */ - else - x = xm1; - } - else - { - if (e != 0) - x = x - 1.0L; - else - x = xm1; - } - z = x * x; - r = (((((((((((P12 * x - + P11) * x - + P10) * x - + P9) * x - + P8) * x - + P7) * x - + P6) * x - + P5) * x - + P4) * x - + P3) * x - + P2) * x - + P1) * x - + P0; - s = (((((((((((x - + Q11) * x - + Q10) * x - + Q9) * x - + Q8) * x - + Q7) * x - + Q6) * x - + Q5) * x - + Q4) * x - + Q3) * x - + Q2) * x - + Q1) * x - + Q0; - y = x * (z * r / s); - y = y + e * C2; - z = y - 0.5L * z; - z = z + x; - z = z + e * C1; - return (z); -} diff --git a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c b/sysdeps/ieee754/ldbl-128ibm/s_logbl.c deleted file mode 100644 index 3c07c5e8e2..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_logbl.c +++ /dev/null @@ -1,63 +0,0 @@ -/* s_logbl.c -- long double version of s_logb.c. - * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* - * long double logbl(x) - * IEEE 754 logb. Included to pass IEEE test suite. Not recommend. - * Use ilogb instead. - */ - -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> -#include <fix-int-fp-convert-zero.h> - -long double -__logbl (long double x) -{ - int64_t hx, hxs, rhx; - double xhi, xlo; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - hxs = hx; - hx &= 0x7fffffffffffffffLL; /* high |x| */ - if (hx == 0) - return -1.0 / fabs (x); - if (hx >= 0x7ff0000000000000LL) - return x * x; - if (__glibc_unlikely ((rhx = hx >> 52) == 0)) - { - /* POSIX specifies that denormal number is treated as - though it were normalized. */ - rhx -= __builtin_clzll (hx) - 12; - } - else if ((hx & 0x000fffffffffffffLL) == 0) - { - /* If the high part is a power of 2, and the low part is nonzero - with the opposite sign, the low part affects the - exponent. */ - int64_t lx; - EXTRACT_WORDS64 (lx, xlo); - if ((hxs ^ lx) < 0 && (lx & 0x7fffffffffffffffLL) != 0) - rhx--; - } - if (FIX_INT_FP_CONVERT_ZERO && rhx == 1023) - return 0.0L; - return (long double) (rhx - 1023); -} -#ifndef __logbl -long_double_symbol (libm, __logbl, logbl); -#endif diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c b/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c deleted file mode 100644 index b404cab8e3..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_lrintl.c +++ /dev/null @@ -1,155 +0,0 @@ -/* Round to long int long double floating-point values. - IBM extended format long double version. - Copyright (C) 2006-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <fenv.h> -#include <math_ldbl_opt.h> -#include <float.h> -#include <ieee754.h> - - -long -__lrintl (long double x) -{ - double xh, xl; - long res, hi, lo; - int save_round; - - ldbl_unpack (x, &xh, &xl); - - /* Limit the range of values handled by the conversion to long. - We do this because we aren't sure whether that conversion properly - raises FE_INVALID. */ - if ( -#if __LONG_MAX__ == 2147483647 - __builtin_expect - ((__builtin_fabs (xh) <= (double) __LONG_MAX__ + 2), 1) -#else - __builtin_expect - ((__builtin_fabs (xh) <= -(double) (-__LONG_MAX__ - 1)), 1) -#endif -#if !defined (FE_INVALID) - || 1 -#endif - ) - { - save_round = fegetround (); - -#if __LONG_MAX__ == 2147483647 - long long llhi = (long long) xh; - if (llhi != (long) llhi) - hi = llhi < 0 ? -__LONG_MAX__ - 1 : __LONG_MAX__; - else - hi = llhi; - xh -= hi; -#else - if (__glibc_unlikely ((xh == -(double) (-__LONG_MAX__ - 1)))) - { - /* When XH is 9223372036854775808.0, converting to long long will - overflow, resulting in an invalid operation. However, XL might - be negative and of sufficient magnitude that the overall long - double is in fact in range. Avoid raising an exception. In any - case we need to convert this value specially, because - the converted value is not exactly represented as a double - thus subtracting HI from XH suffers rounding error. */ - hi = __LONG_MAX__; - xh = 1.0; - } - else - { - hi = (long) xh; - xh -= hi; - } -#endif - ldbl_canonicalize (&xh, &xl); - - lo = (long) xh; - - /* Peg at max/min values, assuming that the above conversions do so. - Strictly speaking, we can return anything for values that overflow, - but this is more useful. */ - res = hi + lo; - - /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi). */ - if (__glibc_unlikely (((~(hi ^ lo) & (res ^ hi)) < 0))) - goto overflow; - - xh -= lo; - ldbl_canonicalize (&xh, &xl); - - hi = res; - switch (save_round) - { - case FE_TONEAREST: - if (fabs (xh) < 0.5 - || (fabs (xh) == 0.5 - && ((xh > 0.0 && xl < 0.0) - || (xh < 0.0 && xl > 0.0) - || (xl == 0.0 && (res & 1) == 0)))) - return res; - - if (xh < 0.0) - res -= 1; - else - res += 1; - break; - - case FE_TOWARDZERO: - if (res > 0 && (xh < 0.0 || (xh == 0.0 && xl < 0.0))) - res -= 1; - else if (res < 0 && (xh > 0.0 || (xh == 0.0 && xl > 0.0))) - res += 1; - return res; - break; - - case FE_UPWARD: - if (xh > 0.0 || (xh == 0.0 && xl > 0.0)) - res += 1; - break; - - case FE_DOWNWARD: - if (xh < 0.0 || (xh == 0.0 && xl < 0.0)) - res -= 1; - break; - } - - if (__glibc_unlikely (((~(hi ^ (res - hi)) & (res ^ hi)) < 0))) - goto overflow; - - return res; - } - else - { - if (xh > 0.0) - hi = __LONG_MAX__; - else if (xh < 0.0) - hi = -__LONG_MAX__ - 1; - else - /* Nan */ - hi = 0; - } - -overflow: -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - return hi; -} - -long_double_symbol (libm, __lrintl, lrintl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c b/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c deleted file mode 100644 index f9ae37e844..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_lroundl.c +++ /dev/null @@ -1,135 +0,0 @@ -/* Round to long int long double floating-point values. - IBM extended format long double version. - Copyright (C) 2006-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <fenv.h> -#include <math_ldbl_opt.h> -#include <float.h> -#include <ieee754.h> - -long -__lroundl (long double x) -{ - double xh, xl; - long res, hi, lo; - - ldbl_unpack (x, &xh, &xl); - - /* Limit the range of values handled by the conversion to long. - We do this because we aren't sure whether that conversion properly - raises FE_INVALID. */ - if ( -#if __LONG_MAX__ == 2147483647 - __builtin_expect - ((__builtin_fabs (xh) <= (double) __LONG_MAX__ + 2), 1) -#else - __builtin_expect - ((__builtin_fabs (xh) <= -(double) (-__LONG_MAX__ - 1)), 1) -#endif -#if !defined (FE_INVALID) - || 1 -#endif - ) - { -#if __LONG_MAX__ == 2147483647 - long long llhi = (long long) xh; - if (llhi != (long) llhi) - hi = llhi < 0 ? -__LONG_MAX__ - 1 : __LONG_MAX__; - else - hi = llhi; - xh -= hi; -#else - if (__glibc_unlikely ((xh == -(double) (-__LONG_MAX__ - 1)))) - { - /* When XH is 9223372036854775808.0, converting to long long will - overflow, resulting in an invalid operation. However, XL might - be negative and of sufficient magnitude that the overall long - double is in fact in range. Avoid raising an exception. In any - case we need to convert this value specially, because - the converted value is not exactly represented as a double - thus subtracting HI from XH suffers rounding error. */ - hi = __LONG_MAX__; - xh = 1.0; - } - else - { - hi = (long) xh; - xh -= hi; - } -#endif - ldbl_canonicalize (&xh, &xl); - - lo = (long) xh; - - /* Peg at max/min values, assuming that the above conversions do so. - Strictly speaking, we can return anything for values that overflow, - but this is more useful. */ - res = hi + lo; - - /* This is just sign(hi) == sign(lo) && sign(res) != sign(hi). */ - if (__glibc_unlikely (((~(hi ^ lo) & (res ^ hi)) < 0))) - goto overflow; - - xh -= lo; - ldbl_canonicalize (&xh, &xl); - - hi = res; - if (xh > 0.5) - { - res += 1; - } - else if (xh == 0.5) - { - if (xl > 0.0 || (xl == 0.0 && res >= 0)) - res += 1; - } - else if (-xh > 0.5) - { - res -= 1; - } - else if (-xh == 0.5) - { - if (xl < 0.0 || (xl == 0.0 && res <= 0)) - res -= 1; - } - - if (__glibc_unlikely (((~(hi ^ (res - hi)) & (res ^ hi)) < 0))) - goto overflow; - - return res; - } - else - { - if (xh > 0.0) - hi = __LONG_MAX__; - else if (xh < 0.0) - hi = -__LONG_MAX__ - 1; - else - /* Nan */ - hi = 0; - } - -overflow: -#ifdef FE_INVALID - feraiseexcept (FE_INVALID); -#endif - return hi; -} - -long_double_symbol (libm, __lroundl, lroundl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_modfl.c b/sysdeps/ieee754/ldbl-128ibm/s_modfl.c deleted file mode 100644 index 260cc3e33c..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_modfl.c +++ /dev/null @@ -1,96 +0,0 @@ -/* s_modfl.c -- long double version of s_modf.c. - * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * modfl(long double x, long double *iptr) - * return fraction part of x, and return x's integral part in *iptr. - * Method: - * Bit twiddling. - * - * Exception: - * No exception. - */ - -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -static const long double one = 1.0; - -long double __modfl(long double x, long double *iptr) -{ - int64_t i0,i1,j0; - u_int64_t i; - double xhi, xlo; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (i0, xhi); - EXTRACT_WORDS64 (i1, xlo); - i1 &= 0x000fffffffffffffLL; - j0 = ((i0>>52)&0x7ff)-0x3ff; /* exponent of x */ - if(j0<52) { /* integer part in high x */ - if(j0<0) { /* |x|<1 */ - /* *iptr = +-0 */ - INSERT_WORDS64 (xhi, i0&0x8000000000000000ULL); - *iptr = xhi; - return x; - } else { - i = (0x000fffffffffffffLL)>>j0; - if(((i0&i)|(i1&0x7fffffffffffffffLL))==0) { /* x is integral */ - *iptr = x; - /* return +-0 */ - INSERT_WORDS64 (xhi, i0&0x8000000000000000ULL); - x = xhi; - return x; - } else { - INSERT_WORDS64 (xhi, i0&(~i)); - *iptr = xhi; - return x - *iptr; - } - } - } else if (j0>103) { /* no fraction part */ - *iptr = x*one; - /* We must handle NaNs separately. */ - if ((i0 & 0x7fffffffffffffffLL) > 0x7ff0000000000000LL) - return x*one; - /* return +-0 */ - INSERT_WORDS64 (xhi, i0&0x8000000000000000ULL); - x = xhi; - return x; - } else { /* fraction part in low x */ - i = -1ULL>>(j0-52); - if((i1&i)==0) { /* x is integral */ - *iptr = x; - /* return +-0 */ - INSERT_WORDS64 (xhi, i0&0x8000000000000000ULL); - x = xhi; - return x; - } else { - INSERT_WORDS64 (xhi, i0); - INSERT_WORDS64 (xlo, i1&(~i)); - *iptr = ldbl_pack (xhi, xlo); - return x - *iptr; - } - } -} -#if IS_IN (libm) -long_double_symbol (libm, __modfl, modfl); -#else -long_double_symbol (libc, __modfl, modfl); -#endif diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c b/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c deleted file mode 100644 index 18b052cecb..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_nearbyintl.c +++ /dev/null @@ -1,21 +0,0 @@ -/* Round to int long double floating-point values without raising inexact. - IBM extended format long double version. - Copyright (C) 2006-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#define USE_AS_NEARBYINTL -#include "s_rintl.c" diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c b/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c deleted file mode 100644 index 0d6469d548..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c +++ /dev/null @@ -1,160 +0,0 @@ -/* s_nextafterl.c -- long double version of s_nextafter.c. - * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* IEEE functions - * nextafterl(x,y) - * return the next machine floating-point number of x in the - * direction toward y. - * Special cases: - */ - -#include <errno.h> -#include <float.h> -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -long double __nextafterl(long double x, long double y) -{ - int64_t hx, hy, ihx, ihy, lx; - double xhi, xlo, yhi; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - EXTRACT_WORDS64 (lx, xlo); - yhi = ldbl_high (y); - EXTRACT_WORDS64 (hy, yhi); - ihx = hx&0x7fffffffffffffffLL; /* |hx| */ - ihy = hy&0x7fffffffffffffffLL; /* |hy| */ - - if((ihx>0x7ff0000000000000LL) || /* x is nan */ - (ihy>0x7ff0000000000000LL)) /* y is nan */ - return x+y; /* signal the nan */ - if(x==y) - return y; /* x=y, return y */ - if(ihx == 0) { /* x == 0 */ - long double u; /* return +-minsubnormal */ - hy = (hy & 0x8000000000000000ULL) | 1; - INSERT_WORDS64 (yhi, hy); - x = yhi; - u = math_opt_barrier (x); - u = u * u; - math_force_eval (u); /* raise underflow flag */ - return x; - } - - long double u; - if(x > y) { /* x > y, x -= ulp */ - /* This isn't the largest magnitude correctly rounded - long double as you can see from the lowest mantissa - bit being zero. It is however the largest magnitude - long double with a 106 bit mantissa, and nextafterl - is insane with variable precision. So to make - nextafterl sane we assume 106 bit precision. */ - if((hx==0xffefffffffffffffLL)&&(lx==0xfc8ffffffffffffeLL)) { - u = x+x; /* overflow, return -inf */ - math_force_eval (u); - __set_errno (ERANGE); - return y; - } - if (hx >= 0x7ff0000000000000LL) { - u = 0x1.fffffffffffff7ffffffffffff8p+1023L; - return u; - } - if(ihx <= 0x0360000000000000LL) { /* x <= LDBL_MIN */ - u = math_opt_barrier (x); - x -= LDBL_TRUE_MIN; - if (ihx < 0x0360000000000000LL - || (hx > 0 && lx <= 0) - || (hx < 0 && lx > 1)) { - u = u * u; - math_force_eval (u); /* raise underflow flag */ - __set_errno (ERANGE); - } - /* Avoid returning -0 in FE_DOWNWARD mode. */ - if (x == 0.0L) - return 0.0L; - return x; - } - /* If the high double is an exact power of two and the low - double is the opposite sign, then 1ulp is one less than - what we might determine from the high double. Similarly - if X is an exact power of two, and positive, because - making it a little smaller will result in the exponent - decreasing by one and normalisation of the mantissa. */ - if ((hx & 0x000fffffffffffffLL) == 0 - && ((lx != 0 && (hx ^ lx) < 0) - || (lx == 0 && hx >= 0))) - ihx -= 1LL << 52; - if (ihx < (106LL << 52)) { /* ulp will denormal */ - INSERT_WORDS64 (yhi, ihx & (0x7ffLL<<52)); - u = yhi * 0x1p-105; - } else { - INSERT_WORDS64 (yhi, (ihx & (0x7ffLL<<52))-(105LL<<52)); - u = yhi; - } - return x - u; - } else { /* x < y, x += ulp */ - if((hx==0x7fefffffffffffffLL)&&(lx==0x7c8ffffffffffffeLL)) { - u = x+x; /* overflow, return +inf */ - math_force_eval (u); - __set_errno (ERANGE); - return y; - } - if ((uint64_t) hx >= 0xfff0000000000000ULL) { - u = -0x1.fffffffffffff7ffffffffffff8p+1023L; - return u; - } - if(ihx <= 0x0360000000000000LL) { /* x <= LDBL_MIN */ - u = math_opt_barrier (x); - x += LDBL_TRUE_MIN; - if (ihx < 0x0360000000000000LL - || (hx > 0 && lx < 0 && lx != 0x8000000000000001LL) - || (hx < 0 && lx >= 0)) { - u = u * u; - math_force_eval (u); /* raise underflow flag */ - __set_errno (ERANGE); - } - if (x == 0.0L) /* handle negative LDBL_TRUE_MIN case */ - x = -0.0L; - return x; - } - /* If the high double is an exact power of two and the low - double is the opposite sign, then 1ulp is one less than - what we might determine from the high double. Similarly - if X is an exact power of two, and negative, because - making it a little larger will result in the exponent - decreasing by one and normalisation of the mantissa. */ - if ((hx & 0x000fffffffffffffLL) == 0 - && ((lx != 0 && (hx ^ lx) < 0) - || (lx == 0 && hx < 0))) - ihx -= 1LL << 52; - if (ihx < (106LL << 52)) { /* ulp will denormal */ - INSERT_WORDS64 (yhi, ihx & (0x7ffLL<<52)); - u = yhi * 0x1p-105; - } else { - INSERT_WORDS64 (yhi, (ihx & (0x7ffLL<<52))-(105LL<<52)); - u = yhi; - } - return x + u; - } -} -strong_alias (__nextafterl, __nexttowardl) -long_double_symbol (libm, __nextafterl, nextafterl); -long_double_symbol (libm, __nexttowardl, nexttowardl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c b/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c deleted file mode 100644 index d8f4fc6523..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c +++ /dev/null @@ -1,90 +0,0 @@ -/* s_nexttoward.c - * Conversion from s_nextafter.c by Ulrich Drepper, Cygnus Support, - * drepper@cygnus.com and Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* IEEE functions - * nexttoward(x,y) - * return the next machine floating-point number of x in the - * direction toward y. - * Special cases: - */ - -#include <errno.h> -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> -#include <float.h> - -double __nexttoward(double x, long double y) -{ - int32_t hx,ix; - int64_t hy,iy; - uint32_t lx; - double yhi; - - EXTRACT_WORDS(hx,lx,x); - yhi = ldbl_high (y); - EXTRACT_WORDS64(hy,yhi); - ix = hx&0x7fffffff; /* |x| */ - iy = hy&0x7fffffffffffffffLL; /* |y| */ - - if(((ix>=0x7ff00000)&&((ix-0x7ff00000)|lx)!=0) || /* x is nan */ - iy>0x7ff0000000000000LL) /* y is nan */ - return x+y; - if((long double) x==y) return y; /* x=y, return y */ - if((ix|lx)==0) { /* x == 0 */ - double u; - INSERT_WORDS(x,(uint32_t)((hy>>32)&0x80000000),1);/* return +-minsub */ - u = math_opt_barrier (x); - u = u * u; - math_force_eval (u); /* raise underflow flag */ - return x; - } - if(hx>=0) { /* x > 0 */ - if (x > y) { /* x > 0 */ - if(lx==0) hx -= 1; - lx -= 1; - } else { /* x < y, x += ulp */ - lx += 1; - if(lx==0) hx += 1; - } - } else { /* x < 0 */ - if (x < y) { /* x < 0 */ - if(lx==0) hx -= 1; - lx -= 1; - } else { /* x > y, x += ulp */ - lx += 1; - if(lx==0) hx += 1; - } - } - hy = hx&0x7ff00000; - if(hy>=0x7ff00000) { - double u = x+x; /* overflow */ - math_force_eval (u); - __set_errno (ERANGE); - } - if(hy<0x00100000) { - double u = x*x; /* underflow */ - math_force_eval (u); /* raise underflow flag */ - __set_errno (ERANGE); - } - INSERT_WORDS(x,hx,lx); - return x; -} -long_double_symbol (libm, __nexttoward, nexttoward); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c b/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c deleted file mode 100644 index 7c5d1cc112..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c +++ /dev/null @@ -1,79 +0,0 @@ -/* s_nexttowardf.c -- float version of s_nextafter.c. - * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com - * and Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -#include <errno.h> -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> -#include <float.h> - -float __nexttowardf(float x, long double y) -{ - int32_t hx,ix; - int64_t hy,iy; - double yhi; - - GET_FLOAT_WORD(hx,x); - yhi = ldbl_high (y); - EXTRACT_WORDS64 (hy, yhi); - ix = hx&0x7fffffff; /* |x| */ - iy = hy&0x7fffffffffffffffLL; /* |y| */ - - if((ix>0x7f800000) || /* x is nan */ - (iy>0x7ff0000000000000LL)) - /* y is nan */ - return x+y; - if((long double) x==y) return y; /* x=y, return y */ - if(ix==0) { /* x == 0 */ - float u; - SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/ - u = math_opt_barrier (x); - u = u * u; - math_force_eval (u); /* raise underflow flag */ - return x; - } - if(hx>=0) { /* x > 0 */ - if(x > y) { /* x -= ulp */ - hx -= 1; - } else { /* x < y, x += ulp */ - hx += 1; - } - } else { /* x < 0 */ - if(x < y) { /* x -= ulp */ - hx -= 1; - } else { /* x > y, x += ulp */ - hx += 1; - } - } - hy = hx&0x7f800000; - if(hy>=0x7f800000) { - float u = x+x; /* overflow */ - math_force_eval (u); - __set_errno (ERANGE); - } - if(hy<0x00800000) { /* underflow */ - float u = x*x; - math_force_eval (u); /* raise underflow flag */ - __set_errno (ERANGE); - } - SET_FLOAT_WORD(x,hx); - return x; -} -long_double_symbol (libm, __nexttowardf, nexttowardf); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nextupl.c b/sysdeps/ieee754/ldbl-128ibm/s_nextupl.c deleted file mode 100644 index bf74f0e1ab..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_nextupl.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Return the least floating-point number greater than X. - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -/* Return the least floating-point number greater than X. */ -long double -__nextupl (long double x) -{ - int64_t hx, ihx, lx; - double xhi, xlo, yhi; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - EXTRACT_WORDS64 (lx, xlo); - ihx = hx & 0x7fffffffffffffffLL; - - if (ihx > 0x7ff0000000000000LL) /* x is nan. */ - return x + x; /* Signal the nan. */ - if (ihx == 0) - return LDBL_TRUE_MIN; - - long double u; - if ((hx == 0x7fefffffffffffffLL) && (lx == 0x7c8ffffffffffffeLL)) - return INFINITY; - if ((uint64_t) hx >= 0xfff0000000000000ULL) - { - u = -0x1.fffffffffffff7ffffffffffff8p+1023L; - return u; - } - if (ihx <= 0x0360000000000000LL) - { /* x <= LDBL_MIN. */ - x += LDBL_TRUE_MIN; - if (x == 0.0L) /* Handle negative LDBL_TRUE_MIN case. */ - x = -0.0L; - return x; - } - /* If the high double is an exact power of two and the low - double is the opposite sign, then 1ulp is one less than - what we might determine from the high double. Similarly - if X is an exact power of two, and negative, because - making it a little larger will result in the exponent - decreasing by one and normalisation of the mantissa. */ - if ((hx & 0x000fffffffffffffLL) == 0 - && ((lx != 0 && lx != 0x8000000000000000LL && (hx ^ lx) < 0) - || ((lx == 0 || lx == 0x8000000000000000LL) && hx < 0))) - ihx -= 1LL << 52; - if (ihx < (106LL << 52)) - { /* ulp will denormal. */ - INSERT_WORDS64 (yhi, ihx & (0x7ffLL << 52)); - u = yhi * 0x1p-105; - } - else - { - INSERT_WORDS64 (yhi, (ihx & (0x7ffLL << 52)) - (105LL << 52)); - u = yhi; - } - return x + u; -} - -weak_alias (__nextupl, nextupl) diff --git a/sysdeps/ieee754/ldbl-128ibm/s_remquol.c b/sysdeps/ieee754/ldbl-128ibm/s_remquol.c deleted file mode 100644 index 9b6ec09d41..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_remquol.c +++ /dev/null @@ -1,119 +0,0 @@ -/* Compute remainder and a congruent to the quotient. - Copyright (C) 1997-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and - Jakub Jelinek <jj@ultra.linux.cz>, 1999. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> - -#include <math_private.h> -#include <math_ldbl_opt.h> - - -static const long double zero = 0.0; - - -long double -__remquol (long double x, long double y, int *quo) -{ - int64_t hx,hy; - u_int64_t sx,lx,ly,qs; - int cquo; - double xhi, xlo, yhi, ylo; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - EXTRACT_WORDS64 (lx, xlo); - ldbl_unpack (y, &yhi, &ylo); - EXTRACT_WORDS64 (hy, yhi); - EXTRACT_WORDS64 (ly, ylo); - sx = hx & 0x8000000000000000ULL; - qs = sx ^ (hy & 0x8000000000000000ULL); - ly ^= hy & 0x8000000000000000ULL; - hy &= 0x7fffffffffffffffLL; - lx ^= sx; - hx &= 0x7fffffffffffffffLL; - - /* Purge off exception values. */ - if (hy == 0) - return (x * y) / (x * y); /* y = 0 */ - if ((hx >= 0x7ff0000000000000LL) /* x not finite */ - || (hy > 0x7ff0000000000000LL)) /* y is NaN */ - return (x * y) / (x * y); - - if (hy <= 0x7fbfffffffffffffLL) - x = __ieee754_fmodl (x, 8 * y); /* now x < 8y */ - - if (((hx - hy) | (lx - ly)) == 0) - { - *quo = qs ? -1 : 1; - return zero * x; - } - - x = fabsl (x); - y = fabsl (y); - cquo = 0; - - if (hy <= 0x7fcfffffffffffffLL && x >= 4 * y) - { - x -= 4 * y; - cquo += 4; - } - if (hy <= 0x7fdfffffffffffffLL && x >= 2 * y) - { - x -= 2 * y; - cquo += 2; - } - - if (hy < 0x0020000000000000LL) - { - if (x + x > y) - { - x -= y; - ++cquo; - if (x + x >= y) - { - x -= y; - ++cquo; - } - } - } - else - { - long double y_half = 0.5L * y; - if (x > y_half) - { - x -= y; - ++cquo; - if (x >= y_half) - { - x -= y; - ++cquo; - } - } - } - - *quo = qs ? -cquo : cquo; - - /* Ensure correct sign of zero result in round-downward mode. */ - if (x == 0.0L) - x = 0.0L; - if (sx) - x = -x; - return x; -} -long_double_symbol (libm, __remquol, remquol); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_rintl.c b/sysdeps/ieee754/ldbl-128ibm/s_rintl.c deleted file mode 100644 index ea8c2bca0e..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_rintl.c +++ /dev/null @@ -1,129 +0,0 @@ -/* Round to int long double floating-point values. - IBM extended format long double version. - Copyright (C) 2006-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* This has been coded in assembler because GCC makes such a mess of it - when it's coded in C. */ - -#include <math.h> -#include <fenv.h> -#include <math_ldbl_opt.h> -#include <float.h> -#include <ieee754.h> - -#ifdef USE_AS_NEARBYINTL -# define rintl nearbyintl -# define __rintl __nearbyintl -#endif - - -long double -__rintl (long double x) -{ - double xh, xl, hi, lo; - - ldbl_unpack (x, &xh, &xl); - - /* Return Inf, Nan, +/-0 unchanged. */ - if (__builtin_expect (xh != 0.0 - && __builtin_isless (__builtin_fabs (xh), - __builtin_inf ()), 1)) - { - double orig_xh; - int save_round = fegetround (); - - /* Long double arithmetic, including the canonicalisation below, - only works in round-to-nearest mode. */ -#ifdef USE_AS_NEARBYINTL - SET_RESTORE_ROUND_NOEX (FE_TONEAREST); -#else - fesetround (FE_TONEAREST); -#endif - - /* Convert the high double to integer. */ - orig_xh = xh; - hi = ldbl_nearbyint (xh); - - /* Subtract integral high part from the value. If the low double - happens to be exactly 0.5 or -0.5, you might think that this - subtraction could result in an incorrect conversion. For - instance, subtracting an odd number would cause this function - to round in the wrong direction. However, if we have a - canonical long double with the low double 0.5 or -0.5, then the - high double must be even. */ - xh -= hi; - ldbl_canonicalize (&xh, &xl); - - /* Now convert the low double, adjusted for any remainder from the - high double. */ - lo = ldbl_nearbyint (xh); - - xh -= lo; - ldbl_canonicalize (&xh, &xl); - - switch (save_round) - { - case FE_TONEAREST: - if (xl > 0.0 && xh == 0.5) - lo += 1.0; - else if (xl < 0.0 && -xh == 0.5) - lo -= 1.0; - break; - - case FE_TOWARDZERO: - if (orig_xh < 0.0) - goto do_up; - /* Fall thru */ - - case FE_DOWNWARD: - if (xh < 0.0 || (xh == 0.0 && xl < 0.0)) - lo -= 1.0; - break; - - case FE_UPWARD: - do_up: - if (xh > 0.0 || (xh == 0.0 && xl > 0.0)) - lo += 1.0; - break; - } - - /* Ensure the final value is canonical. In certain cases, - rounding causes hi,lo calculated so far to be non-canonical. */ - xh = hi; - xl = lo; - ldbl_canonicalize (&xh, &xl); - - /* Ensure we return -0 rather than +0 when appropriate. */ - if (orig_xh < 0.0) - xh = -__builtin_fabs (xh); - -#ifdef USE_AS_NEARBYINTL - math_force_eval (xh); - math_force_eval (xl); -#else - fesetround (save_round); -#endif - } - else - /* Quiet signaling NaN arguments. */ - xh += xh; - - return ldbl_pack (xh, xl); -} - -long_double_symbol (libm, __rintl, rintl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c b/sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c deleted file mode 100644 index f4221cda4b..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_roundevenl.c +++ /dev/null @@ -1,69 +0,0 @@ -/* Round to nearest integer value, rounding halfway cases to even. - ldbl-128ibm version. - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_private.h> - -long double -roundevenl (long double x) -{ - double xh, xl, hi; - - ldbl_unpack (x, &xh, &xl); - - if (xh != 0 && isfinite (xh)) - { - hi = roundeven (xh); - if (hi != xh) - { - /* The high part is not an integer; the low part only - affects the result if the high part is exactly half way - between two integers and the low part is nonzero in the - opposite direction to the rounding of the high part. */ - double diff = hi - xh; - if (fabs (diff) == 0.5) - { - if (xl < 0 && diff > 0) - xh = hi - 1; - else if (xl > 0 && diff < 0) - xh = hi + 1; - else - xh = hi; - } - else - xh = hi; - xl = 0; - } - else - { - /* The high part is a nonzero integer. Rounding the low - part to nearest, ties round to even, is always correct, - as a high part that is an odd integer together with a low - part with magnitude 0.5 is not a valid long double. */ - xl = roundeven (xl); - xh = hi; - ldbl_canonicalize_int (&xh, &xl); - } - } - else - /* Quiet signaling NaN arguments. */ - xh += xh; - - return ldbl_pack (xh, xl); -} diff --git a/sysdeps/ieee754/ldbl-128ibm/s_roundl.c b/sysdeps/ieee754/ldbl-128ibm/s_roundl.c deleted file mode 100644 index 0b70e24637..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_roundl.c +++ /dev/null @@ -1,87 +0,0 @@ -/* Round to int long double floating-point values. - IBM extended format long double version. - Copyright (C) 2006-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* This has been coded in assembler because GCC makes such a mess of it - when it's coded in C. */ - -#include <math.h> -#include <math_ldbl_opt.h> -#include <float.h> -#include <ieee754.h> - - -long double -__roundl (long double x) -{ - double xh, xl, hi, lo; - - ldbl_unpack (x, &xh, &xl); - - /* Return Inf, Nan, +/-0 unchanged. */ - if (__builtin_expect (xh != 0.0 - && __builtin_isless (__builtin_fabs (xh), - __builtin_inf ()), 1)) - { - hi = __round (xh); - if (hi != xh) - { - /* The high part is not an integer; the low part only - affects the result if the high part is exactly half way - between two integers and the low part is nonzero with the - opposite sign. */ - if (fabs (hi - xh) == 0.5) - { - if (xh > 0 && xl < 0) - xh = hi - 1; - else if (xh < 0 && xl > 0) - xh = hi + 1; - else - xh = hi; - } - else - xh = hi; - xl = 0; - } - else - { - /* The high part is a nonzero integer. */ - lo = __round (xl); - if (fabs (lo - xl) == 0.5) - { - if (xh > 0 && xl < 0) - xl = lo + 1; - else if (xh < 0 && lo > 0) - xl = lo - 1; - else - xl = lo; - } - else - xl = lo; - xh = hi; - ldbl_canonicalize_int (&xh, &xl); - } - } - else - /* Quiet signaling NaN arguments. */ - xh += xh; - - return ldbl_pack (xh, xl); -} - -long_double_symbol (libm, __roundl, roundl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c b/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c deleted file mode 100644 index 031635267f..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_scalblnl.c +++ /dev/null @@ -1,104 +0,0 @@ -/* s_scalblnl.c -- long double version of s_scalbln.c. - * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* @(#)s_scalbln.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * scalblnl (long double x, long int n) - * scalblnl(x,n) returns x* 2**n computed by exponent - * manipulation rather than by actually performing an - * exponentiation or a multiplication. - */ - -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -static const long double -twolm54 = 5.55111512312578270212e-17, /* 0x3C90000000000000, 0 */ -huge = 1.0E+300L, -tiny = 1.0E-300L; -static const double -two54 = 1.80143985094819840000e+16, /* 0x4350000000000000 */ -twom54 = 5.55111512312578270212e-17; /* 0x3C90000000000000 */ - -long double __scalblnl (long double x, long int n) -{ - int64_t k,l,hx,lx; - union { int64_t i; double d; } u; - double xhi, xlo; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - EXTRACT_WORDS64 (lx, xlo); - k = (hx>>52)&0x7ff; /* extract exponent */ - l = (lx>>52)&0x7ff; - if (k==0) { /* 0 or subnormal x */ - if ((hx&0x7fffffffffffffffULL)==0) return x; /* +-0 */ - u.i = hx; - u.d *= two54; - hx = u.i; - k = ((hx>>52)&0x7ff) - 54; - } - else if (k==0x7ff) return x+x; /* NaN or Inf */ - if (n< -50000) return tiny*__copysignl(tiny,x); /*underflow */ - if (n> 50000 || k+n > 0x7fe) - return huge*__copysignl(huge,x); /* overflow */ - /* Now k and n are bounded we know that k = k+n does not - overflow. */ - k = k+n; - if (k > 0) { /* normal result */ - hx = (hx&0x800fffffffffffffULL)|(k<<52); - if ((lx & 0x7fffffffffffffffULL) == 0) { /* low part +-0 */ - INSERT_WORDS64 (xhi, hx); - INSERT_WORDS64 (xlo, lx); - x = ldbl_pack (xhi, xlo); - return x; - } - if (l == 0) { /* low part subnormal */ - u.i = lx; - u.d *= two54; - lx = u.i; - l = ((lx>>52)&0x7ff) - 54; - } - l = l + n; - if (l > 0) - lx = (lx&0x800fffffffffffffULL)|(l<<52); - else if (l <= -54) - lx = (lx&0x8000000000000000ULL); - else { - l += 54; - u.i = (lx&0x800fffffffffffffULL)|(l<<52); - u.d *= twom54; - lx = u.i; - } - INSERT_WORDS64 (xhi, hx); - INSERT_WORDS64 (xlo, lx); - x = ldbl_pack (xhi, xlo); - return x; - } - if (k <= -54) - return tiny*__copysignl(tiny,x); /*underflow*/ - k += 54; /* subnormal result */ - lx &= 0x8000000000000000ULL; - hx &= 0x800fffffffffffffULL; - INSERT_WORDS64 (xhi, hx|(k<<52)); - INSERT_WORDS64 (xlo, lx); - x = ldbl_pack (xhi, xlo); - return x*twolm54; -} diff --git a/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c b/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c deleted file mode 100644 index 0c4508835e..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_scalbnl.c +++ /dev/null @@ -1,104 +0,0 @@ -/* s_scalbnl.c -- long double version of s_scalbn.c. - * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* @(#)s_scalbn.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: $"; -#endif - -/* - * scalbnl (long double x, int n) - * scalbnl(x,n) returns x* 2**n computed by exponent - * manipulation rather than by actually performing an - * exponentiation or a multiplication. - */ - -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -static const long double -twolm54 = 5.55111512312578270212e-17, /* 0x3C90000000000000, 0 */ -huge = 1.0E+300L, -tiny = 1.0E-300L; -static const double -two54 = 1.80143985094819840000e+16, /* 0x4350000000000000 */ -twom54 = 5.55111512312578270212e-17; /* 0x3C90000000000000 */ - -long double __scalbnl (long double x, int n) -{ - int64_t k,l,hx,lx; - union { int64_t i; double d; } u; - double xhi, xlo; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - EXTRACT_WORDS64 (lx, xlo); - k = (hx>>52)&0x7ff; /* extract exponent */ - l = (lx>>52)&0x7ff; - if (k==0) { /* 0 or subnormal x */ - if ((hx&0x7fffffffffffffffULL)==0) return x; /* +-0 */ - u.i = hx; - u.d *= two54; - hx = u.i; - k = ((hx>>52)&0x7ff) - 54; - } - else if (k==0x7ff) return x+x; /* NaN or Inf */ - if (n< -50000) return tiny*__copysignl(tiny,x); /*underflow */ - if (n> 50000 || k+n > 0x7fe) - return huge*__copysignl(huge,x); /* overflow */ - /* Now k and n are bounded we know that k = k+n does not - overflow. */ - k = k+n; - if (k > 0) { /* normal result */ - hx = (hx&0x800fffffffffffffULL)|(k<<52); - if ((lx & 0x7fffffffffffffffULL) == 0) { /* low part +-0 */ - INSERT_WORDS64 (xhi, hx); - INSERT_WORDS64 (xlo, lx); - x = ldbl_pack (xhi, xlo); - return x; - } - if (l == 0) { /* low part subnormal */ - u.i = lx; - u.d *= two54; - lx = u.i; - l = ((lx>>52)&0x7ff) - 54; - } - l = l + n; - if (l > 0) - lx = (lx&0x800fffffffffffffULL)|(l<<52); - else if (l <= -54) - lx = (lx&0x8000000000000000ULL); - else { - l += 54; - u.i = (lx&0x800fffffffffffffULL)|(l<<52); - u.d *= twom54; - lx = u.i; - } - INSERT_WORDS64 (xhi, hx); - INSERT_WORDS64 (xlo, lx); - x = ldbl_pack (xhi, xlo); - return x; - } - if (k <= -54) - return tiny*__copysignl(tiny,x); /*underflow*/ - k += 54; /* subnormal result */ - lx &= 0x8000000000000000ULL; - hx &= 0x800fffffffffffffULL; - INSERT_WORDS64 (xhi, hx|(k<<52)); - INSERT_WORDS64 (xlo, lx); - x = ldbl_pack (xhi, xlo); - return x*twolm54; -} diff --git a/sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c b/sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c deleted file mode 100644 index 1aba33e6e2..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_setpayloadl.c +++ /dev/null @@ -1,3 +0,0 @@ -#define SIG 0 -#define FUNC setpayloadl -#include <s_setpayloadl_main.c> diff --git a/sysdeps/ieee754/ldbl-128ibm/s_setpayloadl_main.c b/sysdeps/ieee754/ldbl-128ibm/s_setpayloadl_main.c deleted file mode 100644 index 9aa02cdf93..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_setpayloadl_main.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Set NaN payload. ldbl-128ibm version. - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_private.h> -#include <nan-high-order-bit.h> -#include <stdint.h> - -#define SET_HIGH_BIT (HIGH_ORDER_BIT_IS_SET_FOR_SNAN ? SIG : !SIG) -#define BIAS 0x3ff -#define PAYLOAD_DIG 51 -#define EXPLICIT_MANT_DIG 52 - -int -FUNC (long double *x, long double payload) -{ - double hi, lo; - uint64_t hx, lx; - - ldbl_unpack (payload, &hi, &lo); - EXTRACT_WORDS64 (hx, hi); - EXTRACT_WORDS64 (lx, lo); - int exponent = hx >> EXPLICIT_MANT_DIG; - /* Test if argument is (a) negative or too large; (b) too small, - except for 0 when allowed; (c) not an integer. All valid - arguments have the low part zero. */ - if ((lx & 0x7fffffffffffffffULL) != 0 - || exponent >= BIAS + PAYLOAD_DIG - || (exponent < BIAS && !(SET_HIGH_BIT && hx == 0)) - || (hx & ((1ULL << (BIAS + EXPLICIT_MANT_DIG - exponent)) - 1)) != 0) - { - *x = 0.0L; - return 1; - } - if (hx != 0) - { - hx &= (1ULL << EXPLICIT_MANT_DIG) - 1; - hx |= 1ULL << EXPLICIT_MANT_DIG; - hx >>= BIAS + EXPLICIT_MANT_DIG - exponent; - } - hx |= 0x7ff0000000000000ULL | (SET_HIGH_BIT ? 0x8000000000000ULL : 0); - INSERT_WORDS64 (hi, hx); - *x = ldbl_pack (hi, 0.0); - return 0; -} diff --git a/sysdeps/ieee754/ldbl-128ibm/s_setpayloadsigl.c b/sysdeps/ieee754/ldbl-128ibm/s_setpayloadsigl.c deleted file mode 100644 index d97e2c8206..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_setpayloadsigl.c +++ /dev/null @@ -1,3 +0,0 @@ -#define SIG 1 -#define FUNC setpayloadsigl -#include <s_setpayloadl_main.c> diff --git a/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c b/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c deleted file mode 100644 index d6ceede69f..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_signbitl.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Return nonzero value if number is negative. - Copyright (C) 1997-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_ldbl_opt.h> - -int -___signbitl (long double x) -{ - return __builtin_signbitl (x); -} -#if IS_IN (libm) -long_double_symbol (libm, ___signbitl, __signbitl); -#else -long_double_symbol (libc, ___signbitl, __signbitl); -#endif diff --git a/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c b/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c deleted file mode 100644 index 8329979931..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_sincosl.c +++ /dev/null @@ -1,76 +0,0 @@ -/* Compute sine and cosine of argument. - Copyright (C) 1997-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997 and - Jakub Jelinek <jj@ultra.linux.cz>. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <math.h> - -#include <math_private.h> -#include <math_ldbl_opt.h> - -void -__sincosl (long double x, long double *sinx, long double *cosx) -{ - int64_t ix; - double xhi; - - /* High word of x. */ - xhi = ldbl_high (x); - EXTRACT_WORDS64 (ix, xhi); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffffffffffffLL; - if (ix <= 0x3fe921fb54442d10LL) - __kernel_sincosl (x, 0.0L, sinx, cosx, 0); - else if (ix >= 0x7ff0000000000000LL) - { - /* sin(Inf or NaN) is NaN */ - *sinx = *cosx = x - x; - if (isinf (x)) - __set_errno (EDOM); - } - else - { - /* Argument reduction needed. */ - long double y[2]; - int n; - - n = __ieee754_rem_pio2l (x, y); - switch (n & 3) - { - case 0: - __kernel_sincosl (y[0], y[1], sinx, cosx, 1); - break; - case 1: - __kernel_sincosl (y[0], y[1], cosx, sinx, 1); - *cosx = -*cosx; - break; - case 2: - __kernel_sincosl (y[0], y[1], sinx, cosx, 1); - *sinx = -*sinx; - *cosx = -*cosx; - break; - default: - __kernel_sincosl (y[0], y[1], cosx, sinx, 1); - *sinx = -*sinx; - break; - } - } -} -long_double_symbol (libm, __sincosl, sincosl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_sinl.c b/sysdeps/ieee754/ldbl-128ibm/s_sinl.c deleted file mode 100644 index 087921a913..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_sinl.c +++ /dev/null @@ -1,85 +0,0 @@ -/* s_sinl.c -- long double version of s_sin.c. - * Conversion to long double by Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* sinl(x) - * Return sine function of x. - * - * kernel function: - * __kernel_sinl ... sine function on [-pi/4,pi/4] - * __kernel_cosl ... cose function on [-pi/4,pi/4] - * __ieee754_rem_pio2l ... argument reduction routine - * - * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 - * in [-pi/4 , +pi/4], and let n = k mod 4. - * We have - * - * n sin(x) cos(x) tan(x) - * ---------------------------------------------------------- - * 0 S C T - * 1 C -S -1/T - * 2 -S -C T - * 3 -C S -1/T - * ---------------------------------------------------------- - * - * Special cases: - * Let trig be any of sin, cos, or tan. - * trig(+-INF) is NaN, with signals; - * trig(NaN) is that NaN; - * - * Accuracy: - * TRIG(x) returns trig(x) nearly rounded - */ - -#include <errno.h> -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -long double __sinl(long double x) -{ - long double y[2],z=0.0L; - int64_t n, ix; - double xhi; - - /* High word of x. */ - xhi = ldbl_high (x); - EXTRACT_WORDS64 (ix, xhi); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffffffffffffLL; - if(ix <= 0x3fe921fb54442d10LL) - return __kernel_sinl(x,z,0); - - /* sin(Inf or NaN) is NaN */ - else if (ix>=0x7ff0000000000000LL) { - if (ix == 0x7ff0000000000000LL) - __set_errno (EDOM); - return x-x; - } - /* argument reduction needed */ - else { - n = __ieee754_rem_pio2l(x,y); - switch(n&3) { - case 0: return __kernel_sinl(y[0],y[1],1); - case 1: return __kernel_cosl(y[0],y[1]); - case 2: return -__kernel_sinl(y[0],y[1],1); - default: - return -__kernel_cosl(y[0],y[1]); - } - } -} -long_double_symbol (libm, __sinl, sinl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c b/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c deleted file mode 100644 index e6457a1c1c..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_tanhl.c +++ /dev/null @@ -1,87 +0,0 @@ -/* @(#)s_tanh.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: s_tanh.c,v 1.7 1995/05/10 20:48:22 jtc Exp $"; -#endif - -/* Tanh(x) - * Return the Hyperbolic Tangent of x - * - * Method : - * x -x - * e - e - * 0. tanh(x) is defined to be ----------- - * x -x - * e + e - * 1. reduce x to non-negative by tanh(-x) = -tanh(x). - * 2. 0 <= x <= 2**-57 : tanh(x) := x*(one+x) - * -t - * 2**-57 < x <= 1 : tanh(x) := -----; t = expm1(-2x) - * t + 2 - * 2 - * 1 <= x <= 40.0 : tanh(x) := 1- ----- ; t=expm1(2x) - * t + 2 - * 40.0 < x <= INF : tanh(x) := 1. - * - * Special cases: - * tanh(NaN) is NaN; - * only tanh(0)=0 is exact for finite argument. - */ - -#include <float.h> -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -static const long double one=1.0L, two=2.0L, tiny = 1.0e-300L; - -long double __tanhl(long double x) -{ - long double t,z; - int64_t jx,ix; - double xhi; - - /* High word of |x|. */ - xhi = ldbl_high (x); - EXTRACT_WORDS64 (jx, xhi); - ix = jx&0x7fffffffffffffffLL; - - /* x is INF or NaN */ - if(ix>=0x7ff0000000000000LL) { - if (jx>=0) return one/x+one; /* tanh(+-inf)=+-1 */ - else return one/x-one; /* tanh(NaN) = NaN */ - } - - /* |x| < 40 */ - if (ix < 0x4044000000000000LL) { /* |x|<40 */ - if (ix == 0) - return x; /* x == +-0 */ - if (ix<0x3c60000000000000LL) /* |x|<2**-57 */ - { - math_check_force_underflow (x); - return x; /* tanh(small) = small */ - } - if (ix>=0x3ff0000000000000LL) { /* |x|>=1 */ - t = __expm1l(two*fabsl(x)); - z = one - two/(t+two); - } else { - t = __expm1l(-two*fabsl(x)); - z= -t/(t+two); - } - /* |x| > 40, return +-1 */ - } else { - z = one - tiny; /* raised inexact flag */ - } - return (jx>=0)? z: -z; -} -long_double_symbol (libm, __tanhl, tanhl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_tanl.c b/sysdeps/ieee754/ldbl-128ibm/s_tanl.c deleted file mode 100644 index 66b8a0621e..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_tanl.c +++ /dev/null @@ -1,79 +0,0 @@ -/* s_tanl.c -- long double version of s_tan.c. - * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz. - */ - -/* @(#)s_tan.c 5.1 93/09/24 */ -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -/* tanl(x) - * Return tangent function of x. - * - * kernel function: - * __kernel_tanl ... tangent function on [-pi/4,pi/4] - * __ieee754_rem_pio2l ... argument reduction routine - * - * Method. - * Let S,C and T denote the sin, cos and tan respectively on - * [-PI/4, +PI/4]. Reduce the argument x to y1+y2 = x-k*pi/2 - * in [-pi/4 , +pi/4], and let n = k mod 4. - * We have - * - * n sin(x) cos(x) tan(x) - * ---------------------------------------------------------- - * 0 S C T - * 1 C -S -1/T - * 2 -S -C T - * 3 -C S -1/T - * ---------------------------------------------------------- - * - * Special cases: - * Let trig be any of sin, cos, or tan. - * trig(+-INF) is NaN, with signals; - * trig(NaN) is that NaN; - * - * Accuracy: - * TRIG(x) returns trig(x) nearly rounded - */ - -#include <errno.h> -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -long double __tanl(long double x) -{ - long double y[2],z=0.0L; - int64_t n, ix; - double xhi; - - /* High word of x. */ - xhi = ldbl_high (x); - EXTRACT_WORDS64 (ix, xhi); - - /* |x| ~< pi/4 */ - ix &= 0x7fffffffffffffffLL; - if(ix <= 0x3fe921fb54442d10LL) return __kernel_tanl(x,z,1); - - /* tanl(Inf or NaN) is NaN */ - else if (ix>=0x7ff0000000000000LL) { - if (ix == 0x7ff0000000000000LL) - __set_errno (EDOM); - return x-x; /* NaN */ - } - /* argument reduction needed */ - else { - n = __ieee754_rem_pio2l(x,y); - return __kernel_tanl(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even - -1 -- n odd */ - } -} -long_double_symbol (libm, __tanl, tanl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c b/sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c deleted file mode 100644 index 963376a7cf..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_totalorderl.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Total order operation. ldbl-128ibm version. - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_private.h> -#include <nan-high-order-bit.h> -#include <stdint.h> - -int -totalorderl (long double x, long double y) -{ - double xhi, xlo, yhi, ylo; - int64_t hx, hy, lx, ly; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - ldbl_unpack (y, &yhi, &ylo); - EXTRACT_WORDS64 (hy, yhi); -#if HIGH_ORDER_BIT_IS_SET_FOR_SNAN -# error not implemented -#endif - uint64_t hx_sign = hx >> 63; - uint64_t hy_sign = hy >> 63; - int64_t hx_adj = hx ^ (hx_sign >> 1); - int64_t hy_adj = hy ^ (hy_sign >> 1); - if (hx_adj < hy_adj) - return 1; - else if (hx_adj > hy_adj) - return 0; - - /* The high doubles are identical. If they are NaNs or both the low - parts are zero, the low parts are not significant (and if they - are infinities, both the low parts must be zero). */ - if ((hx & 0x7fffffffffffffffULL) >= 0x7ff0000000000000ULL) - return 1; - EXTRACT_WORDS64 (lx, xlo); - EXTRACT_WORDS64 (ly, ylo); - if (((lx | ly) & 0x7fffffffffffffffULL) == 0) - return 1; - - /* Otherwise compare the low parts. */ - uint64_t lx_sign = lx >> 63; - uint64_t ly_sign = ly >> 63; - lx ^= lx_sign >> 1; - ly ^= ly_sign >> 1; - return lx <= ly; -} diff --git a/sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c b/sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c deleted file mode 100644 index f7480909df..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_totalordermagl.c +++ /dev/null @@ -1,64 +0,0 @@ -/* Total order operation on absolute values. ldbl-128ibm version. - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_private.h> -#include <nan-high-order-bit.h> -#include <stdint.h> - -int -totalordermagl (long double x, long double y) -{ - double xhi, xlo, yhi, ylo; - int64_t hx, hy, lx, ly; - - ldbl_unpack (x, &xhi, &xlo); - EXTRACT_WORDS64 (hx, xhi); - ldbl_unpack (y, &yhi, &ylo); - EXTRACT_WORDS64 (hy, yhi); -#if HIGH_ORDER_BIT_IS_SET_FOR_SNAN -# error not implemented -#endif - uint64_t x_sign = hx & 0x8000000000000000ULL; - uint64_t y_sign = hy & 0x8000000000000000ULL; - hx ^= x_sign; - hy ^= y_sign; - if (hx < hy) - return 1; - else if (hx > hy) - return 0; - - /* The high doubles are identical. If they are NaNs or both the low - parts are zero, the low parts are not significant (and if they - are infinities, both the low parts must be zero). */ - if (hx >= 0x7ff0000000000000ULL) - return 1; - EXTRACT_WORDS64 (lx, xlo); - EXTRACT_WORDS64 (ly, ylo); - if (((lx | ly) & 0x7fffffffffffffffULL) == 0) - return 1; - lx ^= x_sign; - ly ^= y_sign; - - /* Otherwise compare the low parts. */ - uint64_t lx_sign = lx >> 63; - uint64_t ly_sign = ly >> 63; - lx ^= lx_sign >> 1; - ly ^= ly_sign >> 1; - return lx <= ly; -} diff --git a/sysdeps/ieee754/ldbl-128ibm/s_truncl.c b/sysdeps/ieee754/ldbl-128ibm/s_truncl.c deleted file mode 100644 index ecabf9d711..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_truncl.c +++ /dev/null @@ -1,62 +0,0 @@ -/* Truncate (toward zero) long double floating-point values. - IBM extended format long double version. - Copyright (C) 2006-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_ldbl_opt.h> -#include <float.h> -#include <ieee754.h> - - -long double -__truncl (long double x) -{ - double xh, xl, hi, lo; - - ldbl_unpack (x, &xh, &xl); - - /* Return Inf, Nan, +/-0 unchanged. */ - if (__builtin_expect (xh != 0.0 - && __builtin_isless (__builtin_fabs (xh), - __builtin_inf ()), 1)) - { - hi = __trunc (xh); - if (hi != xh) - { - /* The high part is not an integer; the low part does not - affect the result. */ - xh = hi; - xl = 0; - } - else - { - /* The high part is a nonzero integer. */ - lo = xh > 0 ? __floor (xl) : __ceil (xl); - xh = hi; - xl = lo; - ldbl_canonicalize_int (&xh, &xl); - } - } - else - /* Quiet signaling NaN arguments. */ - xh += xh; - - return ldbl_pack (xh, xl); -} - -long_double_symbol (libm, __truncl, truncl); diff --git a/sysdeps/ieee754/ldbl-128ibm/s_ufromfpl.c b/sysdeps/ieee754/ldbl-128ibm/s_ufromfpl.c deleted file mode 100644 index c686daa4a7..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_ufromfpl.c +++ /dev/null @@ -1,4 +0,0 @@ -#define UNSIGNED 1 -#define INEXACT 0 -#define FUNC ufromfpl -#include <s_fromfpl_main.c> diff --git a/sysdeps/ieee754/ldbl-128ibm/s_ufromfpxl.c b/sysdeps/ieee754/ldbl-128ibm/s_ufromfpxl.c deleted file mode 100644 index 906066c83c..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/s_ufromfpxl.c +++ /dev/null @@ -1,4 +0,0 @@ -#define UNSIGNED 1 -#define INEXACT 1 -#define FUNC ufromfpxl -#include <s_fromfpl_main.c> diff --git a/sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h b/sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h deleted file mode 100644 index 198fe48f5c..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/strtod_nan_ldouble.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Convert string for NaN payload to corresponding NaN. For ldbl-128ibm. - Copyright (C) 1997-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#define FLOAT long double -#define SET_MANTISSA(flt, mant) \ - do \ - { \ - union ibm_extended_long_double u; \ - u.ld = (flt); \ - u.d[0].ieee_nan.mantissa0 = (mant) >> 32; \ - u.d[0].ieee_nan.mantissa1 = (mant); \ - if ((u.d[0].ieee.mantissa0 | u.d[0].ieee.mantissa1) != 0) \ - (flt) = u.ld; \ - } \ - while (0) diff --git a/sysdeps/ieee754/ldbl-128ibm/strtold_l.c b/sysdeps/ieee754/ldbl-128ibm/strtold_l.c deleted file mode 100644 index 37034cb254..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/strtold_l.c +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (C) 1999-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <stdlib.h> -#include <wchar.h> -#include <xlocale.h> - -/* The actual implementation for all floating point sizes is in strtod.c. - These macros tell it to produce the `long double' version, `strtold'. */ - -#define FLOAT long double -#define FLT LDBL -#ifdef USE_WIDE_CHAR -extern long double ____new_wcstold_l (const wchar_t *, wchar_t **, __locale_t); -# define STRTOF __new_wcstold_l -# define __STRTOF ____new_wcstold_l -# define ____STRTOF_INTERNAL ____wcstold_l_internal -# define STRTOF_NAN __wcstold_nan -#else -extern long double ____new_strtold_l (const char *, char **, __locale_t); -# define STRTOF __new_strtold_l -# define __STRTOF ____new_strtold_l -# define ____STRTOF_INTERNAL ____strtold_l_internal -# define STRTOF_NAN __strtold_nan -#endif -extern __typeof (__STRTOF) STRTOF; -libc_hidden_proto (__STRTOF) -libc_hidden_proto (STRTOF) -#define MPN2FLOAT __mpn_construct_long_double -#define FLOAT_HUGE_VAL HUGE_VALL - -#include <strtod_l.c> - -#ifdef __LONG_DOUBLE_MATH_OPTIONAL -# include <math_ldbl_opt.h> -# ifdef USE_WIDE_CHAR -weak_alias (____new_wcstold_l, ___new_wcstold_l); -long_double_symbol (libc, ___new_wcstold_l, wcstold_l); -long_double_symbol (libc, ____new_wcstold_l, __wcstold_l); -# else -weak_alias (____new_strtold_l, ___new_strtold_l); -long_double_symbol (libc, ___new_strtold_l, strtold_l); -long_double_symbol (libc, ____new_strtold_l, __strtold_l); -# endif -#endif diff --git a/sysdeps/ieee754/ldbl-128ibm/t_sincosl.c b/sysdeps/ieee754/ldbl-128ibm/t_sincosl.c deleted file mode 100644 index 22c59150be..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/t_sincosl.c +++ /dev/null @@ -1,693 +0,0 @@ -/* Quad-precision floating point sine and cosine tables. - Copyright (C) 1999-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek <jj@ultra.linux.cz> - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -/* For 0.1484375 + n/128.0, n=0..82 this table contains - first 113 bits of cosine, then at least 113 additional - bits and the same for sine. - 0.1484375+82.0/128.0 is the smallest number among above defined numbers - larger than pi/4. - Computed using gmp. - */ - -const long double __sincosl_table[] = { - -/* x = 1.48437500000000000000000000000000000e-01L 3ffc3000000000000000000000000000 */ -/* cos(x) = 0.fd2f5320e1b790209b4dda2f98 f79caaa7b873aff1014b0fbc52 43766d03cb006bc837c4358 */ - 0x0.fd2f5320e1b790209b4dda2f98p0L, - 0x0.f79caaa7b873aff1014b0fbc52p-104L, -/* sin(x) = 0.25dc50bc95711d0d9787d108fd 438cf5959ee0bfb7a1e36e8b1a 112968f356657420e9cc9ea */ - 0x0.25dc50bc95711d0d9787d108fdp0L, - 0x0.438cf5959ee0bfb7a1e36e8b1ap-104L, - -/* x = 1.56250000000000000000000000000000000e-01 3ffc4000000000000000000000000000 */ -/* cos(x) = 0.fce1a053e621438b6d60c76e8c 45bf0a9dc71aa16f922acc10e9 5144ec796a249813c9cb649 */ - 0x0.fce1a053e621438b6d60c76e8cp0L, - 0x0.45bf0a9dc71aa16f922acc10e9p-104L, -/* sin(x) = 0.27d66258bacd96a3eb335b365c 87d59438c5142bb56a489e9b8d b9d36234ffdebb6bdc22d8e */ - 0x0.27d66258bacd96a3eb335b365cp0L, - 0x0.87d59438c5142bb56a489e9b8dp-104L, - -/* x = 1.64062500000000000000000000000000000e-01 3ffc5000000000000000000000000000 */ -/* cos(x) = 0.fc8ffa01ba6807417e05962b0d 9fdf1fddb0cc4c07d22e19e080 19bffa50a6c7acdb40307a3 */ - 0x0.fc8ffa01ba6807417e05962b0dp0L, - 0x0.9fdf1fddb0cc4c07d22e19e080p-104L, -/* sin(x) = 0.29cfd49b8be4f665276cab01cb f0426934906c3dd105473b226e 410b1450f62e53ff7c6cce1 */ - 0x0.29cfd49b8be4f665276cab01cbp0L, - 0x0.f0426934906c3dd105473b226ep-104L, - -/* x = 1.71875000000000000000000000000000000e-01 3ffc6000000000000000000000000000 */ -/* cos(x) = 0.fc3a6170f767ac735d63d99a9d 439e1db5e59d3ef153a4265d58 55850ed82b536bf361b80e3 */ - 0x0.fc3a6170f767ac735d63d99a9dp0L, - 0x0.439e1db5e59d3ef153a4265d58p-104L, -/* sin(x) = 0.2bc89f9f424de5485de7ce03b2 514952b9faf5648c3244d4736f eb95dbb9da49f3b58a9253b */ - 0x0.2bc89f9f424de5485de7ce03b2p0L, - 0x0.514952b9faf5648c3244d4736fp-104L, - -/* x = 1.79687500000000000000000000000000000e-01 3ffc7000000000000000000000000000 */ -/* cos(x) = 0.fbe0d7f7fef11e70aa43b8abf4 f6a457cea20c8f3f676b47781f 9821bbe9ce04b3c7b981c0b */ - 0x0.fbe0d7f7fef11e70aa43b8abf4p0L, - 0x0.f6a457cea20c8f3f676b47781fp-104L, -/* sin(x) = 0.2dc0bb80b49a97ffb34e8dd1f8 db9df7af47ed2dcf58b12c8e78 27e048cae929da02c04ecac */ - 0x0.2dc0bb80b49a97ffb34e8dd1f8p0L, - 0x0.db9df7af47ed2dcf58b12c8e78p-104L, - -/* x = 1.87500000000000000000000000000000000e-01 3ffc8000000000000000000000000000 */ -/* cos(x) = 0.fb835efcf670dd2ce6fe792469 7eea13ea358867e9cdb3899b78 3f4f9f43aa5626e8b67b3bc */ - 0x0.fb835efcf670dd2ce6fe792469p0L, - 0x0.7eea13ea358867e9cdb3899b78p-104L, -/* sin(x) = 0.2fb8205f75e56a2b56a1c4792f 856258769af396e0189ef72c05 e4df59a6b00e4b44a6ea515 */ - 0x0.2fb8205f75e56a2b56a1c4792fp0L, - 0x0.856258769af396e0189ef72c05p-104L, - -/* x = 1.95312500000000000000000000000000000e-01 3ffc9000000000000000000000000000 */ -/* cos(x) = 0.fb21f7f5c156696b00ac1fe28a c5fd76674a92b4df80d9c8a46c 684399005deccc41386257c */ - 0x0.fb21f7f5c156696b00ac1fe28ap0L, - 0x0.c5fd76674a92b4df80d9c8a46cp-104L, -/* sin(x) = 0.31aec65df552876f82ece9a235 6713246eba6799983d7011b0b3 698d6e1da919c15d57c30c1 */ - 0x0.31aec65df552876f82ece9a235p0L, - 0x0.6713246eba6799983d7011b0b3p-104L, - -/* x = 2.03125000000000000000000000000000000e-01 3ffca000000000000000000000000000 */ -/* cos(x) = 0.fabca467fb3cb8f1d069f01d8e a33ade5bfd68296ecd1cc9f7b7 609bbcf3676e726c3301334 */ - 0x0.fabca467fb3cb8f1d069f01d8ep0L, - 0x0.a33ade5bfd68296ecd1cc9f7b7p-104L, -/* sin(x) = 0.33a4a5a19d86246710f602c44d f4fa513f4639ce938477aeeabb 82e8e0a7ed583a188879fd4 */ - 0x0.33a4a5a19d86246710f602c44dp0L, - 0x0.f4fa513f4639ce938477aeeabbp-104L, - -/* x = 2.10937500000000000000000000000000000e-01 3ffcb000000000000000000000000000 */ -/* cos(x) = 0.fa5365e8f1d3ca27be1db5d76a e64d983d7470a4ab0f4ccf65a2 b8c67a380df949953a09bc1 */ - 0x0.fa5365e8f1d3ca27be1db5d76ap0L, - 0x0.e64d983d7470a4ab0f4ccf65a2p-104L, -/* sin(x) = 0.3599b652f40ec999df12a0a4c8 561de159c98d4e54555de518b9 7f48886f715d8df5f4f093e */ - 0x0.3599b652f40ec999df12a0a4c8p0L, - 0x0.561de159c98d4e54555de518b9p-104L, - -/* x = 2.18750000000000000000000000000000000e-01 3ffcc000000000000000000000000000 */ -/* cos(x) = 0.f9e63e1d9e8b6f6f2e296bae5b 5ed9c11fd7fa2fe11e09fc7bde 901abed24b6365e72f7db4e */ - 0x0.f9e63e1d9e8b6f6f2e296bae5bp0L, - 0x0.5ed9c11fd7fa2fe11e09fc7bdep-104L, -/* sin(x) = 0.378df09db8c332ce0d2b53d865 582e4526ea336c768f68c32b49 6c6d11c1cd241bb9f1da523 */ - 0x0.378df09db8c332ce0d2b53d865p0L, - 0x0.582e4526ea336c768f68c32b49p-104L, - -/* x = 2.26562500000000000000000000000000000e-01 3ffcd000000000000000000000000000 */ -/* cos(x) = 0.f9752eba9fff6b98842beadab0 54a932fb0f8d5b875ae63d6b22 88d09b148921aeb6e52f61b */ - 0x0.f9752eba9fff6b98842beadab0p0L, - 0x0.54a932fb0f8d5b875ae63d6b22p-104L, -/* sin(x) = 0.39814cb10513453cb97b21bc1c a6a337b150c21a675ab85503bc 09a436a10ab1473934e20c8 */ - 0x0.39814cb10513453cb97b21bc1cp0L, - 0x0.a6a337b150c21a675ab85503bcp-104L, - -/* x = 2.34375000000000000000000000000000000e-01 3ffce000000000000000000000000000 */ -/* cos(x) = 0.f90039843324f9b940416c1984 b6cbed1fc733d97354d4265788 a86150493ce657cae032674 */ - 0x0.f90039843324f9b940416c1984p0L, - 0x0.b6cbed1fc733d97354d4265788p-104L, -/* sin(x) = 0.3b73c2bf6b4b9f668ef9499c81 f0d965087f1753fa64b086e58c b8470515c18c1412f8c2e02 */ - 0x0.3b73c2bf6b4b9f668ef9499c81p0L, - 0x0.f0d965087f1753fa64b086e58cp-104L, - -/* x = 2.42187500000000000000000000000000000e-01 3ffcf000000000000000000000000000 */ -/* cos(x) = 0.f887604e2c39dbb20e4ec58250 59a789ffc95b275ad9954078ba 8a28d3fcfe9cc2c1d49697b */ - 0x0.f887604e2c39dbb20e4ec58250p0L, - 0x0.59a789ffc95b275ad9954078bap-104L, -/* sin(x) = 0.3d654aff15cb457a0fca854698 aba33039a8a40626609204472d 9d40309b626eccc6dff0ffa */ - 0x0.3d654aff15cb457a0fca854698p0L, - 0x0.aba33039a8a40626609204472dp-104L, - -/* x = 2.50000000000000000000000000000000000e-01 3ffd0000000000000000000000000000 */ -/* cos(x) = 0.f80aa4fbef750ba783d33cb95f 94f8a41426dbe79edc4a023ef9 ec13c944551c0795b84fee1 */ - 0x0.f80aa4fbef750ba783d33cb95fp0L, - 0x0.94f8a41426dbe79edc4a023ef9p-104L, -/* sin(x) = 0.3f55dda9e62aed7513bd7b8e6a 3d1635dd5676648d7db525898d 7086af9330f03c7f285442a */ - 0x0.3f55dda9e62aed7513bd7b8e6ap0L, - 0x0.3d1635dd5676648d7db525898dp-104L, - -/* x = 2.57812500000000000000000000000000000e-01 3ffd0800000000000000000000000000 */ -/* cos(x) = 0.f78a098069792daabc9ee42591 b7c5a68cb1ab822aeb446b3311 b4ba5371b8970e2c1547ad7 */ - 0x0.f78a098069792daabc9ee42591p0L, - 0x0.b7c5a68cb1ab822aeb446b3311p-104L, -/* sin(x) = 0.414572fd94556e6473d6202713 88dd47c0ba050cdb5270112e3e 370e8c4705ae006426fb5d5 */ - 0x0.414572fd94556e6473d6202713p0L, - 0x0.88dd47c0ba050cdb5270112e3ep-104L, - -/* x = 2.65625000000000000000000000000000000e-01 3ffd1000000000000000000000000000 */ -/* cos(x) = 0.f7058fde0788dfc805b8fe8878 9e4f4253e3c50afe8b22f41159 620ab5940ff7df9557c0d1f */ - 0x0.f7058fde0788dfc805b8fe8878p0L, - 0x0.9e4f4253e3c50afe8b22f41159p-104L, -/* sin(x) = 0.4334033bcd90d6604f5f36c1d4 b84451a87150438275b77470b5 0e5b968fa7962b5ffb379b7 */ - 0x0.4334033bcd90d6604f5f36c1d4p0L, - 0x0.b84451a87150438275b77470b5p-104L, - -/* x = 2.73437500000000000000000000000000000e-01 3ffd1800000000000000000000000000 */ -/* cos(x) = 0.f67d3a26af7d07aa4bd6d42af8 c0067fefb96d5b46c031eff536 27f215ea3242edc3f2e13eb */ - 0x0.f67d3a26af7d07aa4bd6d42af8p0L, - 0x0.c0067fefb96d5b46c031eff536p-104L, -/* sin(x) = 0.452186aa5377ab20bbf2524f52 e3a06a969f47166ab88cf88c11 1ad12c55941021ef3317a1a */ - 0x0.452186aa5377ab20bbf2524f52p0L, - 0x0.e3a06a969f47166ab88cf88c11p-104L, - -/* x = 2.81250000000000000000000000000000000e-01 3ffd2000000000000000000000000000 */ -/* cos(x) = 0.f5f10a7bb77d3dfa0c1da8b578 42783280d01ce3c0f82bae3b9d 623c168d2e7c29977994451 */ - 0x0.f5f10a7bb77d3dfa0c1da8b578p0L, - 0x0.42783280d01ce3c0f82bae3b9dp-104L, -/* sin(x) = 0.470df5931ae1d946076fe0dcff 47fe31bb2ede618ebc607821f8 462b639e1f4298b5ae87fd3 */ - 0x0.470df5931ae1d946076fe0dcffp0L, - 0x0.47fe31bb2ede618ebc607821f8p-104L, - -/* x = 2.89062500000000000000000000000000000e-01 3ffd2800000000000000000000000000 */ -/* cos(x) = 0.f561030ddd7a78960ea9f4a32c 6521554995667f5547bafee9ec 48b3155cdb0f7fd00509713 */ - 0x0.f561030ddd7a78960ea9f4a32cp0L, - 0x0.6521554995667f5547bafee9ecp-104L, -/* sin(x) = 0.48f948446abcd6b0f7fccb100e 7a1b26eccad880b0d24b59948c 7cdd49514d44b933e6985c2 */ - 0x0.48f948446abcd6b0f7fccb100ep0L, - 0x0.7a1b26eccad880b0d24b59948cp-104L, - -/* x = 2.96875000000000000000000000000000000e-01 3ffd3000000000000000000000000000 */ -/* cos(x) = 0.f4cd261d3e6c15bb369c875863 0d2ac00b7ace2a51c0631bfeb3 9ed158ba924cc91e259c195 */ - 0x0.f4cd261d3e6c15bb369c875863p0L, - 0x0.0d2ac00b7ace2a51c0631bfeb3p-104L, -/* sin(x) = 0.4ae37710fad27c8aa9c4cf96c0 3519b9ce07dc08a1471775499f 05c29f86190aaebaeb9716e */ - 0x0.4ae37710fad27c8aa9c4cf96c0p0L, - 0x0.3519b9ce07dc08a1471775499fp-104L, - -/* x = 3.04687500000000000000000000000000000e-01 3ffd3800000000000000000000000000 */ -/* cos(x) = 0.f43575f94d4f6b272f5fb76b14 d2a64ab52df1ee8ddf7c651034 e5b2889305a9ea9015d758a */ - 0x0.f43575f94d4f6b272f5fb76b14p0L, - 0x0.d2a64ab52df1ee8ddf7c651034p-104L, -/* sin(x) = 0.4ccc7a50127e1de0cb6b40c302 c651f7bded4f9e7702b0471ae0 288d091a37391950907202f */ - 0x0.4ccc7a50127e1de0cb6b40c302p0L, - 0x0.c651f7bded4f9e7702b0471ae0p-104L, - -/* x = 3.12500000000000000000000000000000000e-01 3ffd4000000000000000000000000000 */ -/* cos(x) = 0.f399f500c9e9fd37ae9957263d ab8877102beb569f101ee44953 50868e5847d181d50d3cca2 */ - 0x0.f399f500c9e9fd37ae9957263dp0L, - 0x0.ab8877102beb569f101ee44953p-104L, -/* sin(x) = 0.4eb44a5da74f600207aaa090f0 734e288603ffadb3eb2542a469 77b105f8547128036dcf7f0 */ - 0x0.4eb44a5da74f600207aaa090f0p0L, - 0x0.734e288603ffadb3eb2542a469p-104L, - -/* x = 3.20312500000000000000000000000000000e-01 3ffd4800000000000000000000000000 */ -/* cos(x) = 0.f2faa5a1b74e82fd61fa05f917 7380e8e69b7b15a945e8e5ae11 24bf3d12b0617e03af4fab5 */ - 0x0.f2faa5a1b74e82fd61fa05f917p0L, - 0x0.7380e8e69b7b15a945e8e5ae11p-104L, -/* sin(x) = 0.509adf9a7b9a5a0f638a8fa3a6 0a199418859f18b37169a644fd b986c21ecb00133853bc35b */ - 0x0.509adf9a7b9a5a0f638a8fa3a6p0L, - 0x0.0a199418859f18b37169a644fdp-104L, - -/* x = 3.28125000000000000000000000000000000e-01 3ffd5000000000000000000000000000 */ -/* cos(x) = 0.f2578a595224dd2e6bfa2eb2f9 9cc674f5ea6f479eae2eb58018 6897ae3f893df1113ca06b8 */ - 0x0.f2578a595224dd2e6bfa2eb2f9p0L, - 0x0.9cc674f5ea6f479eae2eb58018p-104L, -/* sin(x) = 0.5280326c3cf481823ba6bb08ea c82c2093f2bce3c4eb4ee3dec7 df41c92c8a4226098616075 */ - 0x0.5280326c3cf481823ba6bb08eap0L, - 0x0.c82c2093f2bce3c4eb4ee3dec7p-104L, - -/* x = 3.35937500000000000000000000000000000e-01 3ffd5800000000000000000000000000 */ -/* cos(x) = 0.f1b0a5b406b526d886c55feadc 8d0dcc8eb9ae2ac707051771b4 8e05b25b000009660bdb3e3 */ - 0x0.f1b0a5b406b526d886c55feadcp0L, - 0x0.8d0dcc8eb9ae2ac707051771b4p-104L, -/* sin(x) = 0.54643b3da29de9b357155eef0f 332fb3e66c83bf4dddd9491c5e b8e103ccd92d6175220ed51 */ - 0x0.54643b3da29de9b357155eef0fp0L, - 0x0.332fb3e66c83bf4dddd9491c5ep-104L, - -/* x = 3.43750000000000000000000000000000000e-01 3ffd6000000000000000000000000000 */ -/* cos(x) = 0.f105fa4d66b607a67d44e04272 5204435142ac8ad54dfb0907a4 f6b56b06d98ee60f19e557a */ - 0x0.f105fa4d66b607a67d44e04272p0L, - 0x0.5204435142ac8ad54dfb0907a4p-104L, -/* sin(x) = 0.5646f27e8bd65cbe3a5d61ff06 572290ee826d9674a00246b05a e26753cdfc90d9ce81a7d02 */ - 0x0.5646f27e8bd65cbe3a5d61ff06p0L, - 0x0.572290ee826d9674a00246b05ap-104L, - -/* x = 3.51562500000000000000000000000000000e-01 3ffd6800000000000000000000000000 */ -/* cos(x) = 0.f0578ad01ede707fa39c09dc6b 984afef74f3dc8d0efb0f4c5a6 b13771145b3e0446fe33887 */ - 0x0.f0578ad01ede707fa39c09dc6bp0L, - 0x0.984afef74f3dc8d0efb0f4c5a6p-104L, -/* sin(x) = 0.582850a41e1dd46c7f602ea244 cdbbbfcdfa8f3189be794dda42 7ce090b5f85164f1f80ac13 */ - 0x0.582850a41e1dd46c7f602ea244p0L, - 0x0.cdbbbfcdfa8f3189be794dda42p-104L, - -/* x = 3.59375000000000000000000000000000000e-01 3ffd7000000000000000000000000000 */ -/* cos(x) = 0.efa559f5ec3aec3a4eb0331927 8a2d41fcf9189462261125fe61 47b078f1daa0b06750a1654 */ - 0x0.efa559f5ec3aec3a4eb0331927p0L, - 0x0.8a2d41fcf9189462261125fe61p-104L, -/* sin(x) = 0.5a084e28e35fda2776dfdbbb55 31d74ced2b5d17c0b1afc46475 29d50c295e36d8ceec126c1 */ - 0x0.5a084e28e35fda2776dfdbbb55p0L, - 0x0.31d74ced2b5d17c0b1afc46475p-104L, - -/* x = 3.67187500000000000000000000000000000e-01 3ffd7800000000000000000000000000 */ -/* cos(x) = 0.eeef6a879146af0bf9b95ea2ea 0ac0d3e2e4d7e15d93f48cbd41 bf8e4fded40bef69e19eafa */ - 0x0.eeef6a879146af0bf9b95ea2eap0L, - 0x0.0ac0d3e2e4d7e15d93f48cbd41p-104L, -/* sin(x) = 0.5be6e38ce8095542bc14ee9da0 d36483e6734bcab2e07624188a f5653f114eeb46738fa899d */ - 0x0.5be6e38ce8095542bc14ee9da0p0L, - 0x0.d36483e6734bcab2e07624188ap-104L, - -/* x = 3.75000000000000000000000000000000000e-01 3ffd8000000000000000000000000000 */ -/* cos(x) = 0.ee35bf5ccac89052cd91ddb734 d3a47e262e3b609db604e21705 3803be0091e76daf28a89b7 */ - 0x0.ee35bf5ccac89052cd91ddb734p0L, - 0x0.d3a47e262e3b609db604e21705p-104L, -/* sin(x) = 0.5dc40955d9084f48a94675a249 8de5d851320ff5528a6afb3f2e 24de240fce6cbed1ba0ccd6 */ - 0x0.5dc40955d9084f48a94675a249p0L, - 0x0.8de5d851320ff5528a6afb3f2ep-104L, - -/* x = 3.82812500000000000000000000000000000e-01 3ffd8800000000000000000000000000 */ -/* cos(x) = 0.ed785b5c44741b4493c56bcb9d 338a151c6f6b85d8f8aca658b2 8572c162b199680eb9304da */ - 0x0.ed785b5c44741b4493c56bcb9dp0L, - 0x0.338a151c6f6b85d8f8aca658b2p-104L, -/* sin(x) = 0.5f9fb80f21b53649c432540a50 e22c53057ff42ae0fdf1307760 dc0093f99c8efeb2fbd7073 */ - 0x0.5f9fb80f21b53649c432540a50p0L, - 0x0.e22c53057ff42ae0fdf1307760p-104L, - -/* x = 3.90625000000000000000000000000000000e-01 3ffd9000000000000000000000000000 */ -/* cos(x) = 0.ecb7417b8d4ee3fec37aba4073 aa48f1f14666006fb431d96713 03c8100d10190ec8179c41d */ - 0x0.ecb7417b8d4ee3fec37aba4073p0L, - 0x0.aa48f1f14666006fb431d96713p-104L, -/* sin(x) = 0.6179e84a09a5258a40e9b5face 03e525f8b5753cd0105d93fe62 98010c3458e84d75fe420e9 */ - 0x0.6179e84a09a5258a40e9b5facep0L, - 0x0.03e525f8b5753cd0105d93fe62p-104L, - -/* x = 3.98437500000000000000000000000000000e-01 3ffd9800000000000000000000000000 */ -/* cos(x) = 0.ebf274bf0bda4f62447e56a093 626798d3013b5942b1abfd155a acc9dc5c6d0806a20d6b9c1 */ - 0x0.ebf274bf0bda4f62447e56a093p0L, - 0x0.626798d3013b5942b1abfd155ap-104L, -/* sin(x) = 0.6352929dd264bd44a02ea76632 5d8aa8bd9695fc8def3caefba5 b94c9a3c873f7b2d3776ead */ - 0x0.6352929dd264bd44a02ea76632p0L, - 0x0.5d8aa8bd9695fc8def3caefba5p-104L, - -/* x = 4.06250000000000000000000000000000000e-01 3ffda000000000000000000000000000 */ -/* cos(x) = 0.eb29f839f201fd13b937968279 16a78f15c85230a4e8ea4b2155 8265a14367e1abb4c30695a */ - 0x0.eb29f839f201fd13b937968279p0L, - 0x0.16a78f15c85230a4e8ea4b2155p-104L, -/* sin(x) = 0.6529afa7d51b129631ec197c0a 840a11d7dc5368b0a47956feb2 85caa8371c4637ef17ef01b */ - 0x0.6529afa7d51b129631ec197c0ap0L, - 0x0.840a11d7dc5368b0a47956feb2p-104L, - -/* x = 4.14062500000000000000000000000000000e-01 3ffda800000000000000000000000000 */ -/* cos(x) = 0.ea5dcf0e30cf03e6976ef0b1ec 26515fba47383855c3b4055a99 b5e86824b2cd1a691fdca7b */ - 0x0.ea5dcf0e30cf03e6976ef0b1ecp0L, - 0x0.26515fba47383855c3b4055a99p-104L, -/* sin(x) = 0.66ff380ba0144109e39a320b0a 3fa5fd65ea0585bcbf9b1a769a 9b0334576c658139e1a1cbe */ - 0x0.66ff380ba0144109e39a320b0ap0L, - 0x0.3fa5fd65ea0585bcbf9b1a769ap-104L, - -/* x = 4.21875000000000000000000000000000000e-01 3ffdb000000000000000000000000000 */ -/* cos(x) = 0.e98dfc6c6be031e60dd3089cbd d18a75b1f6b2c1e97f79225202 f03dbea45b07a5ec4efc062 */ - 0x0.e98dfc6c6be031e60dd3089cbdp0L, - 0x0.d18a75b1f6b2c1e97f79225202p-104L, -/* sin(x) = 0.68d32473143327973bc712bcc4 ccddc47630d755850c0655243b 205934dc49ffed8eb76adcb */ - 0x0.68d32473143327973bc712bcc4p0L, - 0x0.ccddc47630d755850c0655243bp-104L, - -/* x = 4.29687500000000000000000000000000000e-01 3ffdb800000000000000000000000000 */ -/* cos(x) = 0.e8ba8393eca7821aa563d83491 b6101189b3b101c3677f73d7ba d7c10f9ee02b7ab4009739a */ - 0x0.e8ba8393eca7821aa563d83491p0L, - 0x0.b6101189b3b101c3677f73d7bap-104L, -/* sin(x) = 0.6aa56d8e8249db4eb60a761fe3 f9e559be456b9e13349ca99b0b fb787f22b95db3b70179615 */ - 0x0.6aa56d8e8249db4eb60a761fe3p0L, - 0x0.f9e559be456b9e13349ca99b0bp-104L, - -/* x = 4.37500000000000000000000000000000000e-01 3ffdc000000000000000000000000000 */ -/* cos(x) = 0.e7e367d2956cfb16b6aa11e541 9cd0057f5c132a6455bf064297 e6a76fe2b72bb630d6d50ff */ - 0x0.e7e367d2956cfb16b6aa11e541p0L, - 0x0.9cd0057f5c132a6455bf064297p-104L, -/* sin(x) = 0.6c760c14c8585a51dbd34660ae 6c52ac7036a0b40887a0b63724 f8b4414348c3063a637f457 */ - 0x0.6c760c14c8585a51dbd34660aep0L, - 0x0.6c52ac7036a0b40887a0b63724p-104L, - -/* x = 4.45312500000000000000000000000000000e-01 3ffdc800000000000000000000000000 */ -/* cos(x) = 0.e708ac84d4172a3e2737662213 429e14021074d7e702e77d72a8 f1101a7e70410df8273e9aa */ - 0x0.e708ac84d4172a3e2737662213p0L, - 0x0.429e14021074d7e702e77d72a8p-104L, -/* sin(x) = 0.6e44f8c36eb10a1c752d093c00 f4d47ba446ac4c215d26b03164 42f168459e677d06e7249e3 */ - 0x0.6e44f8c36eb10a1c752d093c00p0L, - 0x0.f4d47ba446ac4c215d26b03164p-104L, - -/* x = 4.53125000000000000000000000000000000e-01 3ffdd000000000000000000000000000 */ -/* cos(x) = 0.e62a551594b970a770b15d41d4 c0e483e47aca550111df6966f9 e7ac3a94ae49e6a71eb031e */ - 0x0.e62a551594b970a770b15d41d4p0L, - 0x0.c0e483e47aca550111df6966f9p-104L, -/* sin(x) = 0.70122c5ec5028c8cff33abf4fd 340ccc382e038379b09cf04f9a 52692b10b72586060cbb001 */ - 0x0.70122c5ec5028c8cff33abf4fdp0L, - 0x0.340ccc382e038379b09cf04f9ap-104L, - -/* x = 4.60937500000000000000000000000000000e-01 3ffdd800000000000000000000000000 */ -/* cos(x) = 0.e54864fe33e8575cabf5bd0e5c f1b1a8bc7c0d5f61702450fa6b 6539735820dd2603ae355d5 */ - 0x0.e54864fe33e8575cabf5bd0e5cp0L, - 0x0.f1b1a8bc7c0d5f61702450fa6bp-104L, -/* sin(x) = 0.71dd9fb1ff4677853acb970a9f 6729c6e3aac247b1c57cea66c7 7413f1f98e8b9e98e49d851 */ - 0x0.71dd9fb1ff4677853acb970a9fp0L, - 0x0.6729c6e3aac247b1c57cea66c7p-104L, - -/* x = 4.68750000000000000000000000000000000e-01 3ffde000000000000000000000000000 */ -/* cos(x) = 0.e462dfc670d421ab3d1a159012 28f146a0547011202bf5ab01f9 14431859aef577966bc4fa4 */ - 0x0.e462dfc670d421ab3d1a159012p0L, - 0x0.28f146a0547011202bf5ab01f9p-104L, -/* sin(x) = 0.73a74b8f52947b681baf6928eb 3fb021769bf4779bad0e3aa9b1 cdb75ec60aad9fc63ff19d5 */ - 0x0.73a74b8f52947b681baf6928ebp0L, - 0x0.3fb021769bf4779bad0e3aa9b1p-104L, - -/* x = 4.76562500000000000000000000000000000e-01 3ffde800000000000000000000000000 */ -/* cos(x) = 0.e379c9045f29d517c4808aa497 c2057b2b3d109e76c0dc302d4d 0698b36e3f0bdbf33d8e952 */ - 0x0.e379c9045f29d517c4808aa497p0L, - 0x0.c2057b2b3d109e76c0dc302d4dp-104L, -/* sin(x) = 0.756f28d011d98528a44a75fc29 c779bd734ecdfb582fdb74b68a 4c4c4be54cfd0b2d3ad292f */ - 0x0.756f28d011d98528a44a75fc29p0L, - 0x0.c779bd734ecdfb582fdb74b68ap-104L, - -/* x = 4.84375000000000000000000000000000000e-01 3ffdf000000000000000000000000000 */ -/* cos(x) = 0.e28d245c58baef72225e232abc 003c4366acd9eb4fc2808c2ab7 fe7676cf512ac7f945ae5fb */ - 0x0.e28d245c58baef72225e232abcp0L, - 0x0.003c4366acd9eb4fc2808c2ab7p-104L, -/* sin(x) = 0.77353054ca72690d4c6e171fd9 9e6b39fa8e1ede5f052fd29645 34c75340970a3a9cd3c5c32 */ - 0x0.77353054ca72690d4c6e171fd9p0L, - 0x0.9e6b39fa8e1ede5f052fd29645p-104L, - -/* x = 4.92187500000000000000000000000000000e-01 3ffdf800000000000000000000000000 */ -/* cos(x) = 0.e19cf580eeec046aa1422fa748 07ecefb2a1911c94e7b5f20a00 f70022d940193691e5bd790 */ - 0x0.e19cf580eeec046aa1422fa748p0L, - 0x0.07ecefb2a1911c94e7b5f20a00p-104L, -/* sin(x) = 0.78f95b0560a9a3bd6df7bd981d c38c61224d08bc20631ea932e6 05e53b579e9e0767dfcbbcb */ - 0x0.78f95b0560a9a3bd6df7bd981dp0L, - 0x0.c38c61224d08bc20631ea932e6p-104L, - -/* x = 5.00000000000000000000000000000000000e-01 3ffe0000000000000000000000000000 */ -/* cos(x) = 0.e0a94032dbea7cedbddd9da2fa fad98556566b3a89f43eabd723 50af3e8b19e801204d8fe2e */ - 0x0.e0a94032dbea7cedbddd9da2fap0L, - 0x0.fad98556566b3a89f43eabd723p-104L, -/* sin(x) = 0.7abba1d12c17bfa1d92f0d93f6 0ded9992f45b4fcaf13cd58b30 3693d2a0db47db35ae8a3a9 */ - 0x0.7abba1d12c17bfa1d92f0d93f6p0L, - 0x0.0ded9992f45b4fcaf13cd58b30p-104L, - -/* x = 5.07812500000000000000000000000000000e-01 3ffe0400000000000000000000000000 */ -/* cos(x) = 0.dfb20840f3a9b36f7ae2c51534 2890b5ec583b8366cc2b55029e 95094d31112383f2553498b */ - 0x0.dfb20840f3a9b36f7ae2c51534p0L, - 0x0.2890b5ec583b8366cc2b55029ep-104L, -/* sin(x) = 0.7c7bfdaf13e5ed17212f8a7525 bfb113aba6c0741b5362bb8d59 282a850b63716bca0c910f0 */ - 0x0.7c7bfdaf13e5ed17212f8a7525p0L, - 0x0.bfb113aba6c0741b5362bb8d59p-104L, - -/* x = 5.15625000000000000000000000000000000e-01 3ffe0800000000000000000000000000 */ -/* cos(x) = 0.deb7518814a7a931bbcc88c109 cd41c50bf8bb48f20ae8c36628 d1d3d57574f7dc58f27d91c */ - 0x0.deb7518814a7a931bbcc88c109p0L, - 0x0.cd41c50bf8bb48f20ae8c36628p-104L, -/* sin(x) = 0.7e3a679daaf25c676542bcb402 8d0964172961c921823a4ef0c3 a9070d886dbd073f6283699 */ - 0x0.7e3a679daaf25c676542bcb402p0L, - 0x0.8d0964172961c921823a4ef0c3p-104L, - -/* x = 5.23437500000000000000000000000000000e-01 3ffe0c00000000000000000000000000 */ -/* cos(x) = 0.ddb91ff318799172bd2452d0a3 889f5169c64a0094bcf0b8aa7d cf0d7640a2eba68955a80be */ - 0x0.ddb91ff318799172bd2452d0a3p0L, - 0x0.889f5169c64a0094bcf0b8aa7dp-104L, -/* sin(x) = 0.7ff6d8a34bd5e8fa54c97482db 5159df1f24e8038419c0b448b9 eea8939b5d4dfcf40900257 */ - 0x0.7ff6d8a34bd5e8fa54c97482dbp0L, - 0x0.5159df1f24e8038419c0b448b9p-104L, - -/* x = 5.31250000000000000000000000000000000e-01 3ffe1000000000000000000000000000 */ -/* cos(x) = 0.dcb7777ac420705168f31e3eb7 80ce9c939ecada62843b54522f 5407eb7f21e556059fcd734 */ - 0x0.dcb7777ac420705168f31e3eb7p0L, - 0x0.80ce9c939ecada62843b54522fp-104L, -/* sin(x) = 0.81b149ce34caa5a4e650f8d09f d4d6aa74206c32ca951a93074c 83b2d294d25dbb0f7fdfad2 */ - 0x0.81b149ce34caa5a4e650f8d09fp0L, - 0x0.d4d6aa74206c32ca951a93074cp-104L, - -/* x = 5.39062500000000000000000000000000000e-01 3ffe1400000000000000000000000000 */ -/* cos(x) = 0.dbb25c25b8260c14f6e7bc98ec 991b70c65335198b0ab628bad2 0cc7b229d4dd62183cfa055 */ - 0x0.dbb25c25b8260c14f6e7bc98ecp0L, - 0x0.991b70c65335198b0ab628bad2p-104L, -/* sin(x) = 0.8369b434a372da7eb5c8a71fe3 6ce1e0b2b493f6f5cb2e38bcae c2a556b3678c401940d1c3c */ - 0x0.8369b434a372da7eb5c8a71fe3p0L, - 0x0.6ce1e0b2b493f6f5cb2e38bcaep-104L, - -/* x = 5.46875000000000000000000000000000000e-01 3ffe1800000000000000000000000000 */ -/* cos(x) = 0.daa9d20860827063fde51c09e8 55e9932e1b17143e7244fd267a 899d41ae1f3bc6a0ec42e27 */ - 0x0.daa9d20860827063fde51c09e8p0L, - 0x0.55e9932e1b17143e7244fd267ap-104L, -/* sin(x) = 0.852010f4f0800521378bd8dd61 4753d080c2e9e0775ffc609947 b9132f5357404f464f06a58 */ - 0x0.852010f4f0800521378bd8dd61p0L, - 0x0.4753d080c2e9e0775ffc609947p-104L, - -/* x = 5.54687500000000000000000000000000000e-01 3ffe1c00000000000000000000000000 */ -/* cos(x) = 0.d99ddd44e44a43d4d4a3a3ed95 204106fd54d78e8c7684545c0d a0b7c2c72be7a89b7c182ad */ - 0x0.d99ddd44e44a43d4d4a3a3ed95p0L, - 0x0.204106fd54d78e8c7684545c0dp-104L, -/* sin(x) = 0.86d45935ab396cb4e421e822de e54f3562dfcefeaa782184c234 01d231f5ad981a1cc195b18 */ - 0x0.86d45935ab396cb4e421e822dep0L, - 0x0.e54f3562dfcefeaa782184c234p-104L, - -/* x = 5.62500000000000000000000000000000000e-01 3ffe2000000000000000000000000000 */ -/* cos(x) = 0.d88e820b1526311dd561efbc0c 1a9a5375eb26f65d246c5744b1 3ca26a7e0fd42556da843c8 */ - 0x0.d88e820b1526311dd561efbc0cp0L, - 0x0.1a9a5375eb26f65d246c5744b1p-104L, -/* sin(x) = 0.88868625b4e1dbb23133101330 22527200c143a5cb16637cb7da f8ade82459ff2e98511f40f */ - 0x0.88868625b4e1dbb23133101330p0L, - 0x0.22527200c143a5cb16637cb7dap-104L, - -/* x = 5.70312500000000000000000000000000000e-01 3ffe2400000000000000000000000000 */ -/* cos(x) = 0.d77bc4985e93a607c9d868b906 bbc6bbe3a04258814acb035846 8b826fc91bd4d814827f65e */ - 0x0.d77bc4985e93a607c9d868b906p0L, - 0x0.bbc6bbe3a04258814acb035846p-104L, -/* sin(x) = 0.8a3690fc5bfc11bf9535e2739a 8512f448a41251514bbed7fc18 d530f9b4650fcbb2861b0aa */ - 0x0.8a3690fc5bfc11bf9535e2739ap0L, - 0x0.8512f448a41251514bbed7fc18p-104L, - -/* x = 5.78125000000000000000000000000000000e-01 3ffe2800000000000000000000000000 */ -/* cos(x) = 0.d665a937b4ef2b1f6d51bad6d9 88a4419c1d7051faf31a9efa15 1d7631117efac03713f950a */ - 0x0.d665a937b4ef2b1f6d51bad6d9p0L, - 0x0.88a4419c1d7051faf31a9efa15p-104L, -/* sin(x) = 0.8be472f9776d809af2b8817124 3d63d66dfceeeb739cc894e023 fbc165a0e3f26ff729c5d57 */ - 0x0.8be472f9776d809af2b8817124p0L, - 0x0.3d63d66dfceeeb739cc894e023p-104L, - -/* x = 5.85937500000000000000000000000000000e-01 3ffe2c00000000000000000000000000 */ -/* cos(x) = 0.d54c3441844897fc8f853f0655 f1ba695eba9fbfd7439dbb1171 d862d9d9146ca5136f825ac */ - 0x0.d54c3441844897fc8f853f0655p0L, - 0x0.f1ba695eba9fbfd7439dbb1171p-104L, -/* sin(x) = 0.8d902565817ee7839bce3cd128 060119492cd36d42d82ada30d7 f8bde91324808377ddbf5d4 */ - 0x0.8d902565817ee7839bce3cd128p0L, - 0x0.060119492cd36d42d82ada30d7p-104L, - -/* x = 5.93750000000000000000000000000000000e-01 3ffe3000000000000000000000000000 */ -/* cos(x) = 0.d42f6a1b9f0168cdf031c2f63c 8d9304d86f8d34cb1d5fccb68c a0f2241427fc18d1fd5bbdf */ - 0x0.d42f6a1b9f0168cdf031c2f63cp0L, - 0x0.8d9304d86f8d34cb1d5fccb68cp-104L, -/* sin(x) = 0.8f39a191b2ba6122a3fa4f41d5 a3ffd421417d46f19a22230a14 f7fcc8fce5c75b4b28b29d1 */ - 0x0.8f39a191b2ba6122a3fa4f41d5p0L, - 0x0.a3ffd421417d46f19a22230a14p-104L, - -/* x = 6.01562500000000000000000000000000000e-01 3ffe3400000000000000000000000000 */ -/* cos(x) = 0.d30f4f392c357ab0661c5fa8a7 d9b26627846fef214b1d19a223 79ff9eddba087cf410eb097 */ - 0x0.d30f4f392c357ab0661c5fa8a7p0L, - 0x0.d9b26627846fef214b1d19a223p-104L, -/* sin(x) = 0.90e0e0d81ca678796cc92c8ea8 c2815bc72ca78abe571bfa8576 aacc571e096a33237e0e830 */ - 0x0.90e0e0d81ca678796cc92c8ea8p0L, - 0x0.c2815bc72ca78abe571bfa8576p-104L, - -/* x = 6.09375000000000000000000000000000000e-01 3ffe3800000000000000000000000000 */ -/* cos(x) = 0.d1ebe81a95ee752e48a26bcd32 d6e922d7eb44b8ad2232f69307 95e84b56317269b9dd1dfa6 */ - 0x0.d1ebe81a95ee752e48a26bcd32p0L, - 0x0.d6e922d7eb44b8ad2232f69307p-104L, -/* sin(x) = 0.9285dc9bc45dd9ea3d02457bcc e59c4175aab6ff7929a8d28719 5525fdace200dba032874fb */ - 0x0.9285dc9bc45dd9ea3d02457bccp0L, - 0x0.e59c4175aab6ff7929a8d28719p-104L, - -/* x = 6.17187500000000000000000000000000000e-01 3ffe3c00000000000000000000000000 */ -/* cos(x) = 0.d0c5394d772228195e25736c03 574707de0af1ca344b13bd3914 bfe27518e9e426f5deff1e1 */ - 0x0.d0c5394d772228195e25736c03p0L, - 0x0.574707de0af1ca344b13bd3914p-104L, -/* sin(x) = 0.94288e48bd0335fc41c4cbd292 0497a8f5d1d8185c99fa0081f9 0c27e2a53ffdd208a0dbe69 */ - 0x0.94288e48bd0335fc41c4cbd292p0L, - 0x0.0497a8f5d1d8185c99fa0081f9p-104L, - -/* x = 6.25000000000000000000000000000000000e-01 3ffe4000000000000000000000000000 */ -/* cos(x) = 0.cf9b476c897c25c5bfe750dd3f 308eaf7bcc1ed00179a256870f 4200445043dcdb1974b5878 */ - 0x0.cf9b476c897c25c5bfe750dd3fp0L, - 0x0.308eaf7bcc1ed00179a256870fp-104L, -/* sin(x) = 0.95c8ef544210ec0b91c49bd2aa 09e8515fa61a156ebb10f5f8c2 32a6445b61ebf3c2ec268f9 */ - 0x0.95c8ef544210ec0b91c49bd2aap0L, - 0x0.09e8515fa61a156ebb10f5f8c2p-104L, - -/* x = 6.32812500000000000000000000000000000e-01 3ffe4400000000000000000000000000 */ -/* cos(x) = 0.ce6e171f92f2e27f32225327ec 440ddaefae248413efc0e58cee e1ae369aabe73f88c87ed1a */ - 0x0.ce6e171f92f2e27f32225327ecp0L, - 0x0.440ddaefae248413efc0e58ceep-104L, -/* sin(x) = 0.9766f93cd18413a6aafc1cfc6f c28abb6817bf94ce349901ae3f 48c3215d3eb60acc5f78903 */ - 0x0.9766f93cd18413a6aafc1cfc6fp0L, - 0x0.c28abb6817bf94ce349901ae3fp-104L, - -/* x = 6.40625000000000000000000000000000000e-01 3ffe4800000000000000000000000000 */ -/* cos(x) = 0.cd3dad1b5328a2e459f993f4f5 108819faccbc4eeba9604e81c7 adad51cc8a2561631a06826 */ - 0x0.cd3dad1b5328a2e459f993f4f5p0L, - 0x0.108819faccbc4eeba9604e81c7p-104L, -/* sin(x) = 0.9902a58a45e27bed68412b426b 675ed503f54d14c8172e0d373f 42cadf04daf67319a7f94be */ - 0x0.9902a58a45e27bed68412b426bp0L, - 0x0.675ed503f54d14c8172e0d373fp-104L, - -/* x = 6.48437500000000000000000000000000000e-01 3ffe4c00000000000000000000000000 */ -/* cos(x) = 0.cc0a0e21709883a3ff00911e11 a07ee3bd7ea2b04e081be99be0 264791170761ae64b8b744a */ - 0x0.cc0a0e21709883a3ff00911e11p0L, - 0x0.a07ee3bd7ea2b04e081be99be0p-104L, -/* sin(x) = 0.9a9bedcdf01b38d993f3d78207 81de292033ead73b89e28f3931 3dbe3a6e463f845b5fa8490 */ - 0x0.9a9bedcdf01b38d993f3d78207p0L, - 0x0.81de292033ead73b89e28f3931p-104L, - -/* x = 6.56250000000000000000000000000000000e-01 3ffe5000000000000000000000000000 */ -/* cos(x) = 0.cad33f00658fe5e8204bbc0f3a 66a0e6a773f87987a780b243d7 be83b3db1448ca0e0e62787 */ - 0x0.cad33f00658fe5e8204bbc0f3ap0L, - 0x0.66a0e6a773f87987a780b243d7p-104L, -/* sin(x) = 0.9c32cba2b14156ef05256c4f85 7991ca6a547cd7ceb1ac8a8e62 a282bd7b9183648a462bd04 */ - 0x0.9c32cba2b14156ef05256c4f85p0L, - 0x0.7991ca6a547cd7ceb1ac8a8e62p-104L, - -/* x = 6.64062500000000000000000000000000000e-01 3ffe5400000000000000000000000000 */ -/* cos(x) = 0.c99944936cf48c8911ff93fe64 b3ddb7981e414bdaf6aae12035 77de44878c62bc3bc9cf7b9 */ - 0x0.c99944936cf48c8911ff93fe64p0L, - 0x0.b3ddb7981e414bdaf6aae12035p-104L, -/* sin(x) = 0.9dc738ad14204e689ac582d0f8 5826590feece34886cfefe2e08 cf2bb8488d55424dc9d3525 */ - 0x0.9dc738ad14204e689ac582d0f8p0L, - 0x0.5826590feece34886cfefe2e08p-104L, - -/* x = 6.71875000000000000000000000000000000e-01 3ffe5800000000000000000000000000 */ -/* cos(x) = 0.c85c23c26ed7b6f014ef546c47 929682122876bfbf157de0aff3 c4247d820c746e32cd4174f */ - 0x0.c85c23c26ed7b6f014ef546c47p0L, - 0x0.929682122876bfbf157de0aff3p-104L, -/* sin(x) = 0.9f592e9b66a9cf906a3c7aa3c1 0199849040c45ec3f0a7475973 11038101780c5f266059dbf */ - 0x0.9f592e9b66a9cf906a3c7aa3c1p0L, - 0x0.0199849040c45ec3f0a7475973p-104L, - -/* x = 6.79687500000000000000000000000000000e-01 3ffe5c00000000000000000000000000 */ -/* cos(x) = 0.c71be181ecd6875ce2da5615a0 3cca207d9adcb9dfb0a1d6c40a 4f0056437f1a59ccddd06ee */ - 0x0.c71be181ecd6875ce2da5615a0p0L, - 0x0.3cca207d9adcb9dfb0a1d6c40ap-104L, -/* sin(x) = 0.a0e8a725d33c828c11fa50fd9e 9a15ffecfad43f3e534358076b 9b0f6865694842b1e8c67dc */ - 0x0.a0e8a725d33c828c11fa50fd9ep0L, - 0x0.9a15ffecfad43f3e534358076bp-104L, - -/* x = 6.87500000000000000000000000000000000e-01 3ffe6000000000000000000000000000 */ -/* cos(x) = 0.c5d882d2ee48030c7c07d28e98 1e34804f82ed4cf93655d23653 89b716de6ad44676a1cc5da */ - 0x0.c5d882d2ee48030c7c07d28e98p0L, - 0x0.1e34804f82ed4cf93655d23653p-104L, -/* sin(x) = 0.a2759c0e79c35582527c32b55f 5405c182c66160cb1d9eb7bb0b 7cdf4ad66f317bda4332914 */ - 0x0.a2759c0e79c35582527c32b55fp0L, - 0x0.5405c182c66160cb1d9eb7bb0bp-104L, - -/* x = 6.95312500000000000000000000000000000e-01 3ffe6400000000000000000000000000 */ -/* cos(x) = 0.c4920cc2ec38fb891b38827db0 8884fc66371ac4c2052ca8885b 981bbcfd3bb7b093ee31515 */ - 0x0.c4920cc2ec38fb891b38827db0p0L, - 0x0.8884fc66371ac4c2052ca8885bp-104L, -/* sin(x) = 0.a400072188acf49cd6b173825e 038346f105e1301afe642bcc36 4cea455e21e506e3e927ed8 */ - 0x0.a400072188acf49cd6b173825ep0L, - 0x0.038346f105e1301afe642bcc36p-104L, - -/* x = 7.03125000000000000000000000000000000e-01 3ffe6800000000000000000000000000 */ -/* cos(x) = 0.c348846bbd3631338ffe2bfe9d d1381a35b4e9c0c51b4c13fe37 6bad1bf5caacc4542be0aa9 */ - 0x0.c348846bbd3631338ffe2bfe9dp0L, - 0x0.d1381a35b4e9c0c51b4c13fe37p-104L, -/* sin(x) = 0.a587e23555bb08086d02b9c662 cdd29316c3e9bd08d93793634a 21b1810cce73bdb97a99b9e */ - 0x0.a587e23555bb08086d02b9c662p0L, - 0x0.cdd29316c3e9bd08d93793634ap-104L, - -/* x = 7.10937500000000000000000000000000000e-01 3ffe6c00000000000000000000000000 */ -/* cos(x) = 0.c1fbeef380e4ffdd5a613ec872 2f643ffe814ec2343e53adb549 627224fdc9f2a7b77d3d69f */ - 0x0.c1fbeef380e4ffdd5a613ec872p0L, - 0x0.2f643ffe814ec2343e53adb549p-104L, -/* sin(x) = 0.a70d272a76a8d4b6da0ec90712 bb748b96dabf88c3079246f3db 7eea6e58ead4ed0e2843303 */ - 0x0.a70d272a76a8d4b6da0ec90712p0L, - 0x0.bb748b96dabf88c3079246f3dbp-104L, - -/* x = 7.18750000000000000000000000000000000e-01 3ffe7000000000000000000000000000 */ -/* cos(x) = 0.c0ac518c8b6ae710ba37a3eeb9 0cb15aebcb8bed4356fb507a48 a6e97de9aa6d9660116b436 */ - 0x0.c0ac518c8b6ae710ba37a3eeb9p0L, - 0x0.0cb15aebcb8bed4356fb507a48p-104L, -/* sin(x) = 0.a88fcfebd9a8dd47e2f3c76ef9 e2439920f7e7fbe735f8bcc985 491ec6f12a2d4214f8cfa99 */ - 0x0.a88fcfebd9a8dd47e2f3c76ef9p0L, - 0x0.e2439920f7e7fbe735f8bcc985p-104L, - -/* x = 7.26562500000000000000000000000000000e-01 3ffe7400000000000000000000000000 */ -/* cos(x) = 0.bf59b17550a440687596929656 7cf3e3b4e483061877c02811c6 cae85fad5a6c3da58f49292 */ - 0x0.bf59b17550a440687596929656p0L, - 0x0.7cf3e3b4e483061877c02811c6p-104L, -/* sin(x) = 0.aa0fd66eddb921232c28520d39 11b8a03193b47f187f1471ac21 6fbcd5bb81029294d3a73f1 */ - 0x0.aa0fd66eddb921232c28520d39p0L, - 0x0.11b8a03193b47f187f1471ac21p-104L, - -/* x = 7.34375000000000000000000000000000000e-01 3ffe7800000000000000000000000000 */ -/* cos(x) = 0.be0413f84f2a771c614946a88c bf4da1d75a5560243de8f2283f efa0ea4a48468a52d51d8b3 */ - 0x0.be0413f84f2a771c614946a88cp0L, - 0x0.bf4da1d75a5560243de8f2283fp-104L, -/* sin(x) = 0.ab8d34b36acd987210ed343ec6 5d7e3adc2e7109fce43d55c8d5 7dfdf55b9e01d2cc1f1b9ec */ - 0x0.ab8d34b36acd987210ed343ec6p0L, - 0x0.5d7e3adc2e7109fce43d55c8d5p-104L, - -/* x = 7.42187500000000000000000000000000000e-01 3ffe7c00000000000000000000000000 */ -/* cos(x) = 0.bcab7e6bfb2a14a9b122c574a3 76bec98ab14808c64a4e731b34 047e217611013ac99c0f25d */ - 0x0.bcab7e6bfb2a14a9b122c574a3p0L, - 0x0.76bec98ab14808c64a4e731b34p-104L, -/* sin(x) = 0.ad07e4c409d08c4fa3a9057bb0 ac24b8636e74e76f51e09bd6b2 319707cbd9f5e254643897a */ - 0x0.ad07e4c409d08c4fa3a9057bb0p0L, - 0x0.ac24b8636e74e76f51e09bd6b2p-104L, - -/* x = 7.50000000000000000000000000000000000e-01 3ffe8000000000000000000000000000 */ -/* cos(x) = 0.bb4ff632a908f73ec151839cb9 d993b4e0bfb8f20e7e44e6e4ae e845e35575c3106dbe6fd06 */ - 0x0.bb4ff632a908f73ec151839cb9p0L, - 0x0.d993b4e0bfb8f20e7e44e6e4aep-104L, -/* sin(x) = 0.ae7fe0b5fc786b2d966e1d6af1 40a488476747c2646425fc7533 f532cd044cb10a971a49a6a */ - 0x0.ae7fe0b5fc786b2d966e1d6af1p0L, - 0x0.40a488476747c2646425fc7533p-104L, - -/* x = 7.57812500000000000000000000000000000e-01 3ffe8400000000000000000000000000 */ -/* cos(x) = 0.b9f180ba77dd0751628e135a95 08299012230f14becacdd14c3f 8862d122de5b56d55b53360 */ - 0x0.b9f180ba77dd0751628e135a95p0L, - 0x0.08299012230f14becacdd14c3fp-104L, -/* sin(x) = 0.aff522a954f2ba16d9defdc416 e33f5e9a5dfd5a6c228e0abc4d 521327ff6e2517a7b3851dd */ - 0x0.aff522a954f2ba16d9defdc416p0L, - 0x0.e33f5e9a5dfd5a6c228e0abc4dp-104L, - -/* x = 7.65625000000000000000000000000000000e-01 3ffe8800000000000000000000000000 */ -/* cos(x) = 0.b890237d3bb3c284b614a05390 16bfa1053730bbdf940fa895e1 85f8e58884d3dda15e63371 */ - 0x0.b890237d3bb3c284b614a05390p0L, - 0x0.16bfa1053730bbdf940fa895e1p-104L, -/* sin(x) = 0.b167a4c90d63c4244cf5493b7c c23bd3c3c1225e078baa0c53d6 d400b926281f537a1a260e6 */ - 0x0.b167a4c90d63c4244cf5493b7cp0L, - 0x0.c23bd3c3c1225e078baa0c53d6p-104L, - -/* x = 7.73437500000000000000000000000000000e-01 3ffe8c00000000000000000000000000 */ -/* cos(x) = 0.b72be40067aaf2c050dbdb7a14 c3d7d4f203f6b3f0224a4afe55 d6ec8e92b508fd5c5984b3b */ - 0x0.b72be40067aaf2c050dbdb7a14p0L, - 0x0.c3d7d4f203f6b3f0224a4afe55p-104L, -/* sin(x) = 0.b2d7614b1f3aaa24df2d6e20a7 7e1ca3e6d838c03e29c1bcb026 e6733324815fadc9eb89674 */ - 0x0.b2d7614b1f3aaa24df2d6e20a7p0L, - 0x0.7e1ca3e6d838c03e29c1bcb026p-104L, - -/* x = 7.81250000000000000000000000000000000e-01 3ffe9000000000000000000000000000 */ -/* cos(x) = 0.b5c4c7d4f7dae915ac786ccf4b 1a498d3e73b6e5e74fe7519d9c 53ee6d6b90e881bddfc33e1 */ - 0x0.b5c4c7d4f7dae915ac786ccf4bp0L, - 0x0.1a498d3e73b6e5e74fe7519d9cp-104L, -/* sin(x) = 0.b44452709a5975290591376543 4a59d111f0433eb2b133f7d103 207e2aeb4aae111ddc385b3 */ - 0x0.b44452709a5975290591376543p0L, - 0x0.4a59d111f0433eb2b133f7d103p-104L, - -/* x = 7.89062500000000000000000000000000000e-01 3ffe9400000000000000000000000000 */ -/* cos(x) = 0.b45ad4975b1294cadca4cf40ec 8f22a68cd14b175835239a37e6 3acb85e8e9505215df18140 */ - 0x0.b45ad4975b1294cadca4cf40ecp0L, - 0x0.8f22a68cd14b175835239a37e6p-104L, -/* sin(x) = 0.b5ae7285bc10cf515753847e8f 8b7a30e0a580d929d770103509 880680f7b8b0e8ad23b65d8 */ - 0x0.b5ae7285bc10cf515753847e8fp0L, - 0x0.8b7a30e0a580d929d770103509p-104L -}; diff --git a/sysdeps/ieee754/ldbl-128ibm/test-canonical-ldbl-128ibm.c b/sysdeps/ieee754/ldbl-128ibm/test-canonical-ldbl-128ibm.c deleted file mode 100644 index 75735db18e..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/test-canonical-ldbl-128ibm.c +++ /dev/null @@ -1,230 +0,0 @@ -/* Test iscanonical and canonicalizel for ldbl-128ibm. - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <float.h> -#include <math.h> -#include <math_ldbl.h> -#include <stdbool.h> -#include <stdio.h> - -struct test -{ - double hi, lo; - bool canonical; -}; - -static const struct test tests[] = - { - { __builtin_nan (""), 0.0, true }, - { __builtin_nan (""), DBL_MAX, true }, - { __builtin_nan (""), __builtin_inf (), true }, - { __builtin_nan (""), __builtin_nan (""), true }, - { __builtin_nan (""), __builtin_nans (""), true }, - { __builtin_nans (""), 0.0, true }, - { __builtin_nans (""), DBL_MAX, true }, - { __builtin_nans (""), __builtin_inf (), true }, - { __builtin_nans (""), __builtin_nan (""), true }, - { __builtin_nans (""), __builtin_nans (""), true }, - { __builtin_inf (), 0.0, true }, - { __builtin_inf (), -0.0, true }, - { -__builtin_inf (), 0.0, true }, - { -__builtin_inf (), -0.0, true }, - { __builtin_inf (), DBL_TRUE_MIN, false }, - { __builtin_inf (), -DBL_TRUE_MIN, false }, - { -__builtin_inf (), DBL_TRUE_MIN, false }, - { -__builtin_inf (), -DBL_TRUE_MIN, false }, - { __builtin_inf (), DBL_MIN, false }, - { __builtin_inf (), -DBL_MIN, false }, - { -__builtin_inf (), DBL_MIN, false }, - { -__builtin_inf (), -DBL_MIN, false }, - { __builtin_inf (), __builtin_inf (), false }, - { __builtin_inf (), -__builtin_inf (), false }, - { -__builtin_inf (), __builtin_inf (), false }, - { -__builtin_inf (), -__builtin_inf (), false }, - { __builtin_inf (), __builtin_nan (""), false }, - { __builtin_inf (), -__builtin_nan (""), false }, - { -__builtin_inf (), __builtin_nan (""), false }, - { -__builtin_inf (), -__builtin_nan (""), false }, - { 0.0, 0.0, true }, - { 0.0, -0.0, true }, - { -0.0, 0.0, true }, - { -0.0, -0.0, true }, - { 0.0, DBL_TRUE_MIN, false }, - { 0.0, -DBL_TRUE_MIN, false }, - { -0.0, DBL_TRUE_MIN, false }, - { -0.0, -DBL_TRUE_MIN, false }, - { 0.0, DBL_MAX, false }, - { 0.0, -DBL_MAX, false }, - { -0.0, DBL_MAX, false }, - { -0.0, -DBL_MAX, false }, - { 0.0, __builtin_inf (), false }, - { 0.0, -__builtin_inf (), false }, - { -0.0, __builtin_inf (), false }, - { -0.0, -__builtin_inf (), false }, - { 0.0, __builtin_nan (""), false }, - { 0.0, -__builtin_nan (""), false }, - { -0.0, __builtin_nan (""), false }, - { -0.0, -__builtin_nan (""), false }, - { 1.0, 0.0, true }, - { 1.0, -0.0, true }, - { -1.0, 0.0, true }, - { -1.0, -0.0, true }, - { 1.0, DBL_TRUE_MIN, true }, - { 1.0, -DBL_TRUE_MIN, true }, - { -1.0, DBL_TRUE_MIN, true }, - { -1.0, -DBL_TRUE_MIN, true }, - { 1.0, DBL_MAX, false }, - { 1.0, -DBL_MAX, false }, - { -1.0, DBL_MAX, false }, - { -1.0, -DBL_MAX, false }, - { 1.0, __builtin_inf (), false }, - { 1.0, -__builtin_inf (), false }, - { -1.0, __builtin_inf (), false }, - { -1.0, -__builtin_inf (), false }, - { 1.0, __builtin_nan (""), false }, - { 1.0, -__builtin_nan (""), false }, - { -1.0, __builtin_nan (""), false }, - { -1.0, -__builtin_nan (""), false }, - { 0x1p1023, 0x1.1p969, true }, - { 0x1p1023, -0x1.1p969, true }, - { -0x1p1023, 0x1.1p969, true }, - { -0x1p1023, -0x1.1p969, true }, - { 0x1p1023, 0x1.1p970, false }, - { 0x1p1023, -0x1.1p970, false }, - { -0x1p1023, 0x1.1p970, false }, - { -0x1p1023, -0x1.1p970, false }, - { 0x1p1023, 0x1p970, true }, - { 0x1p1023, -0x1p970, true }, - { -0x1p1023, 0x1p970, true }, - { -0x1p1023, -0x1p970, true }, - { 0x1.0000000000001p1023, 0x1p970, false }, - { 0x1.0000000000001p1023, -0x1p970, false }, - { -0x1.0000000000001p1023, 0x1p970, false }, - { -0x1.0000000000001p1023, -0x1p970, false }, - { 0x1p-969, 0x1.1p-1023, true }, - { 0x1p-969, -0x1.1p-1023, true }, - { -0x1p-969, 0x1.1p-1023, true }, - { -0x1p-969, -0x1.1p-1023, true }, - { 0x1p-969, 0x1.1p-1022, false }, - { 0x1p-969, -0x1.1p-1022, false }, - { -0x1p-969, 0x1.1p-1022, false }, - { -0x1p-969, -0x1.1p-1022, false }, - { 0x1p-969, 0x1p-1022, true }, - { 0x1p-969, -0x1p-1022, true }, - { -0x1p-969, 0x1p-1022, true }, - { -0x1p-969, -0x1p-1022, true }, - { 0x1.0000000000001p-969, 0x1p-1022, false }, - { 0x1.0000000000001p-969, -0x1p-1022, false }, - { -0x1.0000000000001p-969, 0x1p-1022, false }, - { -0x1.0000000000001p-969, -0x1p-1022, false }, - { 0x1p-970, 0x1.1p-1024, true }, - { 0x1p-970, -0x1.1p-1024, true }, - { -0x1p-970, 0x1.1p-1024, true }, - { -0x1p-970, -0x1.1p-1024, true }, - { 0x1p-970, 0x1.1p-1023, false }, - { 0x1p-970, -0x1.1p-1023, false }, - { -0x1p-970, 0x1.1p-1023, false }, - { -0x1p-970, -0x1.1p-1023, false }, - { 0x1p-970, 0x1p-1023, true }, - { 0x1p-970, -0x1p-1023, true }, - { -0x1p-970, 0x1p-1023, true }, - { -0x1p-970, -0x1p-1023, true }, - { 0x1.0000000000001p-970, 0x1p-1023, false }, - { 0x1.0000000000001p-970, -0x1p-1023, false }, - { -0x1.0000000000001p-970, 0x1p-1023, false }, - { -0x1.0000000000001p-970, -0x1p-1023, false }, - { 0x1p-1000, 0x1.1p-1054, true }, - { 0x1p-1000, -0x1.1p-1054, true }, - { -0x1p-1000, 0x1.1p-1054, true }, - { -0x1p-1000, -0x1.1p-1054, true }, - { 0x1p-1000, 0x1.1p-1053, false }, - { 0x1p-1000, -0x1.1p-1053, false }, - { -0x1p-1000, 0x1.1p-1053, false }, - { -0x1p-1000, -0x1.1p-1053, false }, - { 0x1p-1000, 0x1p-1053, true }, - { 0x1p-1000, -0x1p-1053, true }, - { -0x1p-1000, 0x1p-1053, true }, - { -0x1p-1000, -0x1p-1053, true }, - { 0x1.0000000000001p-1000, 0x1p-1053, false }, - { 0x1.0000000000001p-1000, -0x1p-1053, false }, - { -0x1.0000000000001p-1000, 0x1p-1053, false }, - { -0x1.0000000000001p-1000, -0x1p-1053, false }, - { 0x1p-1021, 0x1p-1074, true }, - { 0x1p-1021, -0x1p-1074, true }, - { -0x1p-1021, 0x1p-1074, true }, - { -0x1p-1021, -0x1p-1074, true }, - { 0x1.0000000000001p-1021, 0x1p-1074, false }, - { 0x1.0000000000001p-1021, -0x1p-1074, false }, - { -0x1.0000000000001p-1021, 0x1p-1074, false }, - { -0x1.0000000000001p-1021, -0x1p-1074, false }, - { 0x1p-1022, 0x1p-1074, false }, - { 0x1p-1022, -0x1p-1074, false }, - { -0x1p-1022, 0x1p-1074, false }, - { -0x1p-1022, -0x1p-1074, false }, - }; - -static int -do_test (void) -{ - int result = 0; - - for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) - { - long double ld = ldbl_pack (tests[i].hi, tests[i].lo); - bool canonical = iscanonical (ld); - if (canonical == tests[i].canonical) - { - printf ("PASS: iscanonical test %zu\n", i); - long double ldc = 12345.0L; - bool canonicalize_ret = canonicalizel (&ldc, &ld); - if (canonicalize_ret == !canonical) - { - printf ("PASS: canonicalizel test %zu\n", i); - bool canon_ok; - if (!canonical) - canon_ok = ldc == 12345.0L; - else if (isnan (ld)) - canon_ok = isnan (ldc) && !issignaling (ldc); - else - canon_ok = ldc == ld; - if (canon_ok) - printf ("PASS: canonicalized value test %zu\n", i); - else - { - printf ("FAIL: canonicalized value test %zu\n", i); - result = 1; - } - } - else - { - printf ("FAIL: canonicalizel test %zu\n", i); - result = 1; - } - } - else - { - printf ("FAIL: iscanonical test %zu\n", i); - result = 1; - } - } - - return result; -} - -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" diff --git a/sysdeps/ieee754/ldbl-128ibm/test-fmodl-ldbl-128ibm.c b/sysdeps/ieee754/ldbl-128ibm/test-fmodl-ldbl-128ibm.c deleted file mode 100644 index c9bfcfc5a8..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/test-fmodl-ldbl-128ibm.c +++ /dev/null @@ -1,21 +0,0 @@ -/* Test for ldbl-128ibm fmodl handling of equal values (bug 19602). - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#define FUNC fmodl -#define SETUP -#include "test-fmodrem-ldbl-128ibm.c" diff --git a/sysdeps/ieee754/ldbl-128ibm/test-fmodrem-ldbl-128ibm.c b/sysdeps/ieee754/ldbl-128ibm/test-fmodrem-ldbl-128ibm.c deleted file mode 100644 index a7cc042a15..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/test-fmodrem-ldbl-128ibm.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Test for ldbl-128ibm fmodl etc. handling of equal values. - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <fenv.h> -#include <float.h> -#include <math.h> -#include <stdio.h> - -/* FUNC is defined to be the name of the function to test. */ -#define STRX(x) #x -#define STR(x) STRX (x) -#define SFUNC STR (FUNC) - -union u -{ - long double ld; - double d[2]; -}; - -volatile union u p1 = { .d = { DBL_MIN, 0.0 } }; -volatile union u p2 = { .d = { DBL_MIN, -0.0 } }; -volatile union u m1 = { .d = { -DBL_MIN, 0.0 } }; -volatile union u m2 = { .d = { -DBL_MIN, -0.0 } }; - -static int -test_func (const char *s, long double x, long double y, long double expected) -{ - volatile long double r; - r = FUNC (x, y); - if (r != expected || copysignl (1.0, r) != copysignl (1.0, expected)) - { - printf ("FAIL: " SFUNC " (%s)\n", s); - return 1; - } - else - { - printf ("PASS: " SFUNC " (%s)\n", s); - return 0; - } -} - -#define TEST_FUNC(a, b, e) test_func (#a ", " #b, a, b, e) - -static int -do_test (void) -{ - int result = 0; - SETUP; - result |= TEST_FUNC (p1.ld, p1.ld, 0.0L); - result |= TEST_FUNC (p1.ld, p2.ld, 0.0L); - result |= TEST_FUNC (p1.ld, m1.ld, 0.0L); - result |= TEST_FUNC (p1.ld, m2.ld, 0.0L); - result |= TEST_FUNC (p2.ld, p1.ld, 0.0L); - result |= TEST_FUNC (p2.ld, p2.ld, 0.0L); - result |= TEST_FUNC (p2.ld, m1.ld, 0.0L); - result |= TEST_FUNC (p2.ld, m2.ld, 0.0L); - result |= TEST_FUNC (m1.ld, p1.ld, -0.0L); - result |= TEST_FUNC (m1.ld, p2.ld, -0.0L); - result |= TEST_FUNC (m1.ld, m1.ld, -0.0L); - result |= TEST_FUNC (m1.ld, m2.ld, -0.0L); - result |= TEST_FUNC (m2.ld, p1.ld, -0.0L); - result |= TEST_FUNC (m2.ld, p2.ld, -0.0L); - result |= TEST_FUNC (m2.ld, m1.ld, -0.0L); - result |= TEST_FUNC (m2.ld, m2.ld, -0.0L); - return result; -} - -#define TEST_FUNCTION do_test () -#include "../../../test-skeleton.c" diff --git a/sysdeps/ieee754/ldbl-128ibm/test-remainderl-ldbl-128ibm.c b/sysdeps/ieee754/ldbl-128ibm/test-remainderl-ldbl-128ibm.c deleted file mode 100644 index 32b18be741..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/test-remainderl-ldbl-128ibm.c +++ /dev/null @@ -1,21 +0,0 @@ -/* Test for ldbl-128ibm remainderl handling of equal values (bug 19677). - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#define FUNC remainderl -#define SETUP fesetround (FE_DOWNWARD) -#include "test-fmodrem-ldbl-128ibm.c" diff --git a/sysdeps/ieee754/ldbl-128ibm/test-remquol-ldbl-128ibm.c b/sysdeps/ieee754/ldbl-128ibm/test-remquol-ldbl-128ibm.c deleted file mode 100644 index f0d48420b8..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/test-remquol-ldbl-128ibm.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Test for ldbl-128ibm remquol handling of equal values (bug 19677). - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> - -static long double -wrap_remquol (long double x, long double y) -{ - int quo; - return remquol (x, y, &quo); -} - -#define FUNC wrap_remquol -#define SETUP fesetround (FE_DOWNWARD) -#include "test-fmodrem-ldbl-128ibm.c" diff --git a/sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c b/sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c deleted file mode 100644 index eaada2f848..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/test-totalorderl-ldbl-128ibm.c +++ /dev/null @@ -1,73 +0,0 @@ -/* Test totalorderl and totalordermagl for ldbl-128ibm. - Copyright (C) 2016-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_ldbl.h> -#include <stdbool.h> -#include <stdio.h> - -struct test -{ - double hi, lo1, lo2; -}; - -static const struct test tests[] = - { - { __builtin_nan (""), 1, __builtin_nans ("") }, - { -__builtin_nan (""), 1, __builtin_nans ("") }, - { __builtin_nans (""), 1, __builtin_nan ("") }, - { -__builtin_nans (""), 1, __builtin_nan ("") }, - { __builtin_inf (), 0.0, -0.0 }, - { -__builtin_inf (), 0.0, -0.0 }, - { 1.5, 0.0, -0.0 }, - }; - -static int -do_test (void) -{ - int result = 0; - - for (size_t i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) - { - long double ldx = ldbl_pack (tests[i].hi, tests[i].lo1); - long double ldy = ldbl_pack (tests[i].hi, tests[i].lo2); - bool to1 = totalorderl (ldx, ldy); - bool to2 = totalorderl (ldy, ldx); - if (to1 && to2) - printf ("PASS: test %zu\n", i); - else - { - printf ("FAIL: test %zu\n", i); - result = 1; - } - to1 = totalordermagl (ldx, ldy); - to2 = totalordermagl (ldy, ldx); - if (to1 && to2) - printf ("PASS: test %zu (totalordermagl)\n", i); - else - { - printf ("FAIL: test %zu (totalordermagl)\n", i); - result = 1; - } - } - - return result; -} - -#define TEST_FUNCTION do_test () -#include "../test-skeleton.c" diff --git a/sysdeps/ieee754/ldbl-128ibm/tst-strtold-ldbl-128ibm.c b/sysdeps/ieee754/ldbl-128ibm/tst-strtold-ldbl-128ibm.c deleted file mode 100644 index 1181892165..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/tst-strtold-ldbl-128ibm.c +++ /dev/null @@ -1,85 +0,0 @@ -/* Test for ldbl-128ibm strtold overflow to infinity (bug 14551). - Copyright (C) 2015-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <errno.h> -#include <fenv.h> -#include <math.h> -#include <stdio.h> -#include <stdlib.h> - -static int -test_strtold_value (const char *s, double exp_hi, double exp_lo, int exp_exc, - int exp_errno) -{ - int result = 0; - union { long double ld; double d[2]; } x; - feclearexcept (FE_ALL_EXCEPT); - errno = 0; - x.ld = strtold (s, NULL); - int exc = fetestexcept (FE_ALL_EXCEPT); - int new_errno = errno; - printf ("strtold (\"%s\") returned (%a, %a), exceptions 0x%x, errno %d\n", - s, x.d[0], x.d[1], exc, new_errno); - if (x.d[0] == exp_hi) - printf ("PASS: strtold (\"%s\") high == %a\n", s, exp_hi); - else - { - printf ("FAIL: strtold (\"%s\") high == %a\n", s, exp_hi); - result = 1; - } - if (x.d[1] == exp_lo) - printf ("PASS: strtold (\"%s\") low == %a\n", s, exp_lo); - else - { - printf ("FAIL: strtold (\"%s\") low == %a\n", s, exp_lo); - result = 1; - } - if (exc == exp_exc) - printf ("PASS: strtold (\"%s\") exceptions 0x%x\n", s, exp_exc); - else - { - printf ("FAIL: strtold (\"%s\") exceptions 0x%x\n", s, exp_exc); - result = 1; - } - if (new_errno == exp_errno) - printf ("PASS: strtold (\"%s\") errno %d\n", s, exp_errno); - else - { - printf ("FAIL: strtold (\"%s\") errno %d\n", s, exp_errno); - result = 1; - } - return result; -} - -static int -do_test (void) -{ - int result = 0; - result |= test_strtold_value ("0x1.fffffffffffff8p+1023", INFINITY, 0, - FE_OVERFLOW | FE_INEXACT, ERANGE); - result |= test_strtold_value ("-0x1.fffffffffffff8p+1023", -INFINITY, 0, - FE_OVERFLOW | FE_INEXACT, ERANGE); - result |= test_strtold_value ("0x1.ffffffffffffffp+1023", INFINITY, 0, - FE_OVERFLOW | FE_INEXACT, ERANGE); - result |= test_strtold_value ("-0x1.ffffffffffffffp+1023", -INFINITY, 0, - FE_OVERFLOW | FE_INEXACT, ERANGE); - return result; -} - -#define TEST_FUNCTION do_test () -#include "../../../test-skeleton.c" diff --git a/sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c b/sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c deleted file mode 100644 index c9d44b61dd..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/w_expl_compat.c +++ /dev/null @@ -1,21 +0,0 @@ -#include <math.h> -#include <math_private.h> -#include <math_ldbl_opt.h> - -long double __expl(long double x) /* wrapper exp */ -{ - long double z; - z = __ieee754_expl(x); - if (_LIB_VERSION == _IEEE_) - return z; - if (isfinite(x)) - { - if (!isfinite (z)) - return __kernel_standard_l(x,x,206); /* exp overflow */ - else if (z == 0.0L) - return __kernel_standard_l(x,x,207); /* exp underflow */ - } - return z; -} -hidden_def (__expl) -long_double_symbol (libm, __expl, expl); diff --git a/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c b/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c deleted file mode 100644 index 0bdb9a1848..0000000000 --- a/sysdeps/ieee754/ldbl-128ibm/x2y2m1l.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Compute x^2 + y^2 - 1, without large cancellation error. - Copyright (C) 2012-2017 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#include <math.h> -#include <math_private.h> -#include <mul_split.h> -#include <stdlib.h> - -/* Calculate X + Y exactly and store the result in *HI + *LO. It is - given that |X| >= |Y| and the values are small enough that no - overflow occurs. */ - -static inline void -add_split (double *hi, double *lo, double x, double y) -{ - /* Apply Dekker's algorithm. */ - *hi = x + y; - *lo = (x - *hi) + y; -} - -/* Compare absolute values of floating-point values pointed to by P - and Q for qsort. */ - -static int -compare (const void *p, const void *q) -{ - double pd = fabs (*(const double *) p); - double qd = fabs (*(const double *) q); - if (pd < qd) - return -1; - else if (pd == qd) - return 0; - else - return 1; -} - -/* Return X^2 + Y^2 - 1, computed without large cancellation error. - It is given that 1 > X >= Y >= epsilon / 2, and that X^2 + Y^2 >= - 0.5. */ - -long double -__x2y2m1l (long double x, long double y) -{ - double vals[13]; - SET_RESTORE_ROUND (FE_TONEAREST); - union ibm_extended_long_double xu, yu; - xu.ld = x; - yu.ld = y; - if (fabs (xu.d[1].d) < 0x1p-500) - xu.d[1].d = 0.0; - if (fabs (yu.d[1].d) < 0x1p-500) - yu.d[1].d = 0.0; - mul_split (&vals[1], &vals[0], xu.d[0].d, xu.d[0].d); - mul_split (&vals[3], &vals[2], xu.d[0].d, xu.d[1].d); - vals[2] *= 2.0; - vals[3] *= 2.0; - mul_split (&vals[5], &vals[4], xu.d[1].d, xu.d[1].d); - mul_split (&vals[7], &vals[6], yu.d[0].d, yu.d[0].d); - mul_split (&vals[9], &vals[8], yu.d[0].d, yu.d[1].d); - vals[8] *= 2.0; - vals[9] *= 2.0; - mul_split (&vals[11], &vals[10], yu.d[1].d, yu.d[1].d); - vals[12] = -1.0; - qsort (vals, 13, sizeof (double), compare); - /* Add up the values so that each element of VALS has absolute value - at most equal to the last set bit of the next nonzero - element. */ - for (size_t i = 0; i <= 11; i++) - { - add_split (&vals[i + 1], &vals[i], vals[i + 1], vals[i]); - qsort (vals + i + 1, 12 - i, sizeof (double), compare); - } - /* Now any error from this addition will be small. */ - long double retval = (long double) vals[12]; - for (size_t i = 11; i != (size_t) -1; i--) - retval += (long double) vals[i]; - return retval; -} |