I think there is some inconsistency in the division operation, but I am not sure.
In the following code I would expect either a//c to be 100.0, or b//c to be -99.0.
a = 1.0
b = -1.0
c = 0.01
print (a/c)
print (a//c)
print (b/c)
print (b//c)
gives:
100.0
99.0
-100.0
-100.0
Thanks
This is due to the way floating point numbers are represented. It's not true that
1.0is exactly 100 times0.01(as far as floating points are represented internally). The operator//performs division and floors the result so it may be that internally the number is slightly less than100.0and this leads it to being floored to99.0.Furthermore, Python 3.x uses a different approach to showing you the floating point number as compared to Python 2.x. This means the result of
1.0 / 0.01, although internally slightly less than100.0, will be displayed to you as100.0because the algorithm determined that the number is close enough to100.0to be considered equal to100.0. This is why1.0 / 0.01is shown to you as100.0even though this may not be represented internally as exactly that number.