Hacker News new | ask | show | jobs
by erwincoumans 1587 days ago
Rounding in Python is interesting though:

https://www.askpython.com/python/built-in-methods/python-rou...

"Also, if the number is of the form x.5, then, the values will be rounded up if the roundup value is an even number. Otherwise, it will be rounded down.

For example, 2.5 will be rounded to 2, since 2 is the nearest even number, and 3.5 will be rounded to 4."

2 comments

Round half to even is well known outside Python. It's sometimes called bankers' rounding.
Yes it is. But nobody said anything about rounding!