# Pitfalls in Computation

**Humble Pi: A Comedy of Maths Errors**. *By Matt Parker. Allen Lane (Penguin Books), London, U.K., November 2018. 313 pages, £20.00.*

**Bits and Bugs: A Scientific and Historical Review of Software Failures in Computational Science**. *By Thomas Huckle and Tobias Neckel. Society for Industrial and Applied Mathematics, Philadelphia, PA, February 2019. 251 pages, $44.00.*

We all inevitably make errors when doing mathematics or writing computer programs. Most of the time we catch our mistakes and correct them before others notice them; if not, a co-author or referee usually spots the problem. It can be frightening to think that we might make an error that goes undetected and has serious consequences for a real-life situation.

Certain examples of the impact of erroneous computations are well known, such as the Vancouver Stock Exchange’s miscalculation of its index and the Patriot missile software problem [1-3]. But there are many other instances that are little known outside their particular fields. The two books under review discuss a wide variety of mathematics and software failures, but do so in different ways and for different audiences.

*Humble Pi: A Comedy of Maths Errors*. By Matt Parker.

*Bits and Bugs: A Scientific and Historical Review of Software Failures in Computational Science*. By Thomas Huckle and Tobias Neckel. Images courtesy of Penguin Books and SIAM.

Matt Parker, winner of the 2018 Joint Policy Board for Mathematics Communications Award, is known for his math-themed stand-up comedy and YouTube videos (his channel “standupmaths” has nearly half a million subscribers). Parker’s book, *Humble Pi*, is a tour of all kinds of situations in which errors in math, computing, and engineering have led to strange or undesirable outcomes.

Several of the stories he recounts relate to incorrect unit conversions. In 1983, an Air Canada Boeing 767 ran out of fuel en route to Edmonton because of a mixup between pounds and kilograms during calculation of the fuel required for the trip. Remarkably, the pilot was able to glide the plane in to land. In 1999, NASA’s Mars Climate Orbiter disintegrated in the atmosphere of Mars because of confusion in its software between pound force and Newtons. In discussing these and other incidents, Parker provides enough technical detail to explain what went wrong without overwhelming the lay reader.

The book taught me a new acronym: OBOE, which stands for off-by-one error. The meaning will be clear to anyone who has switched between a programming language whose array indexes start at 0 and one whose indexes start at 1. Parker’s examples relate to fence posts and musical intervals.

I particularly like *Humble Pi*’s material on spreadsheets. Parker naturally discusses rounding errors (for example, why =0.5-0.4-0.1 yields a different answer than =(0.5-0.4-0.1)*1 in Excel). After noting that “there is one thing that Excel is not, and that is a database system,” he spends several pages explaining how spreadsheet data can be misinterpreted. Parker cites research indicating that many Excel files in a collection associated with published genome research contained gene names that had been autocorrected to something else, such as a date (the gene “MARCH5” became 03/01/05, for example). Over 40 percent of spreadsheets recovered from Enron after its 2001 accounting scandal contained not a single formula, and about 24 percent of the spreadsheets with a formula included Excel error messages, such as =#DIV/0!

Incidentally, I found an error in this book about errors: the formula for Black-Scholes option pricing is missing a parenthesis. In the Acknowledgments section, Parker says that “all remaining errors are hilarious jokes I’ve demanded be left in,” so perhaps this is one of those.

One thing I found disconcerting is the page numbering system, which counts pages in reverse order from 314 to 0 and then wraps around to 4,294,967,295 (which equals \(2^{32}-1\) and features in the discussion of wraparound errors). This makes the index more difficult to use. With indexing fresh in my mind—having just written a new chapter on the topic for the third edition of my *Handbook of Writing for the Mathematical Sciences*—I find *Humble Pi’*s index to be an inadequate route into the book’s rich content. For instance, it does not list “Excel” or “spreadsheet.”

Overall, *Humble Pi* is thoroughly entertaining and contains many stories that *SIAM News* readers will most likely not have heard before. When Parker had flyers printed for his *Humble Pi* show, they did not turn out as intended. Either the printer made an error or the printing instructions were unclear. Scan the following QR code with your phone to watch the video and decide for yourself.

*Bits and Bugs* covers similar ground to *Humble Pi*, but with an emphasis on software and scientific computation. The first author, Thomas Huckle, has been collecting information about software bugs on his website since 2000. The book aims to provide a broad picture of bugs and incidents, recognizing that existing accounts may focus on particular aspects and can even contradict each other. Huckle and Tobias Neckel describe a number of episodes in great detail, including the 1996 explosion of the Ariane 5 rocket shortly after takeoff and the 1991 loss of the gas rig Sleipner A, which is attributed to poor use of finite element software in the rig’s design. They also illustrate automotive examples, such as autonomous driving.

The book is nicely presented with color images, sidebars that offer background information, and QR codes that link to illustrative videos. It is carefully researched, with many references to the literature. I am not aware of any other book that focuses on numerical software errors and their explanations. *Bits and Bugs*’ thorough index (freely downloadable from the SIAM Bookstore, should you wish to check it out before buying the book) gives an excellent overview of the book’s range of topics.

Erroneous computations and programming errors will always be with us, but *Humble Pi* and *Bits and Bugs* provide readers with an appreciation of the pitfalls to avoid. Both read like mathematical detective stories and are difficult to put down.

**References**

[1] Einarsson, B. (Ed.). (2005).

*Accuracy and Reliability in Scientific Computing*. Philadelphia, PA: Society for Industrial and Applied Mathematics.

[2] Higham, N.J. (2002).

*Accuracy and Stability of Numerical Algorithms*(2nd ed.). Philadelphia, PA: Society for Industrial and Applied Mathematics.

[3] Oliveira, S., & Stewart, D. (2006).

*Writing Scientific Software: A Guide to Good Style*. New York, NY: Cambridge University Press.

Nicholas Higham is Royal Society Research Professor and Richardson Professor of Applied Mathematics at the University of Manchester. |