Wednesday, November 16, 2005

Math Redux

Yesterday, I had a great reminder of some old math lessons that I haven't thought much about in a few years. Remember "banker's rounding," also known as round-to-even. Most people learn about this technique somewhere in highschool, be it a math or science class. For me, it was sophomore chemistry. Most people promptly forget about it and go on about their business, rounding numbers with, what some situations show, zero-biased calculations.

If you don't recall, the basic premise is this: If you are rounding a number, and the most left-most number to be removed is a 5, then you round to the prior digit to the nearest even number. For example, I want to round these numbers to the nearest whole number:

Banker's Traditional 14.5 14 15 15.5 16 16

As you can see, with traditional rounding, 5's always round up. With banker's rounding, 5's always round you to the nearest even number. As the theory goes, statistically speaking, 5 is smack in the middle of 1 and 9. It has no tendency to lean up or down. So, it should round up or down with equal likelihood to minimize the bias of the rounding. So, evens round down, odds round up... that is, you always round to the nearest even number.

Anyway, I ran across this at work yesterday. We're setting up a new Teradata system to replace our existing DB2 one. BIIIIIG databases. Well, the new system users banker's rounding by default. The old one doesn't. I'm absolutely sure that some user, despite not knowing SQL from a bad spinoff, will notice that some average dollar amount is off by 1 penny between the two systems. OMG! It'll be the end of the world, I'm sure.

No comments: