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

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -