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: Eli Zaretskii
Subject: Re: [bug-gawk] Overflow to Infinity
Date: Fri, 06 Jul 2018 15:47:02 +0300

> From: address@hidden
> Date: Fri, 06 Jul 2018 05:47:44 -0600
> Cc: address@hidden, address@hidden,
>         address@hidden
> 
> Can MS-Windows also return nan/-nan ?

I think only on the latest Windows versions, if at all.

> > 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.  :-(

Every test is false with NaNs, but the sign bit can easily be accessed
from C.



reply via email to

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