lua-users home
lua-l archive

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


I am experiencing some strange behavior with numbers where the results of a multiplication should equal a given number but Lua does not recognize the equality.

Here are some examples:

if ( 20425 * .053 ) == 1082.525 then print ("equal") else print ("not equal") end if rawequal( 20425 * .053, 1082.525 ) then print ("equal") else print ("not equal")end

Both result in "not equal". Lua interprets the multiplication as less than the correct number.

if ( 20425 * .053 ) < 1082.525 then print ("less than") else print ("not less than") end
less than

I am using Lua 5.02 on Windows from the LuaBinaries (Release 2). I quickly downloaded and tested Lua 4.0 and it has the same issue.

Thanks for any help on this.

Tom