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

gcc - MinGW's ld cannot perform PE operations on non PE output file -

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

c# - Search and Add Comment with OpenXML for Word -