This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch master updated. glibc-2.23-439-g9946e7a


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  9946e7a949d3b0f2795d930aa2f2ce7bda5e4f8a (commit)
      from  40720ec9f98d57214d73d6fa98019e684f2eb45a (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=9946e7a949d3b0f2795d930aa2f2ce7bda5e4f8a

commit 9946e7a949d3b0f2795d930aa2f2ce7bda5e4f8a
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Wed Jun 8 21:32:57 2016 +0000

    Fix ldexp, scalbn, scalbln for sNaN input (bug 20225).
    
    The wrapper implementations of ldexp / scalbn / scalbln
    (architecture-independent), and their float / long double variants,
    return sNaN for sNaN input.  This patch fixes them to add relevant
    arguments to themselves so that qNaN is returned in this case.
    
    Tested for x86_64 and x86.
    
    	[BZ #20225]
    	* math/s_ldexp.c (__ldexp): Add non-finite or zero argument to
    	itself.
    	* math/s_ldexpf.c (__ldexpf): Likewise.
    	* math/s_ldexpl.c (__ldexpl): Likewise.
    	* math/w_scalbln.c (__w_scalbln): Likewise.
    	* math/w_scalblnf.c (__w_scalblnf): Likewise.
    	* math/w_scalblnl.c (__w_scalblnl): Likewise.
    	* math/libm-test.inc (scalbn_test_data): Add sNaN tests.
    	(scalbln_test_data): Likewise.

diff --git a/ChangeLog b/ChangeLog
index 2015168..cf5e480 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2016-06-08  Joseph Myers  <joseph@codesourcery.com>
 
+	[BZ #20225]
+	* math/s_ldexp.c (__ldexp): Add non-finite or zero argument to
+	itself.
+	* math/s_ldexpf.c (__ldexpf): Likewise.
+	* math/s_ldexpl.c (__ldexpl): Likewise.
+	* math/w_scalbln.c (__w_scalbln): Likewise.
+	* math/w_scalblnf.c (__w_scalblnf): Likewise.
+	* math/w_scalblnl.c (__w_scalblnl): Likewise.
+	* math/libm-test.inc (scalbn_test_data): Add sNaN tests.
+	(scalbln_test_data): Likewise.
+
 	[BZ #20224]
 	* sysdeps/i386/fpu/s_cbrtl.S (__cbrtl): Add non-finite or zero
 	argument to itself.
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 520f141..583c27c 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -11117,6 +11117,8 @@ static const struct test_fi_f_data scalbn_test_data[] =
     TEST_fi_f (scalbn, minus_infty, 1, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_fi_f (scalbn, qnan_value, 1, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_fi_f (scalbn, -qnan_value, 1, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_fi_f (scalbn, snan_value, 1, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_fi_f (scalbn, -snan_value, 1, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
 
     TEST_fi_f (scalbn, 0.8L, 4, 12.8L, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_fi_f (scalbn, -0.854375L, 5, -27.34L, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
@@ -11199,6 +11201,8 @@ static const struct test_fl_f_data scalbln_test_data[] =
     TEST_fl_f (scalbln, minus_infty, 1, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_fl_f (scalbln, qnan_value, 1, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_fl_f (scalbln, -qnan_value, 1, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_fl_f (scalbln, snan_value, 1, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_fl_f (scalbln, -snan_value, 1, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
 
     TEST_fl_f (scalbln, 0.8L, 4, 12.8L, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
     TEST_fl_f (scalbln, -0.854375L, 5, -27.34L, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
diff --git a/math/s_ldexp.c b/math/s_ldexp.c
index 0248ba2..ee53695 100644
--- a/math/s_ldexp.c
+++ b/math/s_ldexp.c
@@ -20,7 +20,7 @@ static char rcsid[] = "$NetBSD: s_ldexp.c,v 1.6 1995/05/10 20:47:40 jtc Exp $";
 
 double __ldexp(double value, int exp)
 {
-	if(!isfinite(value)||value==0.0) return value;
+	if(!isfinite(value)||value==0.0) return value + value;
 	value = __scalbn(value,exp);
 	if(!isfinite(value)||value==0.0) __set_errno (ERANGE);
 	return value;
diff --git a/math/s_ldexpf.c b/math/s_ldexpf.c
index 37af880..b83062f 100644
--- a/math/s_ldexpf.c
+++ b/math/s_ldexpf.c
@@ -23,7 +23,7 @@ static char rcsid[] = "$NetBSD: s_ldexpf.c,v 1.3 1995/05/10 20:47:42 jtc Exp $";
 
 float __ldexpf(float value, int exp)
 {
-	if(!isfinite(value)||value==(float)0.0) return value;
+	if(!isfinite(value)||value==(float)0.0) return value + value;
 	value = __scalbnf(value,exp);
 	if(!isfinite(value)||value==(float)0.0) __set_errno (ERANGE);
 	return value;
diff --git a/math/s_ldexpl.c b/math/s_ldexpl.c
index f34c805..52fb093 100644
--- a/math/s_ldexpl.c
+++ b/math/s_ldexpl.c
@@ -24,7 +24,7 @@ static char rcsid[] = "$NetBSD: $";
 
 long double __ldexpl(long double value, int exp)
 {
-	if(!isfinite(value)||value==0.0) return value;
+	if(!isfinite(value)||value==0.0) return value + value;
 	value = __scalbnl(value,exp);
 	if(!isfinite(value)||value==0.0) __set_errno (ERANGE);
 	return value;
diff --git a/math/w_scalbln.c b/math/w_scalbln.c
index 4a309b9..bcc3319 100644
--- a/math/w_scalbln.c
+++ b/math/w_scalbln.c
@@ -24,7 +24,7 @@ double
 __w_scalbln (double x, long int n)
 {
   if (!isfinite (x) || x == 0.0)
-    return x;
+    return x + x;
 
   x = __scalbln (x, n);
 
diff --git a/math/w_scalblnf.c b/math/w_scalblnf.c
index de4dc47..2a0b237 100644
--- a/math/w_scalblnf.c
+++ b/math/w_scalblnf.c
@@ -24,7 +24,7 @@ float
 __w_scalblnf (float x, long int n)
 {
   if (!isfinite (x) || x == 0.0f)
-    return x;
+    return x + x;
 
   x = __scalblnf (x, n);
 
diff --git a/math/w_scalblnl.c b/math/w_scalblnl.c
index 323abbe..8ee8130 100644
--- a/math/w_scalblnl.c
+++ b/math/w_scalblnl.c
@@ -24,7 +24,7 @@ long double
 __w_scalblnl (long double x, long int n)
 {
   if (!isfinite (x) || x == 0.0L)
-    return x;
+    return x + x;
 
   x = __scalblnl (x, n);
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog          |   11 +++++++++++
 math/libm-test.inc |    4 ++++
 math/s_ldexp.c     |    2 +-
 math/s_ldexpf.c    |    2 +-
 math/s_ldexpl.c    |    2 +-
 math/w_scalbln.c   |    2 +-
 math/w_scalblnf.c  |    2 +-
 math/w_scalblnl.c  |    2 +-
 8 files changed, 21 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]