GodotBigNumberClass icon indicating copy to clipboard operation
GodotBigNumberClass copied to clipboard

Nagative Values for isGreaterThanOrEqualTo, isGreaterThan not working as expected

Open lsrmg opened this issue 11 months ago • 1 comments

First of all I love you work, thanks a lot for this!

I encountered a small issue: It is possible that a negative float number is recognized as a positive number?

-30 is greater or equal to 9 -> expected to be false, but seems to be true because 30 >= 9?

print("", Big.new(-30.562).isGreaterThanOrEqualTo(Big.new(1.000)))

Output

true

3 not greater or equal to 9 -> expected to be false, but may for the reason that 3 is not <= 9

print("", Big.new(-3.562).isGreaterThanOrEqualTo(Big.new(9.639)))

Output

false

what I dont get is the following. Should be false and it is, but with the logic before it should show the wrong answer "true" as in the first example

print("", Big.new(-3.562).isGreaterThanOrEqualTo(Big.new(1.000)))

Output

false

How do you handle this in your games when calculating if a level-up is costing less than the money you have?

Thanks in advance!

lsrmg avatar Mar 19 '24 20:03 lsrmg