Python Forum
Unexpected round behavior - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Unexpected round behavior (/thread-16233.html)



Unexpected round behavior - pythonCoder - Feb-19-2019

Hi, I was using IDLE and trying to do: round(9/2) -- surprised that it says 4.. round(11/2) and round(7/2) all appear correct. How can we explain this behavior? thanks..


RE: Unexpected round behavior - marienbad - Feb-19-2019

See here: https://docs.python.org/2/tutorial/floatingpoint.html#tut-fp-issues