bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: gawk number to string bug


From: Eli Zaretskii
Subject: Re: gawk number to string bug
Date: Mon, 19 Dec 2005 23:52:42 +0200

> Date: Mon, 19 Dec 2005 09:48:33 -0500
> From: "Andrew J. Schorr" <address@hidden>
> Cc: address@hidden, address@hidden
> 
> Perhaps I'm missing something subtle, but why wouldn't something
> as simple as the attached patch do the trick (i.e. simply convert
> the floating point value to a long, then convert that value back
> to floating-point, and see whether it matches the original value)?

I don't think you can trust a long-to-double conversion to be safe.
It could, for example, trigger a FP exception, whose effects are
practically unpredictable.

I think Aharon's fix is safer.  (It would be simpler to convert to
`long long', but arguably `long long' is not yet widespread enough to
assume its availability.)




reply via email to

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