lua-users home
lua-l archive

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


On Sun, Jun 05, 2011 at 12:47:39PM +0200, Sebastian wrote:
> I have found an interesting bug. if you run
> 
> a = 0
> b = -0
> if (a == b) then
> print("0 is -0!")
> end
> 
> in the lua demo (http://www.lua.org/cgi-bin/demo), then you see that lua
> does'nt make a difference between 0 and -0.  

This is not a Lua bug.  It is not any kind of bug.  It is defined this 
way in the IEEE 754 floating-point standard:
    http://en.wikipedia.org/wiki/Negative_zero

Dirk