New answers tagged python-3.x
A while ago I constructed a test program for successive rounding, because it's basically a worst-case stress test for a rounding algorithm. For each number from 0 to 9,999 it first rounds to the nearest 10, then to the nearest 100, then to the nearest 1000. (You could also think of this as 10,000 points in [0,1) being rounded to 3 places, then to 2, then to ...
It's called banker's rounding. The idea is to minimize the cumulative error from many rounding operations. Lets say you always rounded .5 down. Think of all those little interest payments, the bank pocketing half a cent each time... Lets say you always rounded .5 up. Accounting is going to scream because you're paying out more interest than you should.
Top 50 recent answers are included