From 93ba969498beac428a07f0199b3ef3bc32869df7 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Tue, 17 Jul 2012 20:05:18 +0200 Subject: [PATCH] eglibc: add upstream patches Signed-off-by: Stephan Raue --- ...c-2.16-19673-Fix_bug-getcontext_test.patch | 56 + .../patches/eglibc-2.16-19673-GNU14154.patch | 136 ++ .../patches/eglibc-2.16-19673-GNU14157.patch | 355 ++++++ .../patches/eglibc-2.16-19673-GNU14173.patch | 46 + .../patches/eglibc-2.16-19673-GNU14283.patch | 148 +++ .../patches/eglibc-2.16-19673-GNU14307.patch | 97 ++ .../patches/eglibc-2.16-19673-GNU14328.patch | 1116 +++++++++++++++++ .../patches/eglibc-2.16-19673-GNU6778.patch | 357 ++++++ ...-2.16-19673-fix_rpc_bootstrap_builds.patch | 41 + .../eglibc-2.16-19673-libgcc_eh_arm.patch | 27 + 10 files changed, 2379 insertions(+) create mode 100644 packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-Fix_bug-getcontext_test.patch create mode 100644 packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14154.patch create mode 100644 packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14157.patch create mode 100644 packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14173.patch create mode 100644 packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14283.patch create mode 100644 packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14307.patch create mode 100644 packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14328.patch create mode 100644 packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU6778.patch create mode 100644 packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-fix_rpc_bootstrap_builds.patch create mode 100644 packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-libgcc_eh_arm.patch diff --git a/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-Fix_bug-getcontext_test.patch b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-Fix_bug-getcontext_test.patch new file mode 100644 index 0000000000..ec8628ded1 --- /dev/null +++ b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-Fix_bug-getcontext_test.patch @@ -0,0 +1,56 @@ +From d0cd7d02120a1700a9b9f2b5601c35142f1be44b Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Mon, 16 Jul 2012 16:51:13 +0200 +Subject: [PATCH] Fix bug-getcontext test + +--- + ChangeLog | 5 +++++ + stdlib/bug-getcontext.c | 25 ++++++++++++++++++++----- + 2 files changed, 25 insertions(+), 5 deletions(-) + +diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c +index 7db49c8..133ee91 100644 +--- a/stdlib/bug-getcontext.c ++++ b/stdlib/bug-getcontext.c +@@ -9,10 +9,25 @@ + static int + do_test (void) + { +-#if FE_ALL_EXCEPT == 0 +- printf("Skipping test; no support for FP exceptions.\n"); +-#else +- int except_mask = FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW; ++ if (FE_ALL_EXCEPT == 0) ++ { ++ printf("Skipping test; no support for FP exceptions.\n"); ++ return 0; ++ } ++ ++ int except_mask = 0; ++#ifdef FE_DIVBYZERO ++ except_mask |= FE_DIVBYZERO; ++#endif ++#ifdef FE_INVALID ++ except_mask |= FE_INVALID; ++#endif ++#ifdef FE_OVERFLOW ++ except_mask |= FE_OVERFLOW; ++#endif ++#ifdef FE_UNDERFLOW ++ except_mask |= FE_UNDERFLOW; ++#endif + int status = feenableexcept (except_mask); + + except_mask = fegetexcept (); +@@ -44,7 +59,7 @@ do_test (void) + + printf("\nAt end fegetexcept() returned %d, expected: %d.\n", + mask, except_mask); +-#endif ++ + return 0; + } + +-- +1.7.3.4 + diff --git a/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14154.patch b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14154.patch new file mode 100644 index 0000000000..bbc6c17988 --- /dev/null +++ b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14154.patch @@ -0,0 +1,136 @@ +From 9ad63c23eabdec1b625b1217b6635f34268ca342 Mon Sep 17 00:00:00 2001 +From: Joseph Myers +Date: Fri, 6 Jul 2012 21:19:38 +0000 +Subject: [PATCH] Fix tanf underflow close to pi/4 (bug 14154). + +--- + ChangeLog | 8 +++++++ + NEWS | 2 +- + math/libm-test.inc | 41 +++++++++++++++++++++++++++++++++++++- + sysdeps/i386/fpu/libm-test-ulps | 36 ++++++++++++++++++++++++++++++++++ + sysdeps/ieee754/flt-32/k_tanf.c | 2 + + 5 files changed, 86 insertions(+), 3 deletions(-) + +diff --git a/math/libm-test.inc b/math/libm-test.inc +index b87a40d..27c53a1 100644 +--- a/math/libm-test.inc ++++ b/math/libm-test.inc +@@ -8405,13 +8405,50 @@ tan_test (void) + TEST_f_f (tan, nan_value, nan_value); + check_int ("errno for tan(NaN) == 0", errno, 0, 0, 0, 0); + +- /* Bug 14154: spurious exception may occur. */ +- TEST_f_f (tan, M_PI_4l, 1, UNDERFLOW_EXCEPTION_OK_FLOAT); ++ TEST_f_f (tan, M_PI_4l, 1); + TEST_f_f (tan, 0.75L, 0.931596459944072461165202756573936428L); + + TEST_f_f (tan, 0x1p65, -0.0472364872359047946798414219288370688827L); + TEST_f_f (tan, -0x1p65, 0.0472364872359047946798414219288370688827L); + ++ TEST_f_f (tan, 0xc.9p-4, 0.9995162902115457818029468900654150261381L); ++ TEST_f_f (tan, 0xc.908p-4, 0.9997603425502441410973077452249560802034L); ++ TEST_f_f (tan, 0xc.90cp-4, 0.9998823910588060302788513970802357770031L); ++ TEST_f_f (tan, 0xc.90ep-4, 0.9999434208994808753305784795924711152508L); ++ TEST_f_f (tan, 0xc.90fp-4, 0.9999739372166156702433266059635165160515L); ++ TEST_f_f (tan, 0xc.90f8p-4, 0.9999891957244072765118898375645469865764L); ++ TEST_f_f (tan, 0xc.90fcp-4, 0.9999968250656122402859679132395522927393L); ++ TEST_f_f (tan, 0xc.90fdp-4, 0.9999987324100083358016192309006353329444L); ++ TEST_f_f (tan, 0xc.90fd8p-4, 0.9999996860835706212861509874451585282616L); ++ TEST_f_f (tan, 0xc.90fdap-4, 0.9999999245021033010474530133665235922808L); ++ TEST_f_f (tan, 0xc.ap-4, 1.0073556597407272165371804539701396631519L); ++ TEST_f_f (tan, 0xc.98p-4, 1.0034282930863044654045449407466962736255L); ++ TEST_f_f (tan, 0xc.94p-4, 1.0014703786820082237342656561856877993328L); ++ TEST_f_f (tan, 0xc.92p-4, 1.0004928571392300571266638743539017593717L); ++ TEST_f_f (tan, 0xc.91p-4, 1.0000044544650244953647966900221905361131L); ++ TEST_f_f (tan, 0xc.90fep-4, 1.0000006397580424009014454926842136804016L); ++ TEST_f_f (tan, 0xc.90fdcp-4, 1.0000001629206928242190327320047489394217L); ++ TEST_f_f (tan, 0xc.90fdbp-4, 1.0000000437113909572052640953950483705005L); ++ ++ TEST_f_f (tan, -0xc.9p-4, -0.9995162902115457818029468900654150261381L); ++ TEST_f_f (tan, -0xc.908p-4, -0.9997603425502441410973077452249560802034L); ++ TEST_f_f (tan, -0xc.90cp-4, -0.9998823910588060302788513970802357770031L); ++ TEST_f_f (tan, -0xc.90ep-4, -0.9999434208994808753305784795924711152508L); ++ TEST_f_f (tan, -0xc.90fp-4, -0.9999739372166156702433266059635165160515L); ++ TEST_f_f (tan, -0xc.90f8p-4, -0.9999891957244072765118898375645469865764L); ++ TEST_f_f (tan, -0xc.90fcp-4, -0.9999968250656122402859679132395522927393L); ++ TEST_f_f (tan, -0xc.90fdp-4, -0.9999987324100083358016192309006353329444L); ++ TEST_f_f (tan, -0xc.90fd8p-4, -0.9999996860835706212861509874451585282616L); ++ TEST_f_f (tan, -0xc.90fdap-4, -0.9999999245021033010474530133665235922808L); ++ TEST_f_f (tan, -0xc.ap-4, -1.0073556597407272165371804539701396631519L); ++ TEST_f_f (tan, -0xc.98p-4, -1.0034282930863044654045449407466962736255L); ++ TEST_f_f (tan, -0xc.94p-4, -1.0014703786820082237342656561856877993328L); ++ TEST_f_f (tan, -0xc.92p-4, -1.0004928571392300571266638743539017593717L); ++ TEST_f_f (tan, -0xc.91p-4, -1.0000044544650244953647966900221905361131L); ++ TEST_f_f (tan, -0xc.90fep-4, -1.0000006397580424009014454926842136804016L); ++ TEST_f_f (tan, -0xc.90fdcp-4, -1.0000001629206928242190327320047489394217L); ++ TEST_f_f (tan, -0xc.90fdbp-4, -1.0000000437113909572052640953950483705005L); ++ + #ifndef TEST_FLOAT + TEST_f_f (tan, 1e22, -1.628778225606898878549375936939548513545L); + TEST_f_f (tan, 0x1p1023, -0.6814476476066215012854144040167365190368L); +diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps +index ab02bde..9ea5ed6 100644 +--- a/sysdeps/i386/fpu/libm-test-ulps ++++ b/sysdeps/i386/fpu/libm-test-ulps +@@ -2353,9 +2353,45 @@ double: 1 + idouble: 1 + + # tan ++Test "tan (-0xc.90fdbp-4) == -1.0000000437113909572052640953950483705005": ++float: 1 ++ifloat: 1 ++Test "tan (-0xc.90fdcp-4) == -1.0000001629206928242190327320047489394217": ++float: 1 ++ifloat: 1 ++Test "tan (-0xc.90fep-4) == -1.0000006397580424009014454926842136804016": ++float: 1 ++ifloat: 1 ++Test "tan (-0xc.91p-4) == -1.0000044544650244953647966900221905361131": ++float: 1 ++ifloat: 1 ++Test "tan (-0xc.92p-4) == -1.0004928571392300571266638743539017593717": ++float: 1 ++ifloat: 1 ++Test "tan (-0xc.94p-4) == -1.0014703786820082237342656561856877993328": ++float: 1 ++ifloat: 1 + Test "tan (0x1p16383) == 0.422722393732022337800504160054440141575": + ildouble: 1 + ldouble: 1 ++Test "tan (0xc.90fdbp-4) == 1.0000000437113909572052640953950483705005": ++float: 1 ++ifloat: 1 ++Test "tan (0xc.90fdcp-4) == 1.0000001629206928242190327320047489394217": ++float: 1 ++ifloat: 1 ++Test "tan (0xc.90fep-4) == 1.0000006397580424009014454926842136804016": ++float: 1 ++ifloat: 1 ++Test "tan (0xc.91p-4) == 1.0000044544650244953647966900221905361131": ++float: 1 ++ifloat: 1 ++Test "tan (0xc.92p-4) == 1.0004928571392300571266638743539017593717": ++float: 1 ++ifloat: 1 ++Test "tan (0xc.94p-4) == 1.0014703786820082237342656561856877993328": ++float: 1 ++ifloat: 1 + Test "tan (1e22) == -1.628778225606898878549375936939548513545": + ildouble: 1 + ldouble: 1 +diff --git a/sysdeps/ieee754/flt-32/k_tanf.c b/sysdeps/ieee754/flt-32/k_tanf.c +index 9220606..be9a5d0 100644 +--- a/sysdeps/ieee754/flt-32/k_tanf.c ++++ b/sysdeps/ieee754/flt-32/k_tanf.c +@@ -56,6 +56,8 @@ float __kernel_tanf(float x, float y, int iy) + z = pio4-x; + w = pio4lo-y; + x = z+w; y = 0.0; ++ if (fabsf (x) < 0x1p-13f) ++ return (1 - ((hx >> 30) & 2)) * iy * (1.0f - 2 * iy * x); + } + z = x*x; + w = z*z; +-- +1.7.3.4 + diff --git a/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14157.patch b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14157.patch new file mode 100644 index 0000000000..67f3fc6da0 --- /dev/null +++ b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14157.patch @@ -0,0 +1,355 @@ +From cdfe2c5eb3703ed964cbfdb6906b21ace2956385 Mon Sep 17 00:00:00 2001 +From: Joseph Myers +Date: Thu, 5 Jul 2012 11:02:13 +0000 +Subject: [PATCH] Fix csqrt underflow (bugs 14157, 14331). + +--- + ChangeLog | 14 +++++++++++++ + NEWS | 2 +- + math/libm-test.inc | 39 ++++++++++++++++++++++++++++++++++-- + math/s_csqrt.c | 26 ++++++++++++++++++------ + math/s_csqrtf.c | 26 ++++++++++++++++++------ + math/s_csqrtl.c | 26 ++++++++++++++++++------ + sysdeps/i386/fpu/libm-test-ulps | 28 ++++++++++++++++++++++++++ + sysdeps/x86_64/fpu/libm-test-ulps | 30 ++++++++++++++++++++++++++++ + 8 files changed, 166 insertions(+), 25 deletions(-) + +diff --git a/math/libm-test.inc b/math/libm-test.inc +index 514ad06..6adbb61 100644 +--- a/math/libm-test.inc ++++ b/math/libm-test.inc +@@ -3213,18 +3213,51 @@ csqrt_test (void) + TEST_c_c (csqrt, 0x1p-149L, 0x1p-149L, 4.112805464342778798097003462770175200803e-23L, 1.703579802732953750368659735601389709551e-23L); + TEST_c_c (csqrt, 0x1p-147L, 0x1p-147L, 8.225610928685557596194006925540350401606e-23L, 3.407159605465907500737319471202779419102e-23L); + ++ TEST_c_c (csqrt, plus_zero, 0x1p-149L, 2.646977960169688559588507814623881131411e-23L, 2.646977960169688559588507814623881131411e-23L); ++ TEST_c_c (csqrt, 0x1p-50L, 0x1p-149L, 2.980232238769531250000000000000000000000e-8L, 2.350988701644575015937473074444491355637e-38L); ++#ifdef TEST_FLOAT ++ TEST_c_c (csqrt, 0x1p+127L, 0x1p-149L, 1.304381782533278221234957180625250836888e19L, plus_zero, UNDERFLOW_EXCEPTION); ++#endif ++ TEST_c_c (csqrt, 0x1p-149L, 0x1p+127L, 9.223372036854775808000000000000000000000e18L, 9.223372036854775808000000000000000000000e18L); ++ TEST_c_c (csqrt, 0x1.000002p-126L, 0x1.000002p-126L, 1.191195773697904627170323731331667740087e-19L, 4.934094449071842328766868579214125217132e-20L); ++ TEST_c_c (csqrt, -0x1.000002p-126L, -0x1.000002p-126L, 4.934094449071842328766868579214125217132e-20L, -1.191195773697904627170323731331667740087e-19L); ++ + #ifndef TEST_FLOAT + TEST_c_c (csqrt, 0x1.fffffffffffffp+1023L, 0x1.fffffffffffffp+1023L, 1.473094556905565378990473658199034571917e+154L, 6.101757441282702188537080005372547713595e+153L); + TEST_c_c (csqrt, 0x1.fffffffffffffp+1023L, 0x1p+1023L, 1.379778091031440685006200821918878702861e+154L, 3.257214233483129514781233066898042490248e+153L); +- /* Bug 14157: spurious exception may occur. */ +- TEST_c_c (csqrt, 0x1p-1074L, 0x1p-1074L, 2.442109726130830256743814843868934877597e-162L, 1.011554969366634726113090867589031782487e-162L, UNDERFLOW_EXCEPTION_OK); +- TEST_c_c (csqrt, 0x1p-1073L, 0x1p-1073L, 3.453664695497464982856905711457966660085e-162L, 1.430554756764195530630723976279903095110e-162L, UNDERFLOW_EXCEPTION_OK); ++ TEST_c_c (csqrt, 0x1p-1074L, 0x1p-1074L, 2.442109726130830256743814843868934877597e-162L, 1.011554969366634726113090867589031782487e-162L); ++ TEST_c_c (csqrt, 0x1p-1073L, 0x1p-1073L, 3.453664695497464982856905711457966660085e-162L, 1.430554756764195530630723976279903095110e-162L); ++ ++ TEST_c_c (csqrt, plus_zero, 0x1p-1074L, 1.571727784702628688909515672805082228285e-162L, 1.571727784702628688909515672805082228285e-162L); ++ TEST_c_c (csqrt, 0x1p-500L, 0x1p-1074L, 5.527147875260444560247265192192255725514e-76L, 4.469444793151709302716387622440056066334e-249L); ++#if defined TEST_DOUBLE || (defined TEST_LDOUBLE && LDBL_MAX_EXP == 1024) ++ TEST_c_c (csqrt, 0x1p+1023L, 0x1p-1074L, 9.480751908109176726832526455652159260085e153L, plus_zero, UNDERFLOW_EXCEPTION); ++#endif ++ TEST_c_c (csqrt, 0x1p-1074L, 0x1p+1023L, 6.703903964971298549787012499102923063740e153L, 6.703903964971298549787012499102923063740e153L); ++ TEST_c_c (csqrt, 0x1.0000000000001p-1022L, 0x1.0000000000001p-1022L, 1.638872094839911521020410942677082920935e-154L, 6.788430486774966350907249113759995429568e-155L); ++ TEST_c_c (csqrt, -0x1.0000000000001p-1022L, -0x1.0000000000001p-1022L, 6.788430486774966350907249113759995429568e-155L, -1.638872094839911521020410942677082920935e-154L); + #endif + + #if defined TEST_LDOUBLE && LDBL_MAX_EXP >= 16384 + TEST_c_c (csqrt, 0x1.fp+16383L, 0x1.fp+16383L, 1.179514222452201722651836720466795901016e+2466L, 4.885707879516577666702435054303191575148e+2465L); + TEST_c_c (csqrt, 0x1.fp+16383L, 0x1p+16383L, 1.106698967236475180613254276996359485630e+2466L, 2.687568007603946993388538156299100955642e+2465L); + TEST_c_c (csqrt, 0x1p-16440L, 0x1p-16441L, 3.514690655930285351254618340783294558136e-2475L, 8.297059146828716918029689466551384219370e-2476L); ++ ++ TEST_c_c (csqrt, plus_zero, 0x1p-16445L, 4.269191686890197837775136325621239761720e-2476L, 4.269191686890197837775136325621239761720e-2476L); ++ TEST_c_c (csqrt, 0x1p-5000L, 0x1p-16445L, 2.660791472672778409283210520357607795518e-753L, 6.849840675828785164910701384823702064234e-4199L); ++ TEST_c_c (csqrt, 0x1p+16383L, 0x1p-16445L, 7.712754032630730034273323365543179095045e2465L, plus_zero, UNDERFLOW_EXCEPTION); ++ TEST_c_c (csqrt, 0x1p-16445L, 0x1p+16383L, 5.453740678097079647314921223668914312241e2465L, 5.453740678097079647314921223668914312241e2465L); ++ TEST_c_c (csqrt, 0x1.0000000000000002p-16382L, 0x1.0000000000000002p-16382L, 2.014551439675644900131815801350165472778e-2466L, 8.344545284118961664300307045791497724440e-2467L); ++ TEST_c_c (csqrt, -0x1.0000000000000002p-16382L, -0x1.0000000000000002p-16382L, 8.344545284118961664300307045791497724440e-2467L, -2.014551439675644900131815801350165472778e-2466L); ++ ++# if LDBL_MANT_DIG >= 113 ++ TEST_c_c (csqrt, plus_zero, 0x1p-16494L, 1.799329752913293143453817328207572571442e-2483L, 1.799329752913293143453817328207572571442e-2483L); ++ TEST_c_c (csqrt, 0x1p-5000L, 0x1p-16494L, 2.660791472672778409283210520357607795518e-753L, 1.216776133331049643422030716668249905907e-4213L); ++ TEST_c_c (csqrt, 0x1p+16383L, 0x1p-16494L, 7.712754032630730034273323365543179095045e2465L, plus_zero, UNDERFLOW_EXCEPTION); ++ TEST_c_c (csqrt, 0x1p-16494L, 0x1p+16383L, 5.453740678097079647314921223668914312241e2465L, 5.453740678097079647314921223668914312241e2465L); ++ TEST_c_c (csqrt, 0x1.0000000000000000000000000001p-16382L, 0x1.0000000000000000000000000001p-16382L, 2.014551439675644900022606748976158925145e-2466L, 8.344545284118961663847948339519226074126e-2467L); ++ TEST_c_c (csqrt, -0x1.0000000000000000000000000001p-16382L, -0x1.0000000000000000000000000001p-16382L, 8.344545284118961663847948339519226074126e-2467L, -2.014551439675644900022606748976158925145e-2466L); ++# endif + #endif + + END (csqrt, complex); +diff --git a/math/s_csqrt.c b/math/s_csqrt.c +index 002ea5f..f4d0f99 100644 +--- a/math/s_csqrt.c ++++ b/math/s_csqrt.c +@@ -75,7 +75,11 @@ __csqrt (__complex__ double x) + } + else if (__builtin_expect (rcls == FP_ZERO, 0)) + { +- double r = __ieee754_sqrt (0.5 * fabs (__imag__ x)); ++ double r; ++ if (fabs (__imag__ x) >= 2.0 * DBL_MIN) ++ r = __ieee754_sqrt (0.5 * fabs (__imag__ x)); ++ else ++ r = 0.5 * __ieee754_sqrt (2.0 * fabs (__imag__ x)); + + __real__ res = r; + __imag__ res = __copysign (r, __imag__ x); +@@ -85,13 +89,21 @@ __csqrt (__complex__ double x) + double d, r, s; + int scale = 0; + +- if (fabs (__real__ x) > DBL_MAX / 2.0 +- || fabs (__imag__ x) > DBL_MAX / 2.0) ++ if (fabs (__real__ x) > DBL_MAX / 4.0) + { + scale = 1; + __real__ x = __scalbn (__real__ x, -2 * scale); + __imag__ x = __scalbn (__imag__ x, -2 * scale); + } ++ else if (fabs (__imag__ x) > DBL_MAX / 4.0) ++ { ++ scale = 1; ++ if (fabs (__real__ x) >= 4.0 * DBL_MIN) ++ __real__ x = __scalbn (__real__ x, -2 * scale); ++ else ++ __real__ x = 0.0; ++ __imag__ x = __scalbn (__imag__ x, -2 * scale); ++ } + else if (fabs (__real__ x) < DBL_MIN + && fabs (__imag__ x) < DBL_MIN) + { +@@ -105,13 +117,13 @@ __csqrt (__complex__ double x) + to avoid cancellation error in d +/- Re x. */ + if (__real__ x > 0) + { +- r = __ieee754_sqrt (0.5 * d + 0.5 * __real__ x); +- s = (0.5 * __imag__ x) / r; ++ r = __ieee754_sqrt (0.5 * (d + __real__ x)); ++ s = 0.5 * (__imag__ x / r); + } + else + { +- s = __ieee754_sqrt (0.5 * d - 0.5 * __real__ x); +- r = fabs ((0.5 * __imag__ x) / s); ++ s = __ieee754_sqrt (0.5 * (d - __real__ x)); ++ r = fabs (0.5 * (__imag__ x / s)); + } + + if (scale) +diff --git a/math/s_csqrtf.c b/math/s_csqrtf.c +index 6539ba2..5a274fd 100644 +--- a/math/s_csqrtf.c ++++ b/math/s_csqrtf.c +@@ -75,7 +75,11 @@ __csqrtf (__complex__ float x) + } + else if (__builtin_expect (rcls == FP_ZERO, 0)) + { +- float r = __ieee754_sqrtf (0.5 * fabsf (__imag__ x)); ++ float r; ++ if (fabsf (__imag__ x) >= 2.0f * FLT_MIN) ++ r = __ieee754_sqrtf (0.5f * fabsf (__imag__ x)); ++ else ++ r = 0.5f * __ieee754_sqrtf (2.0f * fabsf (__imag__ x)); + + __real__ res = r; + __imag__ res = __copysignf (r, __imag__ x); +@@ -85,13 +89,21 @@ __csqrtf (__complex__ float x) + float d, r, s; + int scale = 0; + +- if (fabsf (__real__ x) > FLT_MAX / 2.0f +- || fabsf (__imag__ x) > FLT_MAX / 2.0f) ++ if (fabsf (__real__ x) > FLT_MAX / 4.0f) + { + scale = 1; + __real__ x = __scalbnf (__real__ x, -2 * scale); + __imag__ x = __scalbnf (__imag__ x, -2 * scale); + } ++ else if (fabsf (__imag__ x) > FLT_MAX / 4.0f) ++ { ++ scale = 1; ++ if (fabsf (__real__ x) >= 4.0f * FLT_MIN) ++ __real__ x = __scalbnf (__real__ x, -2 * scale); ++ else ++ __real__ x = 0.0f; ++ __imag__ x = __scalbnf (__imag__ x, -2 * scale); ++ } + else if (fabsf (__real__ x) < FLT_MIN + && fabsf (__imag__ x) < FLT_MIN) + { +@@ -105,13 +117,13 @@ __csqrtf (__complex__ float x) + to avoid cancellation error in d +/- Re x. */ + if (__real__ x > 0) + { +- r = __ieee754_sqrtf (0.5f * d + 0.5f * __real__ x); +- s = (0.5f * __imag__ x) / r; ++ r = __ieee754_sqrtf (0.5f * (d + __real__ x)); ++ s = 0.5f * (__imag__ x / r); + } + else + { +- s = __ieee754_sqrtf (0.5f * d - 0.5f * __real__ x); +- r = fabsf ((0.5f * __imag__ x) / s); ++ s = __ieee754_sqrtf (0.5f * (d - __real__ x)); ++ r = fabsf (0.5f * (__imag__ x / s)); + } + + if (scale) +diff --git a/math/s_csqrtl.c b/math/s_csqrtl.c +index 64332f6..579d976 100644 +--- a/math/s_csqrtl.c ++++ b/math/s_csqrtl.c +@@ -75,7 +75,11 @@ __csqrtl (__complex__ long double x) + } + else if (__builtin_expect (rcls == FP_ZERO, 0)) + { +- long double r = __ieee754_sqrtl (0.5 * fabsl (__imag__ x)); ++ long double r; ++ if (fabsl (__imag__ x) >= 2.0L * LDBL_MIN) ++ r = __ieee754_sqrtl (0.5L * fabsl (__imag__ x)); ++ else ++ r = 0.5L * __ieee754_sqrtl (2.0L * fabsl (__imag__ x)); + + __real__ res = r; + __imag__ res = __copysignl (r, __imag__ x); +@@ -85,13 +89,21 @@ __csqrtl (__complex__ long double x) + long double d, r, s; + int scale = 0; + +- if (fabsl (__real__ x) > LDBL_MAX / 2.0L +- || fabsl (__imag__ x) > LDBL_MAX / 2.0L) ++ if (fabsl (__real__ x) > LDBL_MAX / 4.0L) + { + scale = 1; + __real__ x = __scalbnl (__real__ x, -2 * scale); + __imag__ x = __scalbnl (__imag__ x, -2 * scale); + } ++ else if (fabsl (__imag__ x) > LDBL_MAX / 4.0L) ++ { ++ scale = 1; ++ if (fabsl (__real__ x) >= 4.0L * LDBL_MIN) ++ __real__ x = __scalbnl (__real__ x, -2 * scale); ++ else ++ __real__ x = 0.0L; ++ __imag__ x = __scalbnl (__imag__ x, -2 * scale); ++ } + else if (fabsl (__real__ x) < LDBL_MIN + && fabsl (__imag__ x) < LDBL_MIN) + { +@@ -105,13 +117,13 @@ __csqrtl (__complex__ long double x) + to avoid cancellation error in d +/- Re x. */ + if (__real__ x > 0) + { +- r = __ieee754_sqrtl (0.5L * d + 0.5L * __real__ x); +- s = (0.5L * __imag__ x) / r; ++ r = __ieee754_sqrtl (0.5L * (d + __real__ x)); ++ s = 0.5L * (__imag__ x / r); + } + else + { +- s = __ieee754_sqrtl (0.5L * d - 0.5L * __real__ x); +- r = fabsl ((0.5L * __imag__ x) / s); ++ s = __ieee754_sqrtl (0.5L * (d - __real__ x)); ++ r = fabsl (0.5L * (__imag__ x / s)); + } + + if (scale) +diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps +index 6f41f02..9724919 100644 +--- a/sysdeps/i386/fpu/libm-test-ulps ++++ b/sysdeps/i386/fpu/libm-test-ulps +@@ -1374,6 +1374,30 @@ float: 1 + ifloat: 1 + + # csqrt ++Test "Real part of: csqrt (-0x1.0000000000000002p-16382 - 0x1.0000000000000002p-16382 i) == 8.344545284118961664300307045791497724440e-2467 - 2.014551439675644900131815801350165472778e-2466 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: csqrt (-0x1.0000000000000002p-16382 - 0x1.0000000000000002p-16382 i) == 8.344545284118961664300307045791497724440e-2467 - 2.014551439675644900131815801350165472778e-2466 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: csqrt (-0x1.0000000000001p-1022 - 0x1.0000000000001p-1022 i) == 6.788430486774966350907249113759995429568e-155 - 1.638872094839911521020410942677082920935e-154 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: csqrt (-0x1.000002p-126 - 0x1.000002p-126 i) == 4.934094449071842328766868579214125217132e-20 - 1.191195773697904627170323731331667740087e-19 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: csqrt (0x1.0000000000000002p-16382 + 0x1.0000000000000002p-16382 i) == 2.014551439675644900131815801350165472778e-2466 + 8.344545284118961664300307045791497724440e-2467 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: csqrt (0x1.0000000000000002p-16382 + 0x1.0000000000000002p-16382 i) == 2.014551439675644900131815801350165472778e-2466 + 8.344545284118961664300307045791497724440e-2467 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: csqrt (0x1.0000000000001p-1022 + 0x1.0000000000001p-1022 i) == 1.638872094839911521020410942677082920935e-154 + 6.788430486774966350907249113759995429568e-155 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: csqrt (0x1.000002p-126 + 0x1.000002p-126 i) == 1.191195773697904627170323731331667740087e-19 + 4.934094449071842328766868579214125217132e-20 i": ++ildouble: 1 ++ldouble: 1 + Test "Imaginary part of: csqrt (0x1.fffffffffffffp+1023 + 0x1p+1023 i) == 1.379778091031440685006200821918878702861e+154 + 3.257214233483129514781233066898042490248e+153 i": + ildouble: 1 + ldouble: 1 +@@ -3032,6 +3056,10 @@ ifloat: 1 + ildouble: 2 + ldouble: 2 + ++Function: Real part of "csqrt": ++ildouble: 1 ++ldouble: 1 ++ + Function: Imaginary part of "csqrt": + ildouble: 1 + ldouble: 1 +diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps +index 765c7a0..b64e52d 100644 +--- a/sysdeps/x86_64/fpu/libm-test-ulps ++++ b/sysdeps/x86_64/fpu/libm-test-ulps +@@ -1222,12 +1222,40 @@ float: 1 + ifloat: 1 + + # csqrt ++Test "Real part of: csqrt (-0x1.0000000000000002p-16382 - 0x1.0000000000000002p-16382 i) == 8.344545284118961664300307045791497724440e-2467 - 2.014551439675644900131815801350165472778e-2466 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: csqrt (-0x1.0000000000000002p-16382 - 0x1.0000000000000002p-16382 i) == 8.344545284118961664300307045791497724440e-2467 - 2.014551439675644900131815801350165472778e-2466 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: csqrt (-0x1.0000000000001p-1022 - 0x1.0000000000001p-1022 i) == 6.788430486774966350907249113759995429568e-155 - 1.638872094839911521020410942677082920935e-154 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: csqrt (-0x1.000002p-126 - 0x1.000002p-126 i) == 4.934094449071842328766868579214125217132e-20 - 1.191195773697904627170323731331667740087e-19 i": ++double: 1 ++idouble: 1 ++ildouble: 1 ++ldouble: 1 + Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i": + float: 1 + ifloat: 1 + Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i": + float: 1 + ifloat: 1 ++Test "Real part of: csqrt (0x1.0000000000000002p-16382 + 0x1.0000000000000002p-16382 i) == 2.014551439675644900131815801350165472778e-2466 + 8.344545284118961664300307045791497724440e-2467 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: csqrt (0x1.0000000000000002p-16382 + 0x1.0000000000000002p-16382 i) == 2.014551439675644900131815801350165472778e-2466 + 8.344545284118961664300307045791497724440e-2467 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: csqrt (0x1.0000000000001p-1022 + 0x1.0000000000001p-1022 i) == 1.638872094839911521020410942677082920935e-154 + 6.788430486774966350907249113759995429568e-155 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: csqrt (0x1.000002p-126 + 0x1.000002p-126 i) == 1.191195773697904627170323731331667740087e-19 + 4.934094449071842328766868579214125217132e-20 i": ++double: 1 ++idouble: 1 ++ildouble: 1 ++ldouble: 1 + Test "Imaginary part of: csqrt (0x1.fffffep+127 + 1.0 i) == 1.844674352395372953599975585936590505260e+19 + 2.710505511993121390769065968615872097053e-20 i": + float: 1 + ifloat: 1 +@@ -2818,6 +2846,8 @@ double: 1 + float: 1 + idouble: 1 + ifloat: 1 ++ildouble: 1 ++ldouble: 1 + + Function: Imaginary part of "csqrt": + double: 1 +-- +1.7.3.4 + diff --git a/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14173.patch b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14173.patch new file mode 100644 index 0000000000..f90eea4f09 --- /dev/null +++ b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14173.patch @@ -0,0 +1,46 @@ +From 541428fecf21cdde271acbd280c53bfe5beaafe2 Mon Sep 17 00:00:00 2001 +From: Marek Polacek +Date: Thu, 12 Jul 2012 16:34:47 +0200 +Subject: [PATCH] Fix ynl return value with LDBL_MIN. + +--- + ChangeLog | 7 +++++++ + NEWS | 3 ++- + math/libm-test.inc | 5 ++++- + sysdeps/ieee754/ldbl-96/e_jnl.c | 3 ++- + 4 files changed, 15 insertions(+), 3 deletions(-) + +diff --git a/math/libm-test.inc b/math/libm-test.inc +index a9cc2bd..25a8f41 100644 +--- a/math/libm-test.inc ++++ b/math/libm-test.inc +@@ -9015,8 +9015,11 @@ yn_test (void) + TEST_ff_f (yn, 10, 2.0, -129184.542208039282635913145923304214L); + TEST_ff_f (yn, 10, 10.0, -0.359814152183402722051986577343560609L); + +- END (yn); ++ /* Check whether yn returns correct value for LDBL_MIN, DBL_MIN, ++ and FLT_MIN. See Bug 14173. */ ++ TEST_ff_f (yn, 10, min_value, minus_infty, OVERFLOW_EXCEPTION); + ++ END (yn); + } + + +diff --git a/sysdeps/ieee754/ldbl-96/e_jnl.c b/sysdeps/ieee754/ldbl-96/e_jnl.c +index 2e206e7..36b0d8b 100644 +--- a/sysdeps/ieee754/ldbl-96/e_jnl.c ++++ b/sysdeps/ieee754/ldbl-96/e_jnl.c +@@ -360,7 +360,8 @@ __ieee754_ynl (int n, long double x) + b = __ieee754_y1l (x); + /* quit if b is -inf */ + GET_LDOUBLE_WORDS (se, i0, i1, b); +- for (i = 1; i < n && se != 0xffff; i++) ++ /* Use 0xffffffff since GET_LDOUBLE_WORDS sign-extends SE. */ ++ for (i = 1; i < n && se != 0xffffffff; i++) + { + temp = b; + b = ((long double) (i + i) / x) * b - a; +-- +1.7.3.4 + diff --git a/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14283.patch b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14283.patch new file mode 100644 index 0000000000..63a9209353 --- /dev/null +++ b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14283.patch @@ -0,0 +1,148 @@ +From 7a845b2c237434d4aad790aaba3a973e24ea802f Mon Sep 17 00:00:00 2001 +From: Joseph Myers +Date: Tue, 3 Jul 2012 17:10:42 +0000 +Subject: [PATCH] Fix float range reduction problems (bug 14283). + +--- + ChangeLog | 9 ++++++++ + NEWS | 2 + + math/libm-test.inc | 4 +++ + sysdeps/i386/fpu/libm-test-ulps | 16 +++++++------- + sysdeps/ieee754/flt-32/k_rem_pio2f.c | 37 +++++++++++++++++++++------------ + 5 files changed, 46 insertions(+), 22 deletions(-) + +diff --git a/math/libm-test.inc b/math/libm-test.inc +index 48b05a6..3e33348 100644 +--- a/math/libm-test.inc ++++ b/math/libm-test.inc +@@ -2589,6 +2589,8 @@ cos_test (void) + TEST_f_f (cos, 0.80190127184058835, 0.69534156199418473); + #endif + ++ TEST_f_f (cos, 0x1.442f74p+15, 2.4407839902314016628485779006274989801517e-06L); ++ + #ifndef TEST_FLOAT + TEST_f_f (cos, 1e22, 0.5232147853951389454975944733847094921409L); + TEST_f_f (cos, 0x1p1023, -0.826369834614147994500785680811743734805L); +@@ -7692,6 +7694,8 @@ sin_test (void) + TEST_f_f (sin, 0x1p65, -0.047183876212354673805106149805700013943218L); + TEST_f_f (sin, -0x1p65, 0.047183876212354673805106149805700013943218L); + ++ TEST_f_f (sin, 0x1.7f4134p+103, -6.6703229329788657073304190650534846045235e-08L); ++ + #ifdef TEST_DOUBLE + TEST_f_f (sin, 0.80190127184058835, 0.71867942238767868); + TEST_f_f (sin, 2.522464e-1, 2.4957989804940911e-1); +diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps +index 38a69e6..4661aea 100644 +--- a/sysdeps/i386/fpu/libm-test-ulps ++++ b/sysdeps/i386/fpu/libm-test-ulps +@@ -1656,8 +1656,8 @@ Test "j1 (0.75) == 0.349243602174862192523281016426251335": + double: 1 + idouble: 1 + Test "j1 (0x1.3ffp+74) == 1.818984347516051243459364437186082741567e-12": +-float: 1 +-ifloat: 1 ++float: 2 ++ifloat: 2 + ildouble: 1 + ldouble: 1 + Test "j1 (0x1.ff00000000002p+840) == 1.846591691699331493194965158699937660696e-127": +@@ -2359,8 +2359,8 @@ float: 1 + idouble: 1 + ifloat: 1 + Test "y0 (0x1.3ffp+74) == 1.818984347516051243459467456433028748678e-12": +-float: 1 +-ifloat: 1 ++float: 2 ++ifloat: 2 + ildouble: 1 + ldouble: 1 + Test "y0 (0x1.ff00000000002p+840) == 1.846591691699331493194965158699937660696e-127": +@@ -2956,9 +2956,9 @@ ldouble: 2 + + Function: "j1": + double: 2 +-float: 1 ++float: 2 + idouble: 2 +-ifloat: 1 ++ifloat: 2 + ildouble: 1 + ldouble: 1 + +@@ -3128,9 +3128,9 @@ ldouble: 1 + + Function: "y0": + double: 2 +-float: 1 ++float: 2 + idouble: 2 +-ifloat: 1 ++ifloat: 2 + ildouble: 1 + ldouble: 1 + +diff --git a/sysdeps/ieee754/flt-32/k_rem_pio2f.c b/sysdeps/ieee754/flt-32/k_rem_pio2f.c +index 06c2f37..e54a067 100644 +--- a/sysdeps/ieee754/flt-32/k_rem_pio2f.c ++++ b/sysdeps/ieee754/flt-32/k_rem_pio2f.c +@@ -88,7 +88,7 @@ recompute: + iq[jz-1] -= i<<(8-q0); + ih = iq[jz-1]>>(7-q0); + } +- else if(q0==0) ih = iq[jz-1]>>8; ++ else if(q0==0) ih = iq[jz-1]>>7; + else if(z>=(float)0.5) ih=2; + + if(ih>0) { /* q > 0.5 */ +@@ -166,24 +166,33 @@ recompute: + y[0] = (ih==0)? fw: -fw; + break; + case 1: +- case 2: +- fw = 0.0; +- for (i=jz;i>=0;i--) fw += fq[i]; +- y[0] = (ih==0)? fw: -fw; +- fw = fq[0]-fw; +- for (i=1;i<=jz;i++) fw += fq[i]; +- y[1] = (ih==0)? fw: -fw; ++ case 2:; ++#if __FLT_EVAL_METHOD__ != 0 ++ volatile ++#endif ++ float fv = 0.0; ++ for (i=jz;i>=0;i--) fv += fq[i]; ++ y[0] = (ih==0)? fv: -fv; ++ fv = fq[0]-fv; ++ for (i=1;i<=jz;i++) fv += fq[i]; ++ y[1] = (ih==0)? fv: -fv; + break; + case 3: /* painful */ + for (i=jz;i>0;i--) { +- fw = fq[i-1]+fq[i]; +- fq[i] += fq[i-1]-fw; +- fq[i-1] = fw; ++#if __FLT_EVAL_METHOD__ != 0 ++ volatile ++#endif ++ float fv = fq[i-1]+fq[i]; ++ fq[i] += fq[i-1]-fv; ++ fq[i-1] = fv; + } + for (i=jz;i>1;i--) { +- fw = fq[i-1]+fq[i]; +- fq[i] += fq[i-1]-fw; +- fq[i-1] = fw; ++#if __FLT_EVAL_METHOD__ != 0 ++ volatile ++#endif ++ float fv = fq[i-1]+fq[i]; ++ fq[i] += fq[i-1]-fv; ++ fq[i-1] = fv; + } + for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; + if(ih==0) { +-- +1.7.3.4 + diff --git a/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14307.patch b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14307.patch new file mode 100644 index 0000000000..335e4c221c --- /dev/null +++ b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14307.patch @@ -0,0 +1,97 @@ +From 7b6e99be77c24a79cb07416d81796b45176923c6 Mon Sep 17 00:00:00 2001 +From: Jeroen van Bemmel +Date: Thu, 12 Jul 2012 11:23:28 +0530 +Subject: [PATCH] Avoid duplicate DNS requests if answer is longer than a implementation + limit + + [BZ #14307] + * sysdeps/posix/getaddrinfo.c (gaih_inet): Increase the size of + the temporary buffer used to invoke __gethostbyname2_r, + __gethostbyaddr_r and gethostbyname4_r to make room for struct + host_data / struct gaih_addrtuple. + * resolv/nss_dns/dns-host.c (global scope): Move definition of + implementation constants MAX_NR_ALIASES and MAX_NR_ADDRS to + header file nss/nsswitch.h. + * nss/nsswitch.h (global scope): Add definition of implementation + constants MAX_NR_ALIASES and MAX_NR_ADDRS (moved from + resolv/nss_dns/dns-host.c). +--- + ChangeLog | 14 ++++++++++++++ + nss/nsswitch.h | 7 +++++-- + resolv/nss_dns/dns-host.c | 4 ---- + sysdeps/posix/getaddrinfo.c | 10 +++++++--- + 4 files changed, 26 insertions(+), 9 deletions(-) + +diff --git a/nss/nsswitch.h b/nss/nsswitch.h +index 90e208b..047a9e5 100644 +--- a/nss/nsswitch.h ++++ b/nss/nsswitch.h +@@ -1,5 +1,4 @@ +-/* Copyright (C) 1996-1999,2001,2002,2003,2004,2007,2010,2011 +- Free Software Foundation, Inc. ++/* Copyright (C) 1996-2012 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 +@@ -198,4 +197,8 @@ extern int __nss_hostname_digits_dots (const char *name, + int *h_errnop); + libc_hidden_proto (__nss_hostname_digits_dots) + ++/* Maximum number of aliases we allow. */ ++#define MAX_NR_ALIASES 48 ++#define MAX_NR_ADDRS 48 ++ + #endif /* nsswitch.h */ +diff --git a/resolv/nss_dns/dns-host.c b/resolv/nss_dns/dns-host.c +index a924d40..6b62c05 100644 +--- a/resolv/nss_dns/dns-host.c ++++ b/resolv/nss_dns/dns-host.c +@@ -88,10 +88,6 @@ + + #define RESOLVSORT + +-/* Maximum number of aliases we allow. */ +-#define MAX_NR_ALIASES 48 +-#define MAX_NR_ADDRS 48 +- + #if PACKETSZ > 65536 + # define MAXPACKET PACKETSZ + #else +diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c +index 2eca2ae..78a2474 100644 +--- a/sysdeps/posix/getaddrinfo.c ++++ b/sysdeps/posix/getaddrinfo.c +@@ -568,7 +568,9 @@ gaih_inet (const char *name, const struct gaih_service *service, + IPv6 scope ids. */ + if (req->ai_family == AF_INET) + { +- size_t tmpbuflen = 512; ++ /* Allocate additional room for struct host_data. */ ++ size_t tmpbuflen = (512 + MAX_NR_ALIASES * sizeof(char*) ++ + 16 * sizeof(char)); + assert (tmpbuf == NULL); + tmpbuf = alloca_account (tmpbuflen, alloca_used); + int rc; +@@ -811,7 +813,7 @@ gaih_inet (const char *name, const struct gaih_service *service, + old_res_options = _res.options; + _res.options &= ~RES_USE_INET6; + +- size_t tmpbuflen = 1024; ++ size_t tmpbuflen = 1024 + sizeof(struct gaih_addrtuple); + malloc_tmpbuf = !__libc_use_alloca (alloca_used + tmpbuflen); + assert (tmpbuf == NULL); + if (!malloc_tmpbuf) +@@ -1113,7 +1115,9 @@ gaih_inet (const char *name, const struct gaih_service *service, + struct hostent *h = NULL; + int herrno; + struct hostent th; +- size_t tmpbuf2len = 512; ++ /* Add room for struct host_data. */ ++ size_t tmpbuf2len = (512 + (MAX_NR_ALIASES+MAX_NR_ADDRS+1) ++ * sizeof(char*) + 16 * sizeof(char)); + + do + { +-- +1.7.3.4 + diff --git a/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14328.patch b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14328.patch new file mode 100644 index 0000000000..2e315a9d2f --- /dev/null +++ b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU14328.patch @@ -0,0 +1,1116 @@ +From ca61cf32d934eda9130c4d3c6911892877ad7b0d Mon Sep 17 00:00:00 2001 +From: Joseph Myers +Date: Wed, 4 Jul 2012 09:55:26 +0000 +Subject: [PATCH] Fix ctan, ctanh of subnormals in round-upwards mode (bug 14328). + +--- + ChangeLog | 22 +++ + NEWS | 2 +- + math/libm-test.inc | 272 ++++++++++++++++++++++++++++++++++++ + math/s_ctan.c | 18 ++- + math/s_ctanf.c | 18 ++- + math/s_ctanh.c | 18 ++- + math/s_ctanhf.c | 18 ++- + math/s_ctanhl.c | 18 ++- + math/s_ctanl.c | 18 ++- + sysdeps/i386/fpu/libm-test-ulps | 274 ++++++++++++++++++++++++++++++++++++ + sysdeps/x86_64/fpu/libm-test-ulps | 278 +++++++++++++++++++++++++++++++++++++ + 11 files changed, 937 insertions(+), 19 deletions(-) + +diff --git a/math/libm-test.inc b/math/libm-test.inc +index 3e33348..514ad06 100644 +--- a/math/libm-test.inc ++++ b/math/libm-test.inc +@@ -3319,6 +3319,138 @@ ctan_test (void) + + + static void ++ctan_test_tonearest (void) ++{ ++ int save_round_mode; ++ errno = 0; ++ FUNC(ctan) (BUILD_COMPLEX (0.7L, 1.2L)); ++ if (errno == ENOSYS) ++ /* Function not implemented. */ ++ return; ++ ++ START (ctan_tonearest); ++ ++ save_round_mode = fegetround (); ++ ++ if (!fesetround (FE_TONEAREST)) ++ { ++ TEST_c_c (ctan, 0x1.921fb6p+0, 0x1p-149, -2.287733242885645987394874673945769518150e7L, 7.334008549954377778731880988481078535821e-31L); ++ ++#ifndef TEST_FLOAT ++ TEST_c_c (ctan, 0x1.921fb54442d18p+0, 0x1p-1074, 1.633123935319536975596773704152891653086e16L, 1.317719414943508315995636961402669067843e-291L); ++#endif ++ ++#if defined TEST_LDOUBLE && LDBL_MIN_EXP <= -16381 ++ TEST_c_c (ctan, 0x1.921fb54442d1846ap+0L, 0x1p-16445L, -3.986797629811710706723242948653362815645e19L, 5.793882568875674066286163141055208625180e-4912L); ++#endif ++ } ++ ++ fesetround (save_round_mode); ++ ++ END (ctan_tonearest, complex); ++} ++ ++ ++static void ++ctan_test_towardzero (void) ++{ ++ int save_round_mode; ++ errno = 0; ++ FUNC(ctan) (BUILD_COMPLEX (0.7L, 1.2L)); ++ if (errno == ENOSYS) ++ /* Function not implemented. */ ++ return; ++ ++ START (ctan_towardzero); ++ ++ save_round_mode = fegetround (); ++ ++ if (!fesetround (FE_TOWARDZERO)) ++ { ++ TEST_c_c (ctan, 0x1.921fb6p+0, 0x1p-149, -2.287733242885645987394874673945769518150e7L, 7.334008549954377778731880988481078535821e-31L); ++ ++#ifndef TEST_FLOAT ++ TEST_c_c (ctan, 0x1.921fb54442d18p+0, 0x1p-1074, 1.633123935319536975596773704152891653086e16L, 1.317719414943508315995636961402669067843e-291L); ++#endif ++ ++#if defined TEST_LDOUBLE && LDBL_MIN_EXP <= -16381 ++ TEST_c_c (ctan, 0x1.921fb54442d1846ap+0L, 0x1p-16445L, -3.986797629811710706723242948653362815645e19L, 5.793882568875674066286163141055208625180e-4912L); ++#endif ++ } ++ ++ fesetround (save_round_mode); ++ ++ END (ctan_towardzero, complex); ++} ++ ++ ++static void ++ctan_test_downward (void) ++{ ++ int save_round_mode; ++ errno = 0; ++ FUNC(ctan) (BUILD_COMPLEX (0.7L, 1.2L)); ++ if (errno == ENOSYS) ++ /* Function not implemented. */ ++ return; ++ ++ START (ctan_downward); ++ ++ save_round_mode = fegetround (); ++ ++ if (!fesetround (FE_DOWNWARD)) ++ { ++ TEST_c_c (ctan, 0x1.921fb6p+0, 0x1p-149, -2.287733242885645987394874673945769518150e7L, 7.334008549954377778731880988481078535821e-31L); ++ ++#ifndef TEST_FLOAT ++ TEST_c_c (ctan, 0x1.921fb54442d18p+0, 0x1p-1074, 1.633123935319536975596773704152891653086e16L, 1.317719414943508315995636961402669067843e-291L); ++#endif ++ ++#if defined TEST_LDOUBLE && LDBL_MIN_EXP <= -16381 ++ TEST_c_c (ctan, 0x1.921fb54442d1846ap+0L, 0x1p-16445L, -3.986797629811710706723242948653362815645e19L, 5.793882568875674066286163141055208625180e-4912L); ++#endif ++ } ++ ++ fesetround (save_round_mode); ++ ++ END (ctan_downward, complex); ++} ++ ++ ++static void ++ctan_test_upward (void) ++{ ++ int save_round_mode; ++ errno = 0; ++ FUNC(ctan) (BUILD_COMPLEX (0.7L, 1.2L)); ++ if (errno == ENOSYS) ++ /* Function not implemented. */ ++ return; ++ ++ START (ctan_upward); ++ ++ save_round_mode = fegetround (); ++ ++ if (!fesetround (FE_UPWARD)) ++ { ++ TEST_c_c (ctan, 0x1.921fb6p+0, 0x1p-149, -2.287733242885645987394874673945769518150e7L, 7.334008549954377778731880988481078535821e-31L); ++ ++#ifndef TEST_FLOAT ++ TEST_c_c (ctan, 0x1.921fb54442d18p+0, 0x1p-1074, 1.633123935319536975596773704152891653086e16L, 1.317719414943508315995636961402669067843e-291L); ++#endif ++ ++#if defined TEST_LDOUBLE && LDBL_MIN_EXP <= -16381 ++ TEST_c_c (ctan, 0x1.921fb54442d1846ap+0L, 0x1p-16445L, -3.986797629811710706723242948653362815645e19L, 5.793882568875674066286163141055208625180e-4912L); ++#endif ++ } ++ ++ fesetround (save_round_mode); ++ ++ END (ctan_upward, complex); ++} ++ ++ ++static void + ctanh_test (void) + { + errno = 0; +@@ -3408,6 +3540,138 @@ ctanh_test (void) + + + static void ++ctanh_test_tonearest (void) ++{ ++ int save_round_mode; ++ errno = 0; ++ FUNC(ctanh) (BUILD_COMPLEX (0.7L, 1.2L)); ++ if (errno == ENOSYS) ++ /* Function not implemented. */ ++ return; ++ ++ START (ctanh_tonearest); ++ ++ save_round_mode = fegetround (); ++ ++ if (!fesetround (FE_TONEAREST)) ++ { ++ TEST_c_c (ctanh, 0x1p-149, 0x1.921fb6p+0, 7.334008549954377778731880988481078535821e-31L, -2.287733242885645987394874673945769518150e7L); ++ ++#ifndef TEST_FLOAT ++ TEST_c_c (ctanh, 0x1p-1074, 0x1.921fb54442d18p+0, 1.317719414943508315995636961402669067843e-291L, 1.633123935319536975596773704152891653086e16L); ++#endif ++ ++#if defined TEST_LDOUBLE && LDBL_MIN_EXP <= -16381 ++ TEST_c_c (ctanh, 0x1p-16445L, 0x1.921fb54442d1846ap+0L, 5.793882568875674066286163141055208625180e-4912L, -3.986797629811710706723242948653362815645e19L); ++#endif ++ } ++ ++ fesetround (save_round_mode); ++ ++ END (ctanh_tonearest, complex); ++} ++ ++ ++static void ++ctanh_test_towardzero (void) ++{ ++ int save_round_mode; ++ errno = 0; ++ FUNC(ctanh) (BUILD_COMPLEX (0.7L, 1.2L)); ++ if (errno == ENOSYS) ++ /* Function not implemented. */ ++ return; ++ ++ START (ctanh_towardzero); ++ ++ save_round_mode = fegetround (); ++ ++ if (!fesetround (FE_TOWARDZERO)) ++ { ++ TEST_c_c (ctanh, 0x1p-149, 0x1.921fb6p+0, 7.334008549954377778731880988481078535821e-31L, -2.287733242885645987394874673945769518150e7L); ++ ++#ifndef TEST_FLOAT ++ TEST_c_c (ctanh, 0x1p-1074, 0x1.921fb54442d18p+0, 1.317719414943508315995636961402669067843e-291L, 1.633123935319536975596773704152891653086e16L); ++#endif ++ ++#if defined TEST_LDOUBLE && LDBL_MIN_EXP <= -16381 ++ TEST_c_c (ctanh, 0x1p-16445L, 0x1.921fb54442d1846ap+0L, 5.793882568875674066286163141055208625180e-4912L, -3.986797629811710706723242948653362815645e19L); ++#endif ++ } ++ ++ fesetround (save_round_mode); ++ ++ END (ctanh_towardzero, complex); ++} ++ ++ ++static void ++ctanh_test_downward (void) ++{ ++ int save_round_mode; ++ errno = 0; ++ FUNC(ctanh) (BUILD_COMPLEX (0.7L, 1.2L)); ++ if (errno == ENOSYS) ++ /* Function not implemented. */ ++ return; ++ ++ START (ctanh_downward); ++ ++ save_round_mode = fegetround (); ++ ++ if (!fesetround (FE_DOWNWARD)) ++ { ++ TEST_c_c (ctanh, 0x1p-149, 0x1.921fb6p+0, 7.334008549954377778731880988481078535821e-31L, -2.287733242885645987394874673945769518150e7L); ++ ++#ifndef TEST_FLOAT ++ TEST_c_c (ctanh, 0x1p-1074, 0x1.921fb54442d18p+0, 1.317719414943508315995636961402669067843e-291L, 1.633123935319536975596773704152891653086e16L); ++#endif ++ ++#if defined TEST_LDOUBLE && LDBL_MIN_EXP <= -16381 ++ TEST_c_c (ctanh, 0x1p-16445L, 0x1.921fb54442d1846ap+0L, 5.793882568875674066286163141055208625180e-4912L, -3.986797629811710706723242948653362815645e19L); ++#endif ++ } ++ ++ fesetround (save_round_mode); ++ ++ END (ctanh_downward, complex); ++} ++ ++ ++static void ++ctanh_test_upward (void) ++{ ++ int save_round_mode; ++ errno = 0; ++ FUNC(ctanh) (BUILD_COMPLEX (0.7L, 1.2L)); ++ if (errno == ENOSYS) ++ /* Function not implemented. */ ++ return; ++ ++ START (ctanh_upward); ++ ++ save_round_mode = fegetround (); ++ ++ if (!fesetround (FE_UPWARD)) ++ { ++ TEST_c_c (ctanh, 0x1p-149, 0x1.921fb6p+0, 7.334008549954377778731880988481078535821e-31L, -2.287733242885645987394874673945769518150e7L); ++ ++#ifndef TEST_FLOAT ++ TEST_c_c (ctanh, 0x1p-1074, 0x1.921fb54442d18p+0, 1.317719414943508315995636961402669067843e-291L, 1.633123935319536975596773704152891653086e16L); ++#endif ++ ++#if defined TEST_LDOUBLE && LDBL_MIN_EXP <= -16381 ++ TEST_c_c (ctanh, 0x1p-16445L, 0x1.921fb54442d1846ap+0L, 5.793882568875674066286163141055208625180e-4912L, -3.986797629811710706723242948653362815645e19L); ++#endif ++ } ++ ++ fesetround (save_round_mode); ++ ++ END (ctanh_upward, complex); ++} ++ ++ ++static void + erf_test (void) + { + errno = 0; +@@ -8909,7 +9173,15 @@ main (int argc, char **argv) + csinh_test (); + csqrt_test (); + ctan_test (); ++ ctan_test_tonearest (); ++ ctan_test_towardzero (); ++ ctan_test_downward (); ++ ctan_test_upward (); + ctanh_test (); ++ ctanh_test_tonearest (); ++ ctanh_test_towardzero (); ++ ctanh_test_downward (); ++ ctanh_test_upward (); + + /* Bessel functions: */ + j0_test (); +diff --git a/math/s_ctan.c b/math/s_ctan.c +index 78117b3..89c0fef 100644 +--- a/math/s_ctan.c ++++ b/math/s_ctan.c +@@ -83,10 +83,22 @@ __ctan (__complex__ double x) + } + else + { +- double sinhix = __ieee754_sinh (__imag__ x); +- double coshix = __ieee754_cosh (__imag__ x); ++ double sinhix, coshix; ++ if (fabs (__imag__ x) > DBL_MIN) ++ { ++ sinhix = __ieee754_sinh (__imag__ x); ++ coshix = __ieee754_cosh (__imag__ x); ++ } ++ else ++ { ++ sinhix = __imag__ x; ++ coshix = 1.0; ++ } + +- den = cosrx * cosrx + sinhix * sinhix; ++ if (fabs (sinhix) > fabs (cosrx) * DBL_EPSILON) ++ den = cosrx * cosrx + sinhix * sinhix; ++ else ++ den = cosrx * cosrx; + __real__ res = sinrx * cosrx / den; + __imag__ res = sinhix * coshix / den; + } +diff --git a/math/s_ctanf.c b/math/s_ctanf.c +index 4cba559..2559f83 100644 +--- a/math/s_ctanf.c ++++ b/math/s_ctanf.c +@@ -83,10 +83,22 @@ __ctanf (__complex__ float x) + } + else + { +- float sinhix = __ieee754_sinhf (__imag__ x); +- float coshix = __ieee754_coshf (__imag__ x); ++ float sinhix, coshix; ++ if (fabsf (__imag__ x) > FLT_MIN) ++ { ++ sinhix = __ieee754_sinhf (__imag__ x); ++ coshix = __ieee754_coshf (__imag__ x); ++ } ++ else ++ { ++ sinhix = __imag__ x; ++ coshix = 1.0f; ++ } + +- den = cosrx * cosrx + sinhix * sinhix; ++ if (fabsf (sinhix) > fabsf (cosrx) * FLT_EPSILON) ++ den = cosrx * cosrx + sinhix * sinhix; ++ else ++ den = cosrx * cosrx; + __real__ res = sinrx * cosrx / den; + __imag__ res = sinhix * coshix / den; + } +diff --git a/math/s_ctanh.c b/math/s_ctanh.c +index 201871e..d288b7d 100644 +--- a/math/s_ctanh.c ++++ b/math/s_ctanh.c +@@ -83,10 +83,22 @@ __ctanh (__complex__ double x) + } + else + { +- double sinhrx = __ieee754_sinh (__real__ x); +- double coshrx = __ieee754_cosh (__real__ x); ++ double sinhrx, coshrx; ++ if (fabs (__real__ x) > DBL_MIN) ++ { ++ sinhrx = __ieee754_sinh (__real__ x); ++ coshrx = __ieee754_cosh (__real__ x); ++ } ++ else ++ { ++ sinhrx = __real__ x; ++ coshrx = 1.0; ++ } + +- den = sinhrx * sinhrx + cosix * cosix; ++ if (fabs (sinhrx) > fabs (cosix) * DBL_EPSILON) ++ den = sinhrx * sinhrx + cosix * cosix; ++ else ++ den = cosix * cosix; + __real__ res = sinhrx * coshrx / den; + __imag__ res = sinix * cosix / den; + } +diff --git a/math/s_ctanhf.c b/math/s_ctanhf.c +index e505155..ca36a83 100644 +--- a/math/s_ctanhf.c ++++ b/math/s_ctanhf.c +@@ -83,10 +83,22 @@ __ctanhf (__complex__ float x) + } + else + { +- float sinhrx = __ieee754_sinhf (__real__ x); +- float coshrx = __ieee754_coshf (__real__ x); ++ float sinhrx, coshrx; ++ if (fabsf (__real__ x) > FLT_MIN) ++ { ++ sinhrx = __ieee754_sinhf (__real__ x); ++ coshrx = __ieee754_coshf (__real__ x); ++ } ++ else ++ { ++ sinhrx = __real__ x; ++ coshrx = 1.0f; ++ } + +- den = sinhrx * sinhrx + cosix * cosix; ++ if (fabsf (sinhrx) > fabsf (cosix) * FLT_EPSILON) ++ den = sinhrx * sinhrx + cosix * cosix; ++ else ++ den = cosix * cosix; + __real__ res = sinhrx * coshrx / den; + __imag__ res = sinix * cosix / den; + } +diff --git a/math/s_ctanhl.c b/math/s_ctanhl.c +index e5d6779..dbf1612 100644 +--- a/math/s_ctanhl.c ++++ b/math/s_ctanhl.c +@@ -83,10 +83,22 @@ __ctanhl (__complex__ long double x) + } + else + { +- long double sinhrx = __ieee754_sinhl (__real__ x); +- long double coshrx = __ieee754_coshl (__real__ x); ++ long double sinhrx, coshrx; ++ if (fabsl (__real__ x) > LDBL_MIN) ++ { ++ sinhrx = __ieee754_sinhl (__real__ x); ++ coshrx = __ieee754_coshl (__real__ x); ++ } ++ else ++ { ++ sinhrx = __real__ x; ++ coshrx = 1.0L; ++ } + +- den = sinhrx * sinhrx + cosix * cosix; ++ if (fabsl (sinhrx) > fabsl (cosix) * LDBL_EPSILON) ++ den = sinhrx * sinhrx + cosix * cosix; ++ else ++ den = cosix * cosix; + __real__ res = sinhrx * coshrx / den; + __imag__ res = sinix * cosix / den; + } +diff --git a/math/s_ctanl.c b/math/s_ctanl.c +index 12d700c..4fe2611 100644 +--- a/math/s_ctanl.c ++++ b/math/s_ctanl.c +@@ -83,10 +83,22 @@ __ctanl (__complex__ long double x) + } + else + { +- long double sinhix = __ieee754_sinhl (__imag__ x); +- long double coshix = __ieee754_coshl (__imag__ x); ++ long double sinhix, coshix; ++ if (fabsl (__imag__ x) > LDBL_MIN) ++ { ++ sinhix = __ieee754_sinhl (__imag__ x); ++ coshix = __ieee754_coshl (__imag__ x); ++ } ++ else ++ { ++ sinhix = __imag__ x; ++ coshix = 1.0L; ++ } + +- den = cosrx * cosrx + sinhix * sinhix; ++ if (fabsl (sinhix) > fabsl (cosrx) * LDBL_EPSILON) ++ den = cosrx * cosrx + sinhix * sinhix; ++ else ++ den = cosrx * cosrx; + __real__ res = sinrx * cosrx / den; + __imag__ res = sinhix * coshix / den; + } +diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps +index 4661aea..6f41f02 100644 +--- a/sysdeps/i386/fpu/libm-test-ulps ++++ b/sysdeps/i386/fpu/libm-test-ulps +@@ -1437,6 +1437,93 @@ idouble: 1 + ildouble: 2 + ldouble: 2 + ++# ctan_downward ++Test "Real part of: ctan_downward (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: ctan_downward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": ++double: 1 ++idouble: 1 ++ildouble: 2 ++ldouble: 2 ++Test "Imaginary part of: ctan_downward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": ++ildouble: 3 ++ldouble: 3 ++Test "Real part of: ctan_downward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++double: 1 ++float: 1 ++idouble: 1 ++ifloat: 1 ++ildouble: 3 ++ldouble: 3 ++Test "Imaginary part of: ctan_downward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++float: 3 ++ifloat: 3 ++ildouble: 4 ++ldouble: 4 ++ ++# ctan_tonearest ++Test "Imaginary part of: ctan_tonearest (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctan_tonearest (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: ctan_tonearest (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++float: 1 ++ifloat: 1 ++Test "Imaginary part of: ctan_tonearest (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++float: 1 ++ifloat: 1 ++ildouble: 1 ++ldouble: 1 ++ ++# ctan_towardzero ++Test "Real part of: ctan_towardzero (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": ++double: 1 ++idouble: 1 ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctan_towardzero (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: ctan_towardzero (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctan_towardzero (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++float: 3 ++ifloat: 3 ++ildouble: 4 ++ldouble: 4 ++ ++# ctan_upward ++Test "Real part of: ctan_upward (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i": ++ildouble: 2 ++ldouble: 2 ++Test "Imaginary part of: ctan_upward (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: ctan_upward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctan_upward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": ++double: 1 ++idouble: 1 ++ildouble: 4 ++ldouble: 4 ++Test "Real part of: ctan_upward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++float: 1 ++ifloat: 1 ++ildouble: 2 ++ldouble: 2 ++Test "Imaginary part of: ctan_upward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++double: 1 ++float: 1 ++idouble: 1 ++ifloat: 1 ++ildouble: 1 ++ldouble: 1 ++ + # ctanh + Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": + float: 1 +@@ -1488,6 +1575,93 @@ idouble: 1 + ildouble: 2 + ldouble: 2 + ++# ctanh_downward ++Test "Real part of: ctanh_downward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": ++ildouble: 3 ++ldouble: 3 ++Test "Imaginary part of: ctanh_downward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": ++double: 1 ++idouble: 1 ++ildouble: 2 ++ldouble: 2 ++Test "Real part of: ctanh_downward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++float: 3 ++ifloat: 3 ++ildouble: 4 ++ldouble: 4 ++Test "Imaginary part of: ctanh_downward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++double: 1 ++float: 1 ++idouble: 1 ++ifloat: 1 ++ildouble: 3 ++ldouble: 3 ++Test "Imaginary part of: ctanh_downward (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i": ++ildouble: 1 ++ldouble: 1 ++ ++# ctanh_tonearest ++Test "Real part of: ctanh_tonearest (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: ctanh_tonearest (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++float: 1 ++ifloat: 1 ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctanh_tonearest (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++float: 1 ++ifloat: 1 ++Test "Real part of: ctanh_tonearest (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i": ++ildouble: 1 ++ldouble: 1 ++ ++# ctanh_towardzero ++Test "Real part of: ctanh_towardzero (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctanh_towardzero (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": ++double: 1 ++idouble: 1 ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: ctanh_towardzero (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++float: 3 ++ifloat: 3 ++ildouble: 4 ++ldouble: 4 ++Test "Imaginary part of: ctanh_towardzero (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++ildouble: 1 ++ldouble: 1 ++ ++# ctanh_upward ++Test "Real part of: ctanh_upward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": ++double: 1 ++idouble: 1 ++ildouble: 4 ++ldouble: 4 ++Test "Imaginary part of: ctanh_upward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: ctanh_upward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++double: 1 ++float: 1 ++idouble: 1 ++ifloat: 1 ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctanh_upward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++float: 1 ++ifloat: 1 ++ildouble: 2 ++ldouble: 2 ++Test "Real part of: ctanh_upward (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctanh_upward (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i": ++ildouble: 2 ++ldouble: 2 ++ + # erf + Test "erf (1.25) == 0.922900128256458230136523481197281140": + double: 1 +@@ -2878,6 +3052,56 @@ ifloat: 1 + ildouble: 1 + ldouble: 1 + ++Function: Real part of "ctan_downward": ++double: 1 ++float: 1 ++idouble: 1 ++ifloat: 1 ++ildouble: 3 ++ldouble: 3 ++ ++Function: Imaginary part of "ctan_downward": ++float: 3 ++ifloat: 3 ++ildouble: 4 ++ldouble: 4 ++ ++Function: Real part of "ctan_tonearest": ++float: 1 ++ifloat: 1 ++ ++Function: Imaginary part of "ctan_tonearest": ++float: 1 ++ifloat: 1 ++ildouble: 1 ++ldouble: 1 ++ ++Function: Real part of "ctan_towardzero": ++double: 1 ++idouble: 1 ++ildouble: 1 ++ldouble: 1 ++ ++Function: Imaginary part of "ctan_towardzero": ++float: 3 ++ifloat: 3 ++ildouble: 4 ++ldouble: 4 ++ ++Function: Real part of "ctan_upward": ++float: 1 ++ifloat: 1 ++ildouble: 2 ++ldouble: 2 ++ ++Function: Imaginary part of "ctan_upward": ++double: 1 ++float: 1 ++idouble: 1 ++ifloat: 1 ++ildouble: 4 ++ldouble: 4 ++ + Function: Real part of "ctanh": + double: 1 + float: 1 +@@ -2894,6 +3118,56 @@ ifloat: 1 + ildouble: 2 + ldouble: 2 + ++Function: Real part of "ctanh_downward": ++float: 3 ++ifloat: 3 ++ildouble: 4 ++ldouble: 4 ++ ++Function: Imaginary part of "ctanh_downward": ++double: 1 ++float: 1 ++idouble: 1 ++ifloat: 1 ++ildouble: 3 ++ldouble: 3 ++ ++Function: Real part of "ctanh_tonearest": ++float: 1 ++ifloat: 1 ++ildouble: 1 ++ldouble: 1 ++ ++Function: Imaginary part of "ctanh_tonearest": ++float: 1 ++ifloat: 1 ++ ++Function: Real part of "ctanh_towardzero": ++float: 3 ++ifloat: 3 ++ildouble: 4 ++ldouble: 4 ++ ++Function: Imaginary part of "ctanh_towardzero": ++double: 1 ++idouble: 1 ++ildouble: 1 ++ldouble: 1 ++ ++Function: Real part of "ctanh_upward": ++double: 1 ++float: 1 ++idouble: 1 ++ifloat: 1 ++ildouble: 4 ++ldouble: 4 ++ ++Function: Imaginary part of "ctanh_upward": ++float: 1 ++ifloat: 1 ++ildouble: 2 ++ldouble: 2 ++ + Function: "erf": + double: 1 + idouble: 1 +diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps +index 3374b5f..765c7a0 100644 +--- a/sysdeps/x86_64/fpu/libm-test-ulps ++++ b/sysdeps/x86_64/fpu/libm-test-ulps +@@ -1304,6 +1304,93 @@ Test "Real part of: ctan (1 + 47 i) == 2.729321264492904590777293425576722354636 + ildouble: 2 + ldouble: 2 + ++# ctan_downward ++Test "Real part of: ctan_downward (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: ctan_downward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": ++ildouble: 2 ++ldouble: 2 ++Test "Imaginary part of: ctan_downward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": ++ildouble: 3 ++ldouble: 3 ++Test "Real part of: ctan_downward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++double: 2 ++float: 1 ++idouble: 2 ++ifloat: 1 ++ildouble: 3 ++ldouble: 3 ++Test "Imaginary part of: ctan_downward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++float: 1 ++ifloat: 1 ++ildouble: 4 ++ldouble: 4 ++ ++# ctan_tonearest ++Test "Imaginary part of: ctan_tonearest (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctan_tonearest (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: ctan_tonearest (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++float: 1 ++ifloat: 1 ++Test "Imaginary part of: ctan_tonearest (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++float: 1 ++ifloat: 1 ++ildouble: 1 ++ldouble: 1 ++ ++# ctan_towardzero ++Test "Real part of: ctan_towardzero (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctan_towardzero (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: ctan_towardzero (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++float: 1 ++ifloat: 1 ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctan_towardzero (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++float: 1 ++ifloat: 1 ++ildouble: 4 ++ldouble: 4 ++ ++# ctan_upward ++Test "Real part of: ctan_upward (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i": ++ildouble: 2 ++ldouble: 2 ++Test "Imaginary part of: ctan_upward (0x1.921fb54442d1846ap+0 + 0x1p-16445 i) == -3.986797629811710706723242948653362815645e19 + 5.793882568875674066286163141055208625180e-4912 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: ctan_upward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": ++double: 1 ++idouble: 1 ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctan_upward (0x1.921fb54442d18p+0 + 0x1p-1074 i) == 1.633123935319536975596773704152891653086e16 + 1.317719414943508315995636961402669067843e-291 i": ++ildouble: 4 ++ldouble: 4 ++Test "Real part of: ctan_upward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++double: 2 ++float: 1 ++idouble: 2 ++ifloat: 1 ++ildouble: 2 ++ldouble: 2 ++Test "Imaginary part of: ctan_upward (0x1.921fb6p+0 + 0x1p-149 i) == -2.287733242885645987394874673945769518150e7 + 7.334008549954377778731880988481078535821e-31 i": ++double: 1 ++float: 2 ++idouble: 1 ++ifloat: 2 ++ildouble: 1 ++ldouble: 1 ++ + # ctanh + Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i": + double: 1 +@@ -1359,6 +1446,93 @@ Test "Imaginary part of: ctanh (47 + 1 i) == 1.0 + 2.729321264492904590777293425 + ildouble: 2 + ldouble: 2 + ++# ctanh_downward ++Test "Real part of: ctanh_downward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": ++ildouble: 3 ++ldouble: 3 ++Test "Imaginary part of: ctanh_downward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": ++ildouble: 2 ++ldouble: 2 ++Test "Real part of: ctanh_downward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++float: 1 ++ifloat: 1 ++ildouble: 4 ++ldouble: 4 ++Test "Imaginary part of: ctanh_downward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++double: 2 ++float: 1 ++idouble: 2 ++ifloat: 1 ++ildouble: 3 ++ldouble: 3 ++Test "Imaginary part of: ctanh_downward (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i": ++ildouble: 1 ++ldouble: 1 ++ ++# ctanh_tonearest ++Test "Real part of: ctanh_tonearest (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: ctanh_tonearest (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++float: 1 ++ifloat: 1 ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctanh_tonearest (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++float: 1 ++ifloat: 1 ++Test "Real part of: ctanh_tonearest (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i": ++ildouble: 1 ++ldouble: 1 ++ ++# ctanh_towardzero ++Test "Real part of: ctanh_towardzero (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctanh_towardzero (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: ctanh_towardzero (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++float: 1 ++ifloat: 1 ++ildouble: 4 ++ldouble: 4 ++Test "Imaginary part of: ctanh_towardzero (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++float: 1 ++ifloat: 1 ++ildouble: 1 ++ldouble: 1 ++ ++# ctanh_upward ++Test "Real part of: ctanh_upward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": ++ildouble: 4 ++ldouble: 4 ++Test "Imaginary part of: ctanh_upward (0x1p-1074 + 0x1.921fb54442d18p+0 i) == 1.317719414943508315995636961402669067843e-291 + 1.633123935319536975596773704152891653086e16 i": ++double: 1 ++idouble: 1 ++ildouble: 1 ++ldouble: 1 ++Test "Real part of: ctanh_upward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++double: 1 ++float: 2 ++idouble: 1 ++ifloat: 2 ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctanh_upward (0x1p-149 + 0x1.921fb6p+0 i) == 7.334008549954377778731880988481078535821e-31 - 2.287733242885645987394874673945769518150e7 i": ++double: 2 ++float: 1 ++idouble: 2 ++ifloat: 1 ++ildouble: 2 ++ldouble: 2 ++Test "Real part of: ctanh_upward (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i": ++ildouble: 1 ++ldouble: 1 ++Test "Imaginary part of: ctanh_upward (0x1p-16445 + 0x1.921fb54442d1846ap+0 i) == 5.793882568875674066286163141055208625180e-4912 - 3.986797629811710706723242948653362815645e19 i": ++ildouble: 2 ++ldouble: 2 ++ + # erf + Test "erf (1.25) == 0.922900128256458230136523481197281140": + double: 1 +@@ -2669,6 +2843,58 @@ ifloat: 1 + ildouble: 1 + ldouble: 1 + ++Function: Real part of "ctan_downward": ++double: 2 ++float: 1 ++idouble: 2 ++ifloat: 1 ++ildouble: 3 ++ldouble: 3 ++ ++Function: Imaginary part of "ctan_downward": ++float: 1 ++ifloat: 1 ++ildouble: 4 ++ldouble: 4 ++ ++Function: Real part of "ctan_tonearest": ++float: 1 ++ifloat: 1 ++ ++Function: Imaginary part of "ctan_tonearest": ++float: 1 ++ifloat: 1 ++ildouble: 1 ++ldouble: 1 ++ ++Function: Real part of "ctan_towardzero": ++float: 1 ++ifloat: 1 ++ildouble: 1 ++ldouble: 1 ++ ++Function: Imaginary part of "ctan_towardzero": ++float: 1 ++ifloat: 1 ++ildouble: 4 ++ldouble: 4 ++ ++Function: Real part of "ctan_upward": ++double: 2 ++float: 1 ++idouble: 2 ++ifloat: 1 ++ildouble: 2 ++ldouble: 2 ++ ++Function: Imaginary part of "ctan_upward": ++double: 1 ++float: 2 ++idouble: 1 ++ifloat: 2 ++ildouble: 4 ++ldouble: 4 ++ + Function: Real part of "ctanh": + double: 1 + float: 1 +@@ -2685,6 +2911,58 @@ ifloat: 2 + ildouble: 2 + ldouble: 2 + ++Function: Real part of "ctanh_downward": ++float: 1 ++ifloat: 1 ++ildouble: 4 ++ldouble: 4 ++ ++Function: Imaginary part of "ctanh_downward": ++double: 2 ++float: 1 ++idouble: 2 ++ifloat: 1 ++ildouble: 3 ++ldouble: 3 ++ ++Function: Real part of "ctanh_tonearest": ++float: 1 ++ifloat: 1 ++ildouble: 1 ++ldouble: 1 ++ ++Function: Imaginary part of "ctanh_tonearest": ++float: 1 ++ifloat: 1 ++ ++Function: Real part of "ctanh_towardzero": ++float: 1 ++ifloat: 1 ++ildouble: 4 ++ldouble: 4 ++ ++Function: Imaginary part of "ctanh_towardzero": ++float: 1 ++ifloat: 1 ++ildouble: 1 ++ldouble: 1 ++ ++Function: Real part of "ctanh_upward": ++double: 1 ++float: 2 ++idouble: 1 ++ifloat: 2 ++ildouble: 4 ++ldouble: 4 ++ ++Function: Imaginary part of "ctanh_upward": ++double: 2 ++float: 1 ++idouble: 2 ++ifloat: 1 ++ildouble: 2 ++ldouble: 2 ++ + Function: "erf": + double: 1 + idouble: 1 +-- +1.7.3.4 + diff --git a/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU6778.patch b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU6778.patch new file mode 100644 index 0000000000..55ea69f114 --- /dev/null +++ b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-GNU6778.patch @@ -0,0 +1,357 @@ +From f17ac40d7cb8e8c462476b6ab703262f6b8f6da8 Mon Sep 17 00:00:00 2001 +From: Joseph Myers +Date: Fri, 6 Jul 2012 11:17:41 +0000 +Subject: [PATCH] Fix expm1 spurious underflow exceptions (bug 6778). + +--- + ChangeLog | 21 ++++++++++++++++++ + NEWS | 2 +- + math/libm-test.inc | 24 +++++++++++++++++++- + sysdeps/i386/fpu/e_expl.S | 42 ++++++++++++++++++++++++------------ + sysdeps/i386/fpu/libm-test-ulps | 3 ++ + sysdeps/i386/fpu/s_expm1.S | 24 +++++++++++++++------ + sysdeps/i386/fpu/s_expm1f.S | 24 +++++++++++++++------ + sysdeps/x86_64/fpu/e_expl.S | 42 ++++++++++++++++++++++++------------ + sysdeps/x86_64/fpu/libm-test-ulps | 3 ++ + 9 files changed, 140 insertions(+), 45 deletions(-) + +diff --git a/math/libm-test.inc b/math/libm-test.inc +index 6adbb61..b87a40d 100644 +--- a/math/libm-test.inc ++++ b/math/libm-test.inc +@@ -4039,12 +4039,32 @@ expm1_test (void) + TEST_f_f (expm1, 11356.25L, 9.05128237311923300051376115753226014206e+4931L); + #endif + ++ TEST_f_f (expm1, -10.0, -0.9999546000702375151484644084844394493898L); ++ TEST_f_f (expm1, -16.0, -0.9999998874648252807408854862248209398728L); ++ TEST_f_f (expm1, -17.0, -0.9999999586006228121483334034897228104472L); ++ TEST_f_f (expm1, -18.0, -0.9999999847700202552873715638633707664826L); ++ TEST_f_f (expm1, -36.0, -0.9999999999999997680477169756430611687736L); ++ TEST_f_f (expm1, -37.0, -0.9999999999999999146695237425593420572195L); ++ TEST_f_f (expm1, -38.0, -0.9999999999999999686086720795197037129104L); ++ TEST_f_f (expm1, -44.0, -0.9999999999999999999221886775886620348429L); ++ TEST_f_f (expm1, -45.0, -0.9999999999999999999713748141945060635553L); ++ TEST_f_f (expm1, -46.0, -0.9999999999999999999894693826424461876212L); ++ TEST_f_f (expm1, -73.0, -0.9999999999999999999999999999999802074012L); ++ TEST_f_f (expm1, -74.0, -0.9999999999999999999999999999999927187098L); ++ TEST_f_f (expm1, -75.0, -0.9999999999999999999999999999999973213630L); ++ TEST_f_f (expm1, -78.0, -0.9999999999999999999999999999999998666385L); ++ TEST_f_f (expm1, -79.0, -0.9999999999999999999999999999999999509391L); ++ TEST_f_f (expm1, -80.0, -0.9999999999999999999999999999999999819515L); ++ TEST_f_f (expm1, -100.0, -1.0); ++ TEST_f_f (expm1, -1000.0, -1.0); ++ TEST_f_f (expm1, -10000.0, -1.0); ++ TEST_f_f (expm1, -100000.0, -1.0); ++ + errno = 0; + TEST_f_f (expm1, 100000.0, plus_infty, OVERFLOW_EXCEPTION); + check_int ("errno for expm1(large) == ERANGE", errno, ERANGE, 0, 0, 0); + TEST_f_f (expm1, max_value, plus_infty, OVERFLOW_EXCEPTION); +- /* Bug 6778: spurious underflow exception. */ +- TEST_f_f (expm1, -max_value, -1, UNDERFLOW_EXCEPTION_OK); ++ TEST_f_f (expm1, -max_value, -1); + + END (expm1); + } +diff --git a/sysdeps/i386/fpu/e_expl.S b/sysdeps/i386/fpu/e_expl.S +index bab0a08..e42c9a1 100644 +--- a/sysdeps/i386/fpu/e_expl.S ++++ b/sysdeps/i386/fpu/e_expl.S +@@ -60,10 +60,12 @@ c1: .byte 0x20, 0xfa, 0xee, 0xc2, 0x5f, 0x70, 0xa5, 0xec, 0xed, 0x3f + .byte 0, 0, 0, 0, 0, 0 + ASM_SIZE_DIRECTIVE(c1) + #endif ++#ifndef USE_AS_EXPM1L + ASM_TYPE_DIRECTIVE(csat,@object) + csat: .byte 0, 0, 0, 0, 0, 0, 0, 0x80, 0x0e, 0x40 + .byte 0, 0, 0, 0, 0, 0 + ASM_SIZE_DIRECTIVE(csat) ++#endif + + #ifdef PIC + # define MO(op) op##@GOTOFF(%ecx) +@@ -88,9 +90,26 @@ ENTRY(IEEE754_EXPL) + #ifdef PIC + LOAD_PIC_REG (cx) + #endif +-#ifndef USE_AS_EXPM1L ++#ifdef USE_AS_EXPM1L ++ xorb $0x80, %ah ++ cmpl $0xc006, %eax ++ fstsw %ax ++ movb $0x45, %dh ++ jb 4f ++ ++ /* Below -64.0 (may be -NaN or -Inf). */ ++ andb %ah, %dh ++ cmpb $0x01, %dh ++ je 2f /* Is +-NaN, jump. */ ++ jmp 1f /* -large, possibly -Inf. */ ++ ++4: /* In range -64.0 to 64.0 (may be +-0 but not NaN or +-Inf). */ ++ /* Test for +-0 as argument. */ ++ andb %ah, %dh ++ cmpb $0x40, %dh ++ je 2f ++#else + movzwl 4+8(%esp), %eax +-#endif + andl $0x7fff, %eax + cmpl $0x400d, %eax + jle 3f +@@ -108,16 +127,8 @@ ENTRY(IEEE754_EXPL) + andb $2, %ah + jz 3f + fchs +-3: +-#ifdef USE_AS_EXPM1L +- /* Test for +-0 as argument. */ +- fstsw %ax +- movb $0x45, %dh +- andb %ah, %dh +- cmpb $0x40, %dh +- je 2f + #endif +- FLDLOG /* 1 log2(base) */ ++3: FLDLOG /* 1 log2(base) */ + fmul %st(1), %st /* 1 x log2(base) */ + frndint /* 1 i */ + fld %st(1) /* 2 x */ +@@ -154,13 +165,16 @@ ENTRY(IEEE754_EXPL) + #endif + fstp %st(1) /* 0 */ + jmp 2f +-1: testl $0x200, %eax /* Test sign. */ +- jz 2f /* If positive, jump. */ +- fstp %st ++1: + #ifdef USE_AS_EXPM1L ++ /* For expm1l, only negative sign gets here. */ ++ fstp %st + fld1 + fchs + #else ++ testl $0x200, %eax /* Test sign. */ ++ jz 2f /* If positive, jump. */ ++ fstp %st + fldz /* Set result to 0. */ + #endif + 2: ret +diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps +index 9724919..ab02bde 100644 +--- a/sysdeps/i386/fpu/libm-test-ulps ++++ b/sysdeps/i386/fpu/libm-test-ulps +@@ -1779,6 +1779,9 @@ idouble: 1 + ifloat: 1 + + # expm1 ++Test "expm1 (-45.0) == -0.9999999999999999999713748141945060635553": ++ildouble: 1 ++ldouble: 1 + Test "expm1 (1) == M_El - 1.0": + ildouble: 1 + Test "expm1 (11356.25) == 9.05128237311923300051376115753226014206e+4931": +diff --git a/sysdeps/i386/fpu/s_expm1.S b/sysdeps/i386/fpu/s_expm1.S +index 9883f9b..d2754de 100644 +--- a/sysdeps/i386/fpu/s_expm1.S ++++ b/sysdeps/i386/fpu/s_expm1.S +@@ -51,19 +51,31 @@ ENTRY(__expm1) + jae HIDDEN_JUMPTARGET (__exp) + + fldl 4(%esp) // x +- fxam // Is NaN or +-Inf? ++ fxam // Is NaN, +-Inf or +-0? ++ xorb $0x80, %ah ++ cmpl $0xc043, %eax // is num <= -38.0? + fstsw %ax + movb $0x45, %ch ++ jb 4f ++ ++ // Below -38.0 (may be -NaN or -Inf). ++ andb %ah, %ch ++#ifdef PIC ++ LOAD_PIC_REG (dx) ++#endif ++ cmpb $0x01, %ch ++ je 5f // If -NaN, jump. ++ jmp 2f // -large, possibly -Inf. ++ ++4: // In range -38.0 to 704.0 (may be +-0 but not NaN or +-Inf). + andb %ah, %ch + cmpb $0x40, %ch + je 3f // If +-0, jump. + #ifdef PIC + LOAD_PIC_REG (dx) + #endif +- cmpb $0x05, %ch +- je 2f // If +-Inf, jump. + +- fldt MO(l2e) // log2(e) : x ++5: fldt MO(l2e) // log2(e) : x + fmulp // log2(e)*x + fld %st // log2(e)*x : log2(e)*x + frndint // int(log2(e)*x) : log2(e)*x +@@ -79,9 +91,7 @@ ENTRY(__expm1) + fsubrp %st, %st(1) // 2^(log2(e)*x) + ret + +-2: testl $0x200, %eax // Test sign. +- jz 3f // If positive, jump. +- fstp %st ++2: fstp %st + fldl MO(minus1) // Set result to -1.0. + 3: ret + END(__expm1) +diff --git a/sysdeps/i386/fpu/s_expm1f.S b/sysdeps/i386/fpu/s_expm1f.S +index 45257d7..fc82b92 100644 +--- a/sysdeps/i386/fpu/s_expm1f.S ++++ b/sysdeps/i386/fpu/s_expm1f.S +@@ -51,19 +51,31 @@ ENTRY(__expm1f) + jae HIDDEN_JUMPTARGET (__expf) + + flds 4(%esp) // x +- fxam // Is NaN or +-Inf? ++ fxam // Is NaN, +-Inf or +-0? ++ xorb $0x80, %ah ++ cmpl $0xc190, %eax // is num <= -18.0? + fstsw %ax + movb $0x45, %ch ++ jb 4f ++ ++ // Below -18.0 (may be -NaN or -Inf). ++ andb %ah, %ch ++#ifdef PIC ++ LOAD_PIC_REG (dx) ++#endif ++ cmpb $0x01, %ch ++ je 5f // If -NaN, jump. ++ jmp 2f // -large, possibly -Inf. ++ ++4: // In range -18.0 to 88.5 (may be +-0 but not NaN or +-Inf). + andb %ah, %ch + cmpb $0x40, %ch + je 3f // If +-0, jump. + #ifdef PIC + LOAD_PIC_REG (dx) + #endif +- cmpb $0x05, %ch +- je 2f // If +-Inf, jump. + +- fldt MO(l2e) // log2(e) : x ++5: fldt MO(l2e) // log2(e) : x + fmulp // log2(e)*x + fld %st // log2(e)*x : log2(e)*x + frndint // int(log2(e)*x) : log2(e)*x +@@ -79,9 +91,7 @@ ENTRY(__expm1f) + fsubrp %st, %st(1) // 2^(log2(e)*x) + ret + +-2: testl $0x200, %eax // Test sign. +- jz 3f // If positive, jump. +- fstp %st ++2: fstp %st + fldl MO(minus1) // Set result to -1.0. + 3: ret + END(__expm1f) +diff --git a/sysdeps/x86_64/fpu/e_expl.S b/sysdeps/x86_64/fpu/e_expl.S +index e6b842b..1c37c86 100644 +--- a/sysdeps/x86_64/fpu/e_expl.S ++++ b/sysdeps/x86_64/fpu/e_expl.S +@@ -60,10 +60,12 @@ c1: .byte 0x20, 0xfa, 0xee, 0xc2, 0x5f, 0x70, 0xa5, 0xec, 0xed, 0x3f + .byte 0, 0, 0, 0, 0, 0 + ASM_SIZE_DIRECTIVE(c1) + #endif ++#ifndef USE_AS_EXPM1L + ASM_TYPE_DIRECTIVE(csat,@object) + csat: .byte 0, 0, 0, 0, 0, 0, 0, 0x80, 0x0e, 0x40 + .byte 0, 0, 0, 0, 0, 0 + ASM_SIZE_DIRECTIVE(csat) ++#endif + + #ifdef PIC + # define MO(op) op##(%rip) +@@ -85,9 +87,26 @@ ENTRY(IEEE754_EXPL) + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ +-#ifndef USE_AS_EXPM1L ++#ifdef USE_AS_EXPM1L ++ xorb $0x80, %ah ++ cmpl $0xc006, %eax ++ fstsw %ax ++ movb $0x45, %dh ++ jb 4f ++ ++ /* Below -64.0 (may be -NaN or -Inf). */ ++ andb %ah, %dh ++ cmpb $0x01, %dh ++ je 2f /* Is +-NaN, jump. */ ++ jmp 1f /* -large, possibly -Inf. */ ++ ++4: /* In range -64.0 to 64.0 (may be +-0 but not NaN or +-Inf). */ ++ /* Test for +-0 as argument. */ ++ andb %ah, %dh ++ cmpb $0x40, %dh ++ je 2f ++#else + movzwl 8+8(%rsp), %eax +-#endif + andl $0x7fff, %eax + cmpl $0x400d, %eax + jle 3f +@@ -105,16 +124,8 @@ ENTRY(IEEE754_EXPL) + andb $2, %ah + jz 3f + fchs +-3: +-#ifdef USE_AS_EXPM1L +- /* Test for +-0 as argument. */ +- fstsw %ax +- movb $0x45, %dh +- andb %ah, %dh +- cmpb $0x40, %dh +- je 2f + #endif +- FLDLOG /* 1 log2(base) */ ++3: FLDLOG /* 1 log2(base) */ + fmul %st(1), %st /* 1 x log2(base) */ + frndint /* 1 i */ + fld %st(1) /* 2 x */ +@@ -151,13 +162,16 @@ ENTRY(IEEE754_EXPL) + #endif + fstp %st(1) /* 0 */ + jmp 2f +-1: testl $0x200, %eax /* Test sign. */ +- jz 2f /* If positive, jump. */ +- fstp %st ++1: + #ifdef USE_AS_EXPM1L ++ /* For expm1l, only negative sign gets here. */ ++ fstp %st + fld1 + fchs + #else ++ testl $0x200, %eax /* Test sign. */ ++ jz 2f /* If positive, jump. */ ++ fstp %st + fldz /* Set result to 0. */ + #endif + 2: ret +diff --git a/sysdeps/x86_64/fpu/libm-test-ulps b/sysdeps/x86_64/fpu/libm-test-ulps +index b64e52d..be28024 100644 +--- a/sysdeps/x86_64/fpu/libm-test-ulps ++++ b/sysdeps/x86_64/fpu/libm-test-ulps +@@ -1657,6 +1657,9 @@ float: 1 + ifloat: 1 + + # expm1 ++Test "expm1 (-45.0) == -0.9999999999999999999713748141945060635553": ++ildouble: 1 ++ldouble: 1 + Test "expm1 (0.75) == 1.11700001661267466854536981983709561": + double: 1 + idouble: 1 +-- +1.7.3.4 + diff --git a/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-fix_rpc_bootstrap_builds.patch b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-fix_rpc_bootstrap_builds.patch new file mode 100644 index 0000000000..3d7a25c156 --- /dev/null +++ b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-fix_rpc_bootstrap_builds.patch @@ -0,0 +1,41 @@ +From fb21f89b75d0152aa42efb6b620843799a4cd76b Mon Sep 17 00:00:00 2001 +From: Mike Frysinger +Date: Tue, 3 Jul 2012 15:22:05 -0400 +Subject: [PATCH] sunrpc: fix rpc bootstrap builds + +If you build & install glibc w/rpc disabled, you no longer have headers in +/usr/include/rpc/ (this is expected). But if you try to build glibc w/rpc +enabled, this gets into a bad state due to the new rpc helpers that get +cross-compiled: + +$ make +... +x86_64-pc-linux-gnu-gcc -m32 -D_RPC_THREAD_SAFE_ -D_GNU_SOURCE -DIS_IN_build \ + -include $objdir/config.h rpc_clntout.c -o $objdir/sunrpc/cross-rpc_clntout.o \ + -MMD -MP -MF $objdir/sunrpc/cross-rpc_clntout.o.dt -MT $objdir/sunrpc/cross-rpc_clntout.o -c +rpc_clntout.c:34:23: fatal error: rpc/types.h: No such file or directory +compilation terminated. +make: *** [$objdir/sunrpc/cross-rpc_clntout.o] Error 1 + +Signed-off-by: Mike Frysinger +--- + ChangeLog | 4 ++++ + sunrpc/rpc_clntout.c | 2 +- + 2 files changed, 5 insertions(+), 1 deletions(-) + +diff --git a/sunrpc/rpc_clntout.c b/sunrpc/rpc_clntout.c +index ec040c7..ce4d2a4 100644 +--- a/sunrpc/rpc_clntout.c ++++ b/sunrpc/rpc_clntout.c +@@ -31,7 +31,7 @@ + */ + #include + #include +-#include ++#include "rpc/types.h" + #include "rpc_parse.h" + #include "rpc_util.h" + #include "proto.h" +-- +1.7.3.4 + diff --git a/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-libgcc_eh_arm.patch b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-libgcc_eh_arm.patch new file mode 100644 index 0000000000..d0ca542676 --- /dev/null +++ b/packages/toolchain/devel/eglibc/patches/eglibc-2.16-19673-libgcc_eh_arm.patch @@ -0,0 +1,27 @@ +From c57a67e03368687fc0d2ae8354cd1b347a61ea44 Mon Sep 17 00:00:00 2001 +From: Joseph Myers +Date: Thu, 5 Jul 2012 22:16:03 +0000 +Subject: [PATCH] Add ARM-specific static-stubs.c. + +--- + ports/ChangeLog.arm | 4 ++++ + ports/sysdeps/arm/static-stubs.c | 7 +++++++ + 2 files changed, 11 insertions(+), 0 deletions(-) + create mode 100644 ports/sysdeps/arm/static-stubs.c + +diff --git a/ports/sysdeps/arm/static-stubs.c b/ports/sysdeps/arm/static-stubs.c +new file mode 100644 +index 0000000..d90d603 +--- /dev/null ++++ b/ports/sysdeps/arm/static-stubs.c +@@ -0,0 +1,7 @@ ++/* When building with GCC with static-only libgcc, the dummy ++ _Unwind_Resume from static-stubs.c needs to be used together with ++ the dummy __aeabi_unwind_cpp_pr* from aeabi_unwind_cpp_pr1.c ++ instead of the copies from libgcc. */ ++ ++#include ++#include +-- +1.7.3.4 +