bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] gawk erroneous comparison with large negative exponents


From: Andrew J. Schorr
Subject: Re: [bug-gawk] gawk erroneous comparison with large negative exponents
Date: Fri, 17 Apr 2015 15:24:35 -0400
User-agent: Mutt/1.5.23 (2014-03-12)

Hi Arnold,

On Thu, Apr 16, 2015 at 10:54:25PM +0300, Aharon Robbins wrote:
> 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?

I think there's still a problem:

bash-4.2$ echo "3D" | ./gawk '{ x = $1; print x + 2; print x+3 }'
debug: r_force_number(3D) started with flags 0x27 
(MALLOC|STRING|STRCUR|MAYBE_NUM)
debug: r_force_number(3D) finished with flags 0x1f 
(MALLOC|STRING|STRCUR|NUMCUR|NUMBER)
5
6

Do we want to set the NUMBER flag in this case?  How about the attached
patch instead?  It passes "make check".

Regards,
Andy

Attachment: debug.patch
Description: Text document

Attachment: numcur.patch
Description: Text document


reply via email to

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