Open YYBartT opened 7 months ago
If I understand this correctly: if number == 5
is true, floor(number)
and ceil(number)
both ought to return 5
as well, and actually take into account the epsilon.
I noticed this recently with floor()
; didn't report it because I wasn't sure if I was missing something! I'll get situations where 0.99999 or whatever equals 1, but floors to 0, so to get around it I have to do something like:
var _round = round(number)
if number == _round
number = _round
number = floor(number)
Not great! So hoping this gets changed before it comes back to bite me.
Description
Originating from the following issue: https://github.com/YoYoGames/GameMaker-Bugs/issues/4816
With the fix in the linked issue in place, the
sqrt
function now considers values in the range [-epsilon, 0] to be equal to 0, though some other inconsistencies remain between the comparison operators and certain math functions, such assign
andfloor
. The following piece of code shows a few of these inconsistencies:In the code above, the underlying values preserve the sign which the math functions take it into account, while checking equality with 0 using a comparison operator returns
true
. If a value is considered >= 0, the result of flooring it cannot be-1
.test_math_epsilon.zip
Expected Change
The results of comparison operators and math functions are consistent
Steps To Reproduce
How reliably can you recreate this issue using your steps above?
Always
Which version of GameMaker are you reporting this issue for?
2024.2.0 (Monthly)
Which platform(s) are you seeing the problem on?
Windows
Contact Us Package Attached?
Sample Project Added?