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 -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -