python - Why is rounding done like this? -


why python rounding this?

>>> 1.12345678901234567890 1.1234567890123457 >>> 0.0001100110011001100110011001100110011001100110011 0.00011001100110011001 

you should have @ how floats handled, , limitations have. https://docs.python.org/3/tutorial/floatingpoint.html python specific explanation.

in particular example, python chooses use representation has limited number of digits (depends on python version). internally, different float values may share same (rounded) representation.


Comments

Popular posts from this blog

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -