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.24-34-gcb864fe


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  cb864fe0ecb52bff2961bfaffd5823a49bfdff01 (commit)
      from  412ac69ba93058b22d9cee3bf8d3f2a5df2a142e (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=cb864fe0ecb52bff2961bfaffd5823a49bfdff01

commit cb864fe0ecb52bff2961bfaffd5823a49bfdff01
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Thu Aug 4 20:50:31 2016 +0000

    Do not call __nan in scalb functions.
    
    When libm functions return a NaN: if it is for NaN input, it should be
    computed from that input (e.g. adding it to itself), so that payloads
    are propagated and signaling NaNs quieted, while if it is for non-NaN
    input, it should be produced by a computation such as
    (x - x) / (x - x), which raises "invalid" at the same time as
    producing an appropriate NaN, so avoiding any need for a call to
    feraiseexcept.
    
    Various libm functions, however, call __nan ("") (or __nanf or __nanl)
    to determine the NaN to return, together with using feraiseexcept
    (FE_INVALID) to raise the exception.  sysdeps/generic/math_private.h
    has an optimization for those functions with constant "" argument so
    this doesn't actually involve a call to the __nan function, but it is
    still not the preferred approach for producing NaNs.  (The optimized
    code also always uses the NAN macro, i.e. produces a default NaN for
    float converted to whatever the target type is, and on some
    architectures that may not be the same as the preferred default NaN
    for double or long double.)
    
    This patch fixes the scalb functions to use the conventional method of
    generating NaNs and raising "invalid" with an appropriate
    computation.  (Most instances of this issue are in the complex
    functions, where it can more readily be fixed once they have been made
    type-generic and so only a third as many places need fixing.  Some of
    the complex functions use __nan ("") + __nan (""), where the addition
    serves no purpose whatsoever.)
    
    Tested for x86_64 and x86.
    
    	* math/e_scalb.c: Do not include <fenv.h>.
    	(invalid_fn): Do calculation resulting in NaN instead of raising
    	FE_INVALID and returning a NaN explicitly.
    	* math/e_scalbf.c: Do not include <fenv.h>.
    	(invalid_fn): Do calculation resulting in NaN instead of raising
    	FE_INVALID and returning a NaN explicitly.
    	* math/e_scalbl.c: Do not include <fenv.h>.
    	(invalid_fn): Do calculation resulting in NaN instead of raising
    	FE_INVALID and returning a NaN explicitly.

diff --git a/ChangeLog b/ChangeLog
index e2e5317..1e63a38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2016-08-04  Joseph Myers  <joseph@codesourcery.com>
+
+	* math/e_scalb.c: Do not include <fenv.h>.
+	(invalid_fn): Do calculation resulting in NaN instead of raising
+	FE_INVALID and returning a NaN explicitly.
+	* math/e_scalbf.c: Do not include <fenv.h>.
+	(invalid_fn): Do calculation resulting in NaN instead of raising
+	FE_INVALID and returning a NaN explicitly.
+	* math/e_scalbl.c: Do not include <fenv.h>.
+	(invalid_fn): Do calculation resulting in NaN instead of raising
+	FE_INVALID and returning a NaN explicitly.
+
 2016-08-04  Carlos O'Donell  <carlos@redhat.com>
 
 	* po/de.po: Updated from Translation Project.
diff --git a/math/e_scalb.c b/math/e_scalb.c
index 7f61ce0..692f105 100644
--- a/math/e_scalb.c
+++ b/math/e_scalb.c
@@ -16,7 +16,6 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <fenv.h>
 #include <math.h>
 #include <math_private.h>
 
@@ -26,10 +25,7 @@ __attribute__ ((noinline))
 invalid_fn (double x, double fn)
 {
   if (__rint (fn) != fn)
-    {
-      __feraiseexcept (FE_INVALID);
-      return __nan ("");
-    }
+    return (fn - fn) / (fn - fn);
   else if (fn > 65000.0)
     return __scalbn (x, 65000);
   else
diff --git a/math/e_scalbf.c b/math/e_scalbf.c
index 7377f6e..8df86f4 100644
--- a/math/e_scalbf.c
+++ b/math/e_scalbf.c
@@ -16,7 +16,6 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <fenv.h>
 #include <math.h>
 #include <math_private.h>
 
@@ -26,10 +25,7 @@ __attribute__ ((noinline))
 invalid_fn (float x, float fn)
 {
   if (__rintf (fn) != fn)
-    {
-      feraiseexcept (FE_INVALID);
-      return __nan ("");
-    }
+    return (fn - fn) / (fn - fn);
   else if (fn > 65000.0f)
     return __scalbnf (x, 65000);
   else
diff --git a/math/e_scalbl.c b/math/e_scalbl.c
index 53e9ca2..02956ac 100644
--- a/math/e_scalbl.c
+++ b/math/e_scalbl.c
@@ -16,7 +16,6 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <fenv.h>
 #include <math.h>
 #include <math_private.h>
 
@@ -26,10 +25,7 @@ __attribute__ ((noinline))
 invalid_fn (long double x, long double fn)
 {
   if (__rintl (fn) != fn)
-    {
-      feraiseexcept (FE_INVALID);
-      return __nan ("");
-    }
+    return (fn - fn) / (fn - fn);
   else if (fn > 65000.0L)
     return __scalbnl (x, 65000);
   else

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

Summary of changes:
 ChangeLog       |   12 ++++++++++++
 math/e_scalb.c  |    6 +-----
 math/e_scalbf.c |    6 +-----
 math/e_scalbl.c |    6 +-----
 4 files changed, 15 insertions(+), 15 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]