[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gawk] gawk erroneous comparison with large negative exponents
From: |
Aharon Robbins |
Subject: |
Re: [bug-gawk] gawk erroneous comparison with large negative exponents |
Date: |
Thu, 16 Apr 2015 22:54:25 +0300 |
User-agent: |
Heirloom mailx 12.5 6/20/10 |
Hi Andy.
I see your point. I think this patch accomplishes what we'd like to see
happen. Your debug patch shows that NUMCUR gets set, and 'make check'
passes. (BTW, flags2str() lets you see the flags in a reasonable fashion.)
W.R.T. NUMBER - the code sets it correctly, which is only when MAYBE_NUM
is true. MAYBE_NUM is true for stuff that came from the user and is
character data but should be treated like a number if it looks like one,
such as the fields.
Thoughts?
Arnold
---------------------------------------------------
diff --git a/node.c b/node.c
index 1741a13..c34e6a9 100644
--- a/node.c
+++ b/node.c
@@ -139,7 +139,13 @@ r_force_number(NODE *n)
*cpend = save;
finish:
if (errno == 0) {
- if (ptr == cpend) {
+ /*
+ * If converted the whole string, or it stopped at a
+ * character that can't be part of a number, then set
+ * NUMCUR flag.
+ */
+ if ( ptr == cpend
+ || (ptr > cp && strchr("0123456789.+-eE", *ptr) == NULL)) {
n->flags |= newflags;
n->flags |= NUMCUR;
}
- [bug-gawk] gawk erroneous comparison with large negative exponents, Sol Katzman, 2015/04/09
- Re: [bug-gawk] gawk erroneous comparison with large negative exponents, Aharon Robbins, 2015/04/13
- Re: [bug-gawk] gawk erroneous comparison with large negative exponents, Andrew J. Schorr, 2015/04/13
- Re: [bug-gawk] gawk erroneous comparison with large negative exponents, Aharon Robbins, 2015/04/14
- Re: [bug-gawk] gawk erroneous comparison with large negative exponents, Andrew J. Schorr, 2015/04/14
- Re: [bug-gawk] gawk erroneous comparison with large negative exponents, Andrew J. Schorr, 2015/04/14
- Re: [bug-gawk] gawk erroneous comparison with large negative exponents, Aharon Robbins, 2015/04/16
- Re: [bug-gawk] gawk erroneous comparison with large negative exponents, Andrew J. Schorr, 2015/04/16
- Re: [bug-gawk] gawk erroneous comparison with large negative exponents,
Aharon Robbins <=
- Re: [bug-gawk] gawk erroneous comparison with large negative exponents, Andrew J. Schorr, 2015/04/17
- Re: [bug-gawk] gawk erroneous comparison with large negative exponents, Andrew J. Schorr, 2015/04/17
- Re: [bug-gawk] NUMCUR and NUMBER flag usage, Andrew J. Schorr, 2015/04/18