lua-users home
lua-l archive

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


Hi,

I'm writing some unit tests, where I compare numbers and I have problem with something like this: 
300 * 0.07 == 21 => false.
print (300 * 0.07, 21, 300 * 0.07 == 21)

What is the best way, for test float equality?

I consider to use tostring function:
print (300 * 0.07, 21, tostring (300 * 0.07) == tostring (21)),
But i wonder, maybe there is a better way, to compare something like this?

Thanks for any response.

--
Karol Drożak