[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why do some math functions return -0
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 20 Sep 2010 09:51:36 -0300
> Anyway, I seem to remember that some printing problem producing -0 for
> no apparent reason had been fixed in some Lua version in the past.
> Maybe it is an older version for which this result appears.
The problem is that Lua unifies 0 and -0 in the constant table:
x=-0; y=0; print(x,y) --> -0 -0
x=0; y=-0; print(x,y) --> 0 0
This problem affects only code that has literal or "constant-folded"
negative zeros. (It has not been fixed...)
-- Roberto