November 19, 2019

The Immense Impact of Rounding Errors

““At 7-Eleven, you’d take a penny from the tray, right? Well those are whole pennies! I’m just talking about fractions of a penny here, OK? But we do it from a much bigger tray, and we do it a couple million times.” That’s how Peter Gibbons (Ron Livingstone) explains his penny-shaving scheme in Office Space. Penny-shaving is a plot point in Superman III, too—in both movies, characters make huge amounts of money by taking advantage of the fact that numbers need to be shortened to two decimal places in order to function as currency, in dollars and cents.

Computer code can handle this problem in many ways, including the command round(), which rounds to the nearest cent, or floor(), which just cuts off all the extra decimal places. For example, an after-tax salary computation of $145.459 would normally be rounded to $145.46; in a penny-shaving scheme, it would be floored to $145.45 instead. Such a small change is generally imperceptible to people in their paycheck, but when millions or billions of such fractional cents are stolen, it adds up.

Sometimes those fractional cents aren’t stolen—they simply vanish. In the early 1980s, a new stock index at the Vancouver Stock Exchange tracked a steady and mysterious loss in value. An investigation revealed that floor() was being used instead of round(), with the lost fractions of cents accumulating to almost a 50 percent loss of value in 22 months. The programming mistake was finally fixed; the index closed around 500 on a Friday and reopened the following Monday at over 1,000, the lost value restored.”

Read more

JJ Editor's Picks

"The top brass of China’s Communist Party (CCP) – its 370-strong Central Committee – recently emerged from the Fourth Plenum of the 2017 Party Congress. Such meetings, usually one a year, are key forums for policy discussion. At the previous..."

"Mayor Pete is having his moment — for the second time in the campaign. Surging to the head of the pack in a recent Iowa poll, and edging out Vice President Joe Biden in last quarter's money race, Buttigieg is staking his claim to being the..."

"careful reading of Walden; or, Life in the Woods makes it clear that Thoreau never intended his cabin to be a solitary hermitage, although fans and detractors alike often misunderstand this. It was more an author’s workshop than a fortress of..."

"In the fall of 2015, a rash of posters appeared around Copenhagen. One, in pink letters laid over an image of chicken eggs, asked, “Have you counted your eggs today?” A second — a blue-tinted close-up of human sperm — inquired, “Do they swim too..."

"While there’s plenty of disagreement about how the money should be used, almost everyone involved in public-policy debates agrees that it would be good if the federal government could collect more revenue without raising tax rates or reducing..."

"On a brisk November night, a solitary man wandered around the plaza outside the Duke Energy Center for the Performing Arts on the edge of downtown. He had just flown alone from New York to see his favorite comic, Louis C.K., and he had an extra..."

"Judaism has been described as many things: a culture, a people, a religion, a nationality, and more (including, according to answers given to the 2013 Pew survey of American Jews, a culinary disposition for bagels and smoked salmon or the..."

"US sex education is decades behind other countries. Right now, it isn’t even mandatory in every state. Add to that the awkwardness people feel about sex and bodies in general, top it with the idea of having to have these discussions in public..."