This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.23-440-g9bd3ef8
- From: jsm28 at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 8 Jun 2016 21:55:32 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.23-440-g9bd3ef8
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 9bd3ef8e19b19fb3cfcf99a33a1493035891b990 (commit)
from 9946e7a949d3b0f2795d930aa2f2ce7bda5e4f8a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=9bd3ef8e19b19fb3cfcf99a33a1493035891b990
commit 9bd3ef8e19b19fb3cfcf99a33a1493035891b990
Author: Joseph Myers <joseph@codesourcery.com>
Date: Wed Jun 8 21:55:06 2016 +0000
Fix i386/x86_64 expl, exp10l, expm1l for sNaN input (bug 20226).
The i386 and x86_64 implementations of expl, exp10l and expm1l (code
shared between the functions) return sNaN for sNaN input. This patch
fixes them to add NaN inputs to themselves so that qNaN is returned in
this case.
Tested for x86_64 and x86.
[BZ #20226]
* sysdeps/i386/fpu/e_expl.S (IEEE754_EXPL): Add NaN argument to
itself.
* sysdeps/x86_64/fpu/e_expl.S (IEEE754_EXPL): Likewise.
* math/libm-test.inc (exp_test_data): Add sNaN tests.
(exp10_test_data): Likewise.
(expm1_test_data): Likewise.
diff --git a/ChangeLog b/ChangeLog
index cf5e480..0d140aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2016-06-08 Joseph Myers <joseph@codesourcery.com>
+ [BZ #20226]
+ * sysdeps/i386/fpu/e_expl.S (IEEE754_EXPL): Add NaN argument to
+ itself.
+ * sysdeps/x86_64/fpu/e_expl.S (IEEE754_EXPL): Likewise.
+ * math/libm-test.inc (exp_test_data): Add sNaN tests.
+ (exp10_test_data): Likewise.
+ (expm1_test_data): Likewise.
+
[BZ #20225]
* math/s_ldexp.c (__ldexp): Add non-finite or zero argument to
itself.
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 583c27c..35a256c 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -6992,6 +6992,8 @@ static const struct test_f_f_data exp_test_data[] =
TEST_f_f (exp, minus_infty, 0, ERRNO_UNCHANGED|NO_TEST_INLINE),
TEST_f_f (exp, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_f_f (exp, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+ TEST_f_f (exp, snan_value, qnan_value, INVALID_EXCEPTION),
+ TEST_f_f (exp, -snan_value, qnan_value, INVALID_EXCEPTION),
AUTO_TESTS_f_f (exp),
};
@@ -7009,6 +7011,8 @@ static const struct test_f_f_data exp10_test_data[] =
TEST_f_f (exp10, minus_infty, 0, ERRNO_UNCHANGED),
TEST_f_f (exp10, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_f_f (exp10, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+ TEST_f_f (exp10, snan_value, qnan_value, INVALID_EXCEPTION),
+ TEST_f_f (exp10, -snan_value, qnan_value, INVALID_EXCEPTION),
AUTO_TESTS_f_f (exp10),
};
@@ -7052,6 +7056,8 @@ static const struct test_f_f_data expm1_test_data[] =
TEST_f_f (expm1, minus_infty, -1, ERRNO_UNCHANGED|NO_TEST_INLINE),
TEST_f_f (expm1, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
TEST_f_f (expm1, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+ TEST_f_f (expm1, snan_value, qnan_value, INVALID_EXCEPTION),
+ TEST_f_f (expm1, -snan_value, qnan_value, INVALID_EXCEPTION),
AUTO_TESTS_f_f (expm1),
};
diff --git a/sysdeps/i386/fpu/e_expl.S b/sysdeps/i386/fpu/e_expl.S
index 64e0d96..7d75fe2 100644
--- a/sysdeps/i386/fpu/e_expl.S
+++ b/sysdeps/i386/fpu/e_expl.S
@@ -102,7 +102,7 @@ ENTRY(IEEE754_EXPL)
/* Below -64.0 (may be -NaN or -Inf). */
andb %ah, %dh
cmpb $0x01, %dh
- je 2f /* Is +-NaN, jump. */
+ je 6f /* Is +-NaN, jump. */
jmp 1f /* -large, possibly -Inf. */
4: /* In range -64.0 to 64.0 (may be +-0 but not NaN or +-Inf). */
@@ -144,7 +144,7 @@ ENTRY(IEEE754_EXPL)
cmpb $0x05, %dh
je 1f /* Is +-Inf, jump. */
cmpb $0x01, %dh
- je 2f /* Is +-NaN, jump. */
+ je 6f /* Is +-NaN, jump. */
/* Overflow or underflow; saturate. */
fstp %st
fldt MO(csat)
@@ -214,6 +214,9 @@ ENTRY(IEEE754_EXPL)
fldz /* Set result to 0. */
#endif
2: ret
+6: /* NaN argument. */
+ fadd %st
+ ret
END(IEEE754_EXPL)
#ifdef USE_AS_EXPM1L
libm_hidden_def (__expm1l)
diff --git a/sysdeps/x86_64/fpu/e_expl.S b/sysdeps/x86_64/fpu/e_expl.S
index 8b3ddae..a4ef023 100644
--- a/sysdeps/x86_64/fpu/e_expl.S
+++ b/sysdeps/x86_64/fpu/e_expl.S
@@ -99,7 +99,7 @@ ENTRY(IEEE754_EXPL)
/* Below -64.0 (may be -NaN or -Inf). */
andb %ah, %dh
cmpb $0x01, %dh
- je 2f /* Is +-NaN, jump. */
+ je 6f /* Is +-NaN, jump. */
jmp 1f /* -large, possibly -Inf. */
4: /* In range -64.0 to 64.0 (may be +-0 but not NaN or +-Inf). */
@@ -141,7 +141,7 @@ ENTRY(IEEE754_EXPL)
cmpb $0x05, %dh
je 1f /* Is +-Inf, jump. */
cmpb $0x01, %dh
- je 2f /* Is +-NaN, jump. */
+ je 6f /* Is +-NaN, jump. */
/* Overflow or underflow; saturate. */
fstp %st
fldt MO(csat)
@@ -207,6 +207,9 @@ ENTRY(IEEE754_EXPL)
fldz /* Set result to 0. */
#endif
2: ret
+6: /* NaN argument. */
+ fadd %st
+ ret
END(IEEE754_EXPL)
#ifdef USE_AS_EXPM1L
libm_hidden_def (__expm1l)
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 8 ++++++++
math/libm-test.inc | 6 ++++++
sysdeps/i386/fpu/e_expl.S | 7 +++++--
sysdeps/x86_64/fpu/e_expl.S | 7 +++++--
4 files changed, 24 insertions(+), 4 deletions(-)
hooks/post-receive
--
GNU C Library master sources