I cant understand why it happens.
open console and type there:
let a = 2.05/0.05
and i got the rezult
40.99999999999999 ???
a = 2.10/0.05
will give me rezult
42
a = 0.15/0.05
2.9999999999999996
How it happens ? and what i need to write to get the calc rezults (0.15/0.05 must be 3 )???
You are a victim of floating point precision errors, see this site for some basic explanations of them:
https://www.floating-point-gui.de/basic/
Instead of floating point calculations, you can use fixed point with libraries like bignum or handle the precision yourselves
1 Like
Thank u for ur answers. They help me very much.