[Solved] Why is rounding done like this? [closed]

You should have a look at how floats are handled, and what limitations they have. https://docs.python.org/3/tutorial/floatingpoint.html is a Python specific explanation.

In your particular example, Python chooses to use a representation that has a limited number of digits (depends on the Python version). Internally, different float values may share the same (rounded) representation.


solved Why is rounding done like this? [closed]