This sounds like a formatting issue. I use C#, not GDScript, but I’d assume there’s a way to increase the formatting precision.

additionally, the Mathf function IsEqualApprox() is probably what you want to use when dealing with float equality.

Thanks for your answer. I know about is_equal_approx() function, but I wonder why he compares correctly in this case, and at the end shows garbage

OrdinaryGuy | 2020-02-02 17:20

Because floating point can’t accurately represent all numbers, which is by design.

To represent all numbers, floating point would have to have an infinite number of bits. Since a single precision floating point number has only 32 bits, there are rounding errors introduced in unintuitive ways.

To check equality, you typically check to see if the numbers are within a given margin of error. This is what is_equal_approx() is for.