I am using version 3.3.4 of godot and I am using gdscript, I have noticed strange behavior when doing divisions, for example if I divide 100 / (100/10) or 100 / (100/20) they give me the correct results, but When I divide 100 / (100/40) the result it returns is 50 when it should be 40, the same happens with 100 / (100/30) because it gives an incorrect value to what it should be, and when I divide 100 / (100/50 ) the result is correct again. Can you confirm if this is an engine failure?
Problems with divisions
It's certainly not an engine failure :)
If both of your division operands are integers, engine will perform integer division, truncating away fractional part of the result. If at least one operand is floating point, the division will be proper floating point division. So it's important how you specify your numeric literals:
100 - integer literal
100.0 - floating point literal
100/40 - result is 2
100.0/40.0 - result is 2.5
a year later
Megalomaniak added the Godot Help tag .