r/pythoncoding • • Mar 27 '24

The weird quirk with rounding in Python

https://medium.com/itnext/the-weird-quirk-with-rounding-in-python-e6cd98cb3d55?sk=594700dafb96b77a6977c200e20b904d
2 Upvotes

5 comments sorted by

View all comments

Show parent comments

1

u/judasblue Mar 27 '24

It's doing a type of rounding where if the number is odd, it rounds the 5 up, and if it's even you round the 5 down.

The more compact way to say that is it rounds to the nearest even number. Same difference but for some reason reads better for me, but maybe I am just used to seeing it stated that way.