Humble Pi

Home > Other > Humble Pi > Page 16
Humble Pi Page 16

by Matt Parker


  It was a lot of fun explaining to a lawyer how rounding to significant figures causes an asymmetric range of values to all round to the same number. It’s a quirk of how we write numbers down. When a number goes up a place value in our base-10 system, numbers up to 50 per cent bigger than it, but only down to 5 per cent smaller, round to it. Everything between 99.5 and 150 round to give 100. So if someone promises you £100 (to one significant figure), you can claim up to £149.99. From now on, I’m calling that ‘doing a Donald’.

  Having at least pretended to understand what I was saying, the lawyer was very professional and didn’t even tell me what side of the case they were arguing. It was merely an impromptu lesson in rounding. But a few years later I remembered that phone call and was curious about what had happened. To get closure, I hunted around until I found the trial and the final ruling. The judge had agreed with me! The number in the patent was deemed to have been specified to one significant figure and so 0.77 per cent was different to 1 per cent. It was the end of the biggest case of my career (rounded up to the next whole case).

  The .49ers

  The Trump administration considered a ratio of 3.49 for a very good reason. Even though 3.5 would have allowed even more leeway, it would have been ambiguous whether it should round up or down, whereas 3.49 definitely rounds down.

  When rounding to the nearest whole number, everything below 0.5 rounds down and everything above 0.5 goes up. But 0.5 is exactly between the two possible whole numbers, so neither is an obvious winner in the rounding stakes.

  Most of the time the default is to round 0.5 up. If there was originally anything after the 5 (for example, if the number was something like 0.5000001), then rounding up is the correct decision. But always rounding 0.5 up can inflate the sum of a series of numbers. One solution is always to round to the nearest even number, with the theory that now each 0.5 has a random chance of being rounded up or rounded down. This averages out the upward bias but does now bias the data towards even numbers, which could, hypothetically, cause other problems.

  round up round even

  0.5 1 0

  1 1 1

  1.5 2 2

  2 2 2

  2.5 3 2

  3 3 3

  3.5 4 4

  4 4 4

  4.5 5 4

  5 5 5

  5.5 6 6

  6 6 6

  6.5 7 6

  7 7 7

  7.5 8 8

  8 8 8

  8.5 9 8

  9 9 9

  9.5 10 10

  10 10 10

  sum: 105 110 105

  The numbers from 0.5 to 10 sum to 105. Rounding each number up increases the total to 110 whereas rounding even keeps the sum at 105. However, now three-quarters of the numbers are even.

  Fixing the glitch

  In January 1982 the Vancouver Stock Exchange launched an index measure of how much the various stocks being traded were worth. A stock market ‘index’ is an attempt to track the change in the prices of a sample of stocks as a general indication of how the stock market is going. The FTSE 100 Index is a weighted average of the top hundred companies (by total market value) on the London Stock Exchange. The Dow Jones is calculated from the sum of the share prices of thirty major US companies (with General Electric going back to the early 1900s and Apple added only in 2015). The Tokyo Stock Exchange has the Nikkei Index. Vancouver wanted its own stock index.

  So the Vancouver Stock Exchange Index was born. Not the most creative name for a stock market index, but it was comprehensive: the index was an average of all 1,500 or so companies being traded. The index was initially set to a value of 1,000 and then the movement of the market would cause the value to fluctuate up and down. Except it went down a lot more than it went up. Even when the market seemed to be doing great, the Vancouver Stock Exchange Index continued to drop. By November 1983 it closed one week at 524.811 points, down by almost half its starting value. But the stock market had definitely not crashed to half its value. Something was wrong.

  The error was in the way that computers were doing the index calculations. Every time a stock value changed, which happened about three thousand times a day, the index would be used in a calculation to update its value. This calculation produced a value with four decimal places, but the reported version of the index used only three; the last digit was dropped. Importantly, the value was not rounded: the final digit was simply discarded. This error would not have occurred if the values had been rounded (which goes up as often as it goes down), instead of truncated. Each time there was a calculation, the value of the index went down by a tiny amount.

  When the exchange worked out what was going on they brought in some consultants, who took three weeks to recalculate what the index should have been without the error. Overnight, in November 1983, the index jumped from the incorrect 524.811 up to the newly recalculated 1098.892. That is an increase of 574.081 overnightfn1 with no corresponding change in the market. I have no idea how stock traders respond to such an unexpected jump up; like some kind of anti-crash. I assume they jumped back in through windows and blew cocaine out of their noses.

  You can use rounding in your own little mini-scam. Let’s say you borrow £100 off someone and promise to pay it back a month later with 15 per cent interest. That would be a total of £15 interest. But because you’re super generous you offer to compound the interest once a day for all thirty-one days in the month that you have the money and, to simplify things (because who wants too much complicated maths?), all calculations will be rounded to the nearest pound.

  Without rounding, the compound interest over the month would be £16.14 and, with rounding to the nearest pound, it’s … £0. No interest at all. Split over thirty-one days, 15 per cent is 0.484 per cent per day. So after the first day, the money you owe goes up to £100.484 but, because you’re rounding to the nearest pound, that 48.4p disappears and you once again only owe £100. This repeats every single day and your loan never accrues any interest. It does also have the side effect of rounding down the number of people who will lend you money to zero.

  If there are enough numbers being rounded a tiny amount, even though each individual rounding may be too small to notice, there can be a sizeable cumulative result. The term ‘salami slicing’ is used to refer to a system where something is gradually removed one tiny unnoticeable piece at a time. Each slice taken off a salami sausage can be so thin that the salami does not look any different, so, repeated enough times, a decent chunk of sausage can be subtly sequestered. Salami is also a great analogy because it is already made of minced-up meat so many slices of salami could be mushed back together into a functional sausage. And I’d like to make it clear I’m not just trying to get the phrase ‘functional sausage’ into this book because of a bet.

  A salami-slicing rounding-down attack was part of the plot of the 1999 film Office Space (just like Superman III). The main characters altered the computer code at a company so that, whenever interest was being calculated, instead of being rounded to the nearest penny the value would be truncated and the remaining fractions of a penny deposited into their account. Like the Vancouver Stock Exchange Index, this could theoretically carry on unnoticed as those fractions of pennies gradually added up.

  Most real-world salami-slicing scams seem to use amounts greater than fractions of a penny but still operate below the threshold where people will notice and complain. One embezzler within a bank wrote software to take twenty or thirty cents out of accounts at random, never hitting the same account more than three times in a year. Two programmers in a New York firm increased the tax withheld on all company pay cheques by two cents each week but sent the money to their own tax-withholding accounts so they received it all as a tax refund at the end of the year. There are rumours that an employee of a Canadian bank implemented the interest-rounding scam to net $70,000 (and was discovered only when the bank looked for the most active account to give them an award), but I cannot find any evidence to back that up.

  This is
not to say there are not salami-slicing effects which can cause problems. Companies in the US have to withhold 6.2 per cent of their employees’ salary as Social Security tax. If a company has enough employees, calculating the 6.2 per cent they owe individually and rounding each payment could give a slightly different total than if the total payroll amount was multiplied by 6.2 per cent. Never one to miss a trick, the Internal Revenue Service has a ‘fractions of cents adjustment’ option on company tax forms so it can make sure every last penny is accounted for.

  Exchanging currencies can also cause problems, as different countries have different smallest values. Much of Europe uses euros as currency (each euro is made up of a hundred cents), but Romania still uses the leu (each split into a hundred bani). As I type, the exchange rate is about 4.67 to 1 in the euro’s favour, which means that a euro cent is worth more than a bani. If you were to take two bani to a currency exchange, it would round down to zero cents and you’d get nothing back. Or it is possible to make the rounding go in your favour and hide it in a less suspicious transaction: 11 leu is equal to 2.35546 euro, which would be rounded up and you would get 2.36 euro. Change it back, and now you have 11.02 leu. Provided there are no transaction charges, that 2 bani is pure profit.

  In 2013 Romanian security researcher Dr Adrian Furtuna tried something similar: to put currency exchange transactions through a bank where the euro rounding would net him around half a cent each time. But the bank Furtuna was using required a code from a security device for each transaction, so he built a machine to automatically type the required numbers into his device for each transaction and read the code it returned. This meant he could put through 14,400 transactions a day, gaining him 68 euro daily. Not that he ever did it: Furtuna had been hired by the bank to test its security and he did not have permission to try it with the live banking system.

  I, on the other hand, did try my own salami-slicing in the real world when I lived in Australia. Back in 1992 Australia removed one-cent and two-cent coins from circulation, so the smallest denomination useable when paying in cash is now the five-cent coin. So, when paying cash, the total cost is rounded up or down to the nearest five cents. Except bank accounts still operate to an exact number of cents. My scheme was simple: I would pay in cash whenever the rounding went down in my favour and pay by card when it would have rounded up. On about half of my purchases I was saving ones of cents! I was a tiny fraction of a criminal mastermind.

  Racing mistakes

  The world record for the 100-metre sprint is one of the world’s most prestigious sporting achievements, and the International Association of Athletics Federations (IAAF) has been tracking it for over a century now. When the IAAF started keeping track of times in 1912 the men’s record was 10.6 seconds and it has been falling ever since. By 1968 it had come down to 9.9 seconds, finally breaking the ten-second mark. Then US sprinter Jim Hines beat the world record again, with a time of 9.95 seconds. Which was slower than the previous record.

  Jim Hines’s time in 1968 of 9.95 seconds was the first world record to use two decimal places and so usurped the previous record of 9.9 seconds set four months earlier. Electronic timing had just been introduced which allowed for a new level of precision: hundredths of a second. The previous record of 9.9 seconds was also held by Hines, so it seems that when electronic timing came in they changed his record to be the worst it could have been while still being recorded as 9.9 seconds to the nearest tenth of a second.

  The timing equipment used has always had an impact on the records. Back in the 1920s three different hand-operated watches were used to avoid any timing mistakes. But they were only precise to the nearest fifth of a second, so the record of 10.6 seconds was set in July 1912 and 10.4 seconds was not achieved until April 1921. Assuming sprinters were getting better at a regular rate,fn2 I’ve calculated that, around June 1917, some poor runner probably ran 100 metres in 10.5 seconds but no one’s watch was good enough to notice.

  There was also a change in accuracy when going from hand-operated stopwatches to electronic timing. The automatic start and stop of an electronic timer is more accurate than relying on humans, with their sloppy reaction times, to do the job. Precision and accuracy often get jumbled together, but they are two very different things. Precision is the level of detail given, and accuracy is how true something is. I can accurately say I was born on Earth, but it’s not very precise. I can precisely say I was born at latitude 37.229N, longitude 115.811W, but that is not at all accurate. Which gives you a lot of wriggle-room when answering questions if people don’t demand that you be accurate and precise. Accurately, I can say that someone drank all the beer. Precisely, I can say that an Albanian who holds several Tetris world records drank all the beer. But I’d rather not be precise and accurate at the same time, as it may incriminate me.

  So while increases in accuracy give us correct world records for the 100 metres, increases in precision give us more records. Eleven different people had 100-metre times of 10.2 seconds across the two decades from 1936 to 1956, before someone finally cracked 10.1 seconds. With the extra precision of modern timing, many of those people might have achieved their own world records.

  There is no reason why we couldn’t have more precise timing systems in the future and have the same situation going from hundredths of a second to milliseconds. Or down to nanoseconds. I suspect this will happen when the records plateau at the limit of human ability. While humans may not get better for ever, no matter how long we have sprints and how close in ability the performers become, there will always be another decimal place of precision to compete for.fn3

  The 100-metre record is not the only impact rounding time has had on racing. I’ve come across a scam people were able to pull when betting on dog racing sometime before 1992. As it was an illegal scam, I’ve not had much luck trying to verify the story. All I have to go on is an anonymous posting from 6 April 1992 to the Forum on Risks to the Public in Computers and Related Systems. The RISKS Digest is an early internet newsletter which has existed since 1985 (and is still going). I’ve generally avoided unsubstantiated stories, but this one is too much fun to leave out. If anyone can confirm or disprove it, I’d love to hear from you.

  The story goes that bookmakers in Las Vegas were using a computer system to take bets on dog races. The system would allow bets to be placed until the official cut-off time, which Nevada law stated was a few seconds before the gates opened and released the dogs. After this time the race was considered to have started so no further betting was allowed. Once the race was over, the winner would be announced. So the key steps were: the betting would ‘close’, the race would ‘start’ and the winner would be ‘posted’.

  The problem was that the software used had been adapted from horse-racing software. In the state of Nevada the ‘close’ time for a horse race was when the first horse enters the gates, which could be a few minutes before the race itself started. After the ‘start’ the horse race itself would then take a few minutes before it was over and the winner ‘posted’. The system stored the time only in hours and minutes, but that was precise enough to guarantee that no one could continue to place bets after a horse race had begun.

  In the high-speed world of dog racing, the betting for a race could be closed, the race started and the winner posted all within a minute. So dog races could already have been won but the system would not yet have registered the close of bets because the minute had not changed. Some savvy people noticed this and realized that they could wait to see which dog won the race and still be able to enter a bet on it.

  The significance of figures

  Humans are very suspicious of round numbers. We are used to data being messy and not very neat. We take round numbers as a sign of rounded data. If someone says their commute to work is 1.5 kilometres, then you know it is not exactly 1,500 metres but, rather, they have rounded it to the nearest half a kilometre. However, if they were to say their walk to work is 149,764 centimetres, then you know that they have taken procrast
ination to record levels.

  In 2017 it was reported that if the US switched all of its coal power production to be solar power it would save 51,999 lives every year, an oddly specific number. It clearly looks like it has not been rounded; check out all those nines! But to my eye it looks like two numbers of different sizes have been combined and have produced an unnecessary level of precision as a result. I’ve mentioned in this book that the universe is 13,800 million years old. But if you’re reading it three years after it was published, that does not mean that the universe is now 13,800,000,003 years old. Numbers with different orders of magnitude (sizes of the numbers) cannot always be added and subtracted from each other in a meaningful way.

  The figure of 51,999 was the difference between lives saved not using coal and deaths caused by solar. Previous research in 2013 had established that the emissions from coal-burning power stations caused about 52,000 deaths a year. The solar photovoltaic industry was still too small to have any recorded deaths. So the researchers used statistics from the semiconductor industry (which has very similar manufacturing processes and utilizes dangerous chemicals) to estimate that solar-panel manufacture would cause one death per year. So 51,999 lives saved per year. Easy.

  The problem was that the starting value of 52,000 was a rounded figure with only two significant figures and now, suddenly, it had five. I went back to the 2013 research, and the original figure was 52,200 deaths a year. And that was already a bit of a guess (for all you stats fans, the value of 52,200 had a 90 per cent confidence interval of 23,400 to 94,300). The 2013 research into coal-power deaths had rounded this figure to 52,000 but, if we un-round it back to 52,200, then solar power can save 52,199 lives! We just saved an extra two hundred people!

  I can see why, for political reasons, the figure of 51,999 was used – to draw attention to the single expected death from solar-panel production and so to emphasize how safe it is. And that extra precision does make a number look more authoritative. The reduced precision in a rounded number makes them also feel less accurate, even though that is often not the case. Those zeros on the end may also be part of the precision. One in a million people will unknowingly live exactly a whole number of kilometres (door to door) from work, accurate to the nearest millimetre.

 

‹ Prev