1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

dump[2]: avoid misleading rounding of numbers

This commit is contained in:
Lars Mueller 2025-04-21 19:50:34 +02:00 committed by Lars Müller
parent f4285a59ac
commit 98b2edeb11
2 changed files with 16 additions and 1 deletions

View file

@ -230,3 +230,10 @@ describe("math", function()
assert.equal(0, math.round(-0.49999999999999994))
end)
end)
describe("dump", function()
it("avoids misleading rounding of floating point numbers", function()
assert.equal("0.3", dump(0.3))
assert.equal("0.30000000000000004", dump(0.1 + 0.2))
end)
end)