While mathematically, it's true the -0 == 0 (and Lua agrees with that), this is probably not expected behavior:
game.print("clamp of -0 is "..math.clamp(-0, 0, 100))
Results in:
clamp of -0 is -0
The desired output here would have been
clamp of -0 is 0
On the fence if this is a "bug" per se, but if people are using clamp (and in my case, using as a percentage), displaying "-0%" is a little ugly and slightly unexpected.
While mathematically, it's true the -0 == 0 (and Lua agrees with that), this is probably not expected behavior:
game.print("clamp of -0 is "..math.clamp(-0, 0, 100))
Results in: clamp of -0 is -0
The desired output here would have been clamp of -0 is 0
On the fence if this is a "bug" per se, but if people are using clamp (and in my case, using as a percentage), displaying "-0%" is a little ugly and slightly unexpected.