bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Overflow to Infinity


From: Andrew J. Schorr
Subject: Re: [bug-gawk] Overflow to Infinity
Date: Fri, 22 Jun 2018 22:55:58 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,

On Fri, Jun 22, 2018 at 03:19:40PM -0700, Daniel Pettet wrote:
> Thank you for following up on this.  I agree with Arnold that there are two
> issue here and it is best to treat them separately.  The first is about
> decoding very large numbers that overflow to +/- infinity.  How the output
> is displayed is another problem that is more general in nature.  To solve
> the first problem the output should be 'inf' or '-inf' to be consistent
> with the rest of gawk.
> 
> Outputting '+inf' rather than 'inf' could solve the encode/decode
> round-about problem and is easier to spot since it looks numeric - which it
> is.  How easy this is to do depends greatly on how gawk is implement.

Hmm. With --posix, "inf" and "infinity" are recognized as numeric values.  So
there's no need for a leading "+" sign in that case. I wonder whether it's wise
for regular gawk to depart from that POSIX behavior.  This is a tricky issue.

> Solving the second problem will also have to include NaNs.  NaNs have signs
> in the floating-point unit but conceptually do not.  One could output
> '.nan' rather than '+nan' and '-nan' to solve the encode/decode round-about
> problem.  '.nan' also looks numeric.

That (.nan) doesn't feel like a good approach to me, because it's so
unconventional, but I'm open to being convinced.

Regards,
Andy



reply via email to

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