In many respects, life seemed to be a whole lot simpler when I was a young lad. Take the subject of rounding, for example. If we wanted to round a value like 6.1, 6.2, 6.3, or 6.4 to the nearest whole number, then the answer was 6. Similarly, if we wanted to round 6.6, 6.7, 6.8, or 6.9 to the nearest whole number, then the answer was 7.
The only tricky one was the “half-way” value of 6.5, but our teachers told us to round this up to 7, so that’s what we did. “Easy peasy lemon squeezy,” as it were. At that time, I honestly thought that this was all there was to know about rounding. Ah… I was so young, so trusting, and so foolish in those far off days of yore. I’m much wiser (and sadder) now.
Over the years, I was introduced to different flavors of rounding, but it wasn’t until I started work on the book How Computers Do Math that I delved deeper into this topic, at which time I discovered how little I knew.

Seriously, most people wouldn’t believe the variety of rounding algorithms that can be employed by different applications. These include round-toward-nearest, round-half-up (arithmetic rounding), round-half-down, round-half-even (banker’s rounding), round-half-odd, round-ceiling (toward positive infinity), round-floor (toward negative-infinity), round-toward-zero, round-away-from-zero, round-up, round-down, truncation (chopping), round-alternate, and round-random (stochastic rounding).
Things really get interesting when you start to think about rounding signed binary values, and don’t even start me talking about symmetric versus asymmetric implementations. A big problem is that, even if you understand all this stuff, you really need to pay attention when you are designing hardware or developing software, because different applications may treat things differently.
For example, the round method of the Java Math Library provides an asymmetric implementation of the round-half-up algorithm, while the round function in the mathematical modeling, simulation, and visualization tool MATLAB from The MathWorks provides a symmetric implementation. Furthermore, just for giggles and grins, the round function in Visual Basic for Applications 6.0 actually implements the round-half-even (banker’s rounding) algorithm.
If you are interested in learning more about all of this, may I be so bold as to point you at my Introduction to Rounding Algorithms, which explains everything in excruciating detail accompanied by lots of lovingly hand-crafted graphics.
Also, it may not surprise you to hear that those clever chaps and chappesses at OmniCalculator.com (with 897 free calculators the last time I looked) provide a handy-dandy Rounding Calculator for us to play with:
The reason I’m waffling on about rounding here is that my chum Jay Dowling just sent me a link to a rather interesting article on The Deadly Consequences of Rounding Errors, which explains how in politics, stock markets, space, and on the battlefield, tiny software calculation mistakes have had enormous consequences.
How about you? Have you ever run into a situation where rounding errors caused problems, or where a software application was using a different rounding technique to the one you were expecting?
Funny, I misread the title and felt that I could get into this one deeply. I thought it said, “Fundamentals: Different Routing Algorithms” Oh well.
Nevertheless, the penny should be banned and every total sale (including taxes) of items should be rounded to the nearest nickel. It will all balance out over time. Prices can remain the same, but when it comes to paying for it, pennies be-gone!
“…It will all balance out over time. Prices can remain the same…” I fear you delude yourself. If the penny very banned, shopkeepers would immediately employ the round-ceiling algorithm, so something that originally cost say $2.63 would end up costing $2.70.
In 1971 in the UK, we moved from the Pounds, Shillings, and Pence system in which there were 240 pennies in the pound to the new currency with 100 pennies in the pound. Since the pound remained the same, each new penny was worth 2.4 old pennies. Shopkeepers around the country took advantage — if something cost three old pennies, it now cost three new pennies, meaning it cost 2.4X as much as it used to — talk about “overnight inflation”.
Actually, the history of Pounds, Shillings, and Pence is rather interesting. This was also written as LSD, where the “L” comes from the Latin word “libra” and the D comes from the Latin word “denarius,” which was a type of coin in Roman times. This system was actually instigated as far back as the 8th century by the first Holy Roman Emperor, Charlemagne.
If you are interested in learning more, I wrote a column on this some time ago on EETimes that explains it all in excruciating detail (https://www.eetimes.com/author.asp?section_id=36&doc_id=1287024)
Note that I said it should only be rounded to the nearest nickel AFTER the total sum of the items purchased, plus the total tax. With this method, it doesn’t matter what the individual item prices are. And since it is to the nearest nickel:
1,2 will be rounded down to 0
3,4 will be rounded up to 5
6,7 will be rounded down to 5
8,9 will be rounded up to 10
This could be done automatically at the cash register and since there is no way to accurately price the individual items so that their sum plus the tax of the sum is always 3,4,8 or 9, it will always be random and thus balance out.
I suppose if individual items were always priced such that if only that item was bought plus the tax resulted in a round-up, then the system could be cheated. But what percent of purchases are for only one item? Yes, with a car, an appliance, a house, a yacht, an airplane, the buyer could be cheated out of 2 cents. 🙂
My bad — I’d completely forgotten that you (we) have nickel (5-cent) coins — but my argument still stands that, knowing human nature, shopkeepers will round 1, 2, 3, 4 to to 5, and 6, 7, 8, 9 up to 10 (we should call this “shopkeeper’s rounding”
I suppose over time shopkeepers will wonder why they are still using cents in their prices. But one of the tricks they use right now might prevent them from changing prices. It is the .99 trick. Shoppers (the ones with little mathematical inclination) see $5.99 and think $5. So a shopkeeper is more likely to make $5.99 into $5.95.
Maybe the more compelling reason to get rid of pennies is they cost 2.06 cents to make each of them(2018). With 13 billion of them made each year by the U.S. Mint, you would think saving $137 million per year would be meaningful. Oh wait, we are talking about politicians making that kind of decision. Never mind.
They may cost 2.06 cents to make, but divide this out over their lifespan and the average number of transactions of which they play a role (I would love to know these values).
Up here in Canada we recently adopted the model that Charles described. Now it is possible that some shopkeepers made a killing by accumulated many, many cents. However to me it has never felt like price gouging, unlike the decimal conversion in the UK and the EURO upgrade.
I might add that the killing, if there ever was one, has not done much to alleviate the pain many retail outlets are feeling in the face of Internet competition.
Are you trying to tell me that my prized collection of Canadian pennies is without value?
If you need a weight in your pockets to counteract the lift given by your suspenders they are irreplaceable. However as part of a commercial transaction- not so much.
My brother used to travel a lot through Eastern Europe and picked up a lot of loose change that he called “shrapnel”. He stored it in this cookie jar that weighed a ton with all the brass coloured coinage. Until he moved to England and then discovered that the loose change actually had some value.
You sound like a man with a deep knowledge of wearing suspenders, but are we talking men’s suspenders (https://www.amazon.com/dp/B001VNBAYA) or ladies’ suspenders (https://www.amazon.com/dp/B07FVCRFKH)?
AT the risk of lowering the level of levity in this conversation (see what I did there?), I do have some knowledge of suspenders. At the time of my diagnosis, treatment and recovery from tumours in my hip, I could not wear a belt.
I also discovered that in fact I was wearing “braces”. Braces have the clips; suspenders hitch onto buttons on the pants. Another detail from the useless facts that I have stored up in my brain leaving no room for anything useful.
“…(see what I did there?)…” I did, and I’m proud of you for doing so 🙂
When your brother was traveling around Eastern Europe, was he wearing suspenders?
I see problems with rounding all the time in DSP with finite math. To avoid cycling (oscillations) I have to bias the rounding and sometimes delete remainders in the accumulator.
Are there any books about this sort of stuff — or is it like switch bounce where it’s up to the individual engineer to work it out for himself/herself or used the techniques handed down from their mentor?