How does Python handle floating point numbers when the round function is also involved?
I am seeing 2 different versions of the result which IDLE popped out. Here is the input and iutput of IDLE Shell. I don't understand how this can even happen. >>> round(12.675,2) 12.68 >>> f"{12.675:.20f}" '12.67500000000000071054' >>> print(round(12.675,2)) 12.68 f"{2.675:0.20f}" '2.67499999999999982236'
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.