gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-663


From: Andrew J. Schorr
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-663-ge934ad6
Date: Thu, 16 Apr 2015 16:43:49 +0000

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 "gawk".

The branch, gawk-4.1-stable has been updated
       via  e934ad609d3639152324a4211857d87f228cf938 (commit)
      from  09ca6ca91db4fd691c4107419c5a4d3f99ae569e (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://git.sv.gnu.org/cgit/gawk.git/commit/?id=e934ad609d3639152324a4211857d87f228cf938

commit e934ad609d3639152324a4211857d87f228cf938
Author: Andrew J. Schorr <address@hidden>
Date:   Thu Apr 16 12:43:07 2015 -0400

    When strtod sets errno, force the numeric value to zero.

diff --git a/ChangeLog b/ChangeLog
index fcf646a..0fa04f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2015-04-16         Andrew J. Schorr     <address@hidden>
+
+       * node.c (r_force_number): If strtod sets errno, then force the
+       numeric value in node->numbr to zero. For subnormal values, strtod
+       sets errno but does not return zero, and we don't want to retain
+       those subnormal values.
+
 2015-04-16         Arnold D. Robbins     <address@hidden>
 
        * builtin.c (do_strftime): Use a double for the timestamp and
diff --git a/node.c b/node.c
index f19354e..1741a13 100644
--- a/node.c
+++ b/node.c
@@ -138,11 +138,20 @@ r_force_number(NODE *n)
                ptr++;
        *cpend = save;
 finish:
-       if (errno == 0 && ptr == cpend) {
-               n->flags |= newflags;
-               n->flags |= NUMCUR;
+       if (errno == 0) {
+               if (ptr == cpend) {
+                       n->flags |= newflags;
+                       n->flags |= NUMCUR;
+               }
+               /* else keep the leading numeric value without updating flags */
        } else {
                errno = 0;
+               /*
+                * N.B. For subnormal values, strtod may return the
+                * floating-point representation while setting errno to ERANGE.
+                * We force the numeric value to 0 in such cases.
+                */
+               n->numbr = 0;
        }
 
        return n;

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

Summary of changes:
 ChangeLog |    7 +++++++
 node.c    |   15 ++++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]