Hacker News new | ask | show | jobs
by mark-r 1593 days ago
This was a lot more thorough and in-depth than I expected it to be. But that's Raymond Chen for you.

One of the reasons I love Python is that integers never overflow, so this becomes a trivial problem.

2 comments

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."

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