Comparing doubles often fails #47
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Comparing double values using luaj often fails, since it uses a simple comparison. See:
https://howtodoinjava.com/java/basics/correctly-compare-float-double/
Would something like this be possible to be put into the current version of LuaJ?
For example, I'm keeping track of how a variable changes in my program. I set the player height to 1.0. In the next frame I set his height to 1.0 again. On height change, I check the current value of height in the lua object (which should be 1.0 but it's now 0.999999999). 0.9999999 is not equal to 1.0, so it thinks the player height changed. Sure I can work around this, but I have a few thousand variables being checked, and would rather not change them all like this.
Fixed