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: arnold
Subject: Re: [bug-gawk] Overflow to Infinity
Date: Fri, 13 Jul 2018 06:28:17 -0600
User-agent: Heirloom mailx 12.4 7/29/08

Hi Eli.

Eli Zaretskii <address@hidden> wrote:

> > From: Arnold Robbins <address@hidden>
> > Date: Fri, 13 Jul 2018 14:03:26 +0300
> > Cc: address@hidden, address@hidden
> > 
> > I am working on changing comparison (==, !=, etc.) such that for NaN
> > and INF values gawk will behave like C.  I hope this will be done
> > within another week or so.  This will NOT affect array sorting, whereby
> > NaN values will continue to compare equal to each other.
>
> So the behavior will not really be like C, where NaN == NaN yields
> zero, right?  I think this part of the C behavior makes no sense in
> Awk.

Exactly the opposite. Right now, NaN values compare equal to each
other, both for array sort ordering, and for ==.  That NaN and Infinity
values in awk do not act like C doubles for the regular comparison
operators (==, !=, <, etc.) is a source of confusion to users, and the
questions about it have started becoming more frequent.

So, since I started working on gawk to make it print +nan, -nan, +inf,
and -inf (instead of plain 'nan' and 'inf' for the positive ones), I
decided to bite the bullet and fix scalar comparison to act like C doubles.
After all, that's what they are under the hood.

That code isn't quite finished yet; I have to tackle the MPFR part of
it, and also add doc.

If there's a convincing reason to leave things as they are, I'm willing
to hear it.

Thanks,

Arnold



reply via email to

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