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, 06 Jul 2018 05:47:44 -0600
User-agent: Heirloom mailx 12.4 7/29/08

Eli Zaretskii <address@hidden> wrote:

> This is non-portable.  On MS-Windows, the string you may get is
> "1.#IND", not "nan", depending on the version of the C runtime.  It
> can also have a leading sign, as in "-1.#IND".

Good to know.

Can MS-Windows also return nan/-nan ?

> Why do you need to sprintf the value, if it is known that it's a NaN?
> Why not do what you do with Inf:
>
> > +   } else if (isinf(val)) {
> > +           strcpy(buf, val < 0 ? "-inf" : "+inf");

Because you can't compare NaN to anything. The check `nan < 0' is false,
even for -nan.  :-(

Arnold



reply via email to

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