Dear Collegues
I have a problem with checking equals float numbers: code:
d = 0.2
u = d - 1
up = d - 0.5
r = u
for i in range(1,7):
r = r + 0.1
print(i,r,up)
if r == up :
print("equal","r",r,"=","up",up)
break;
output:
1 -0.700000000000000 -0.300000000000000
2 -0.600000000000000 -0.300000000000000
3 -0.500000000000000 -0.300000000000000
4 -0.400000000000000 -0.300000000000000
5 -0.300000000000000 -0.300000000000000
6 -0.200000000000000 -0.300000000000000
in line 5 -> it should print that are equals... what is wrong?