This is because floating point numbers are represented . It is not true that 1.0 exactly 100 times 0.01 (since floating points are represented internally). The // operator performs division and aligns the result, so it may be that the internal number is slightly less than 100.0 , and this will cause it to be overlapped to 99.0 .
In addition, Python 3.x takes a different approach to show you a floating point number compared to Python 2.x. This means that the result of 1.0 / 0.01 , although internally slightly less than 100.0 , will appear to you as 100.0 , because the algorithm determined that the number was close enough so that 100.0 was considered equal to 100.0 . This is why 1.0 / 0.01 shown to you as 100.0 , although it cannot be represented internally how exactly this number is.
Simeon visser
source share