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

twig - Using Twigbridge in a Laravel 5.1 Package -

php - Symfony 2: "No route found for "GET /" - error on fresh installation -

java - Openshift port-forwarding -