4 ms·
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 o
by mark-r 5y 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.
- nickm12 5y agoRaymond Chen is a treasure.
- erwincoumans 5y agoRounding in Python is interesting though: https://www.askpython.com/python/built-in-methods/python-round 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."