#### Paper Review 📄

# Appendix D

## What Every Computer Scientist Should Know About Floating-Point Arithmetic

#### Briefly

What Every Computer Scientist Should Know About Floating-Point Arithmetic is a summary paper, rather than a research paper on a new discovery. It’s all about the floating-point representation of real numbers in computer systems, and what happens when you do various operations on them.

It’s an oft-referenced, classic paper on floating-point arithmetic.

The paper starts by giving a mathematical notation for floating-point numbers. It then details rounding strategies for basic operations and proves the operations’ error bounds. The second part lays out an actual implementation standard — IEEE, and the smaller final section goes into some implications for compilers using BASIC code.

#### What this paper is not

This paper isn’t a Wikipedia article on floating-point. It won’t give insight into the *whys* of floating-point, and you won’t see any mentions of alternative representations like fixed-point. You’ll be left wanting to know more history, opinions, and what’s changed since this paper came out in 1991.

#### How it made me feel

Pumped! It was extremely cool to better understand this datatype I’ve been using for so long, and see what the buzz was about with floating-point arithmetic.

However, when I told my friend Anton that I was reading it, he said that he’d tried reading it before too, but found it so boring he couldn’t continue. So, your mileage may vary. If you’re not very curious about the topic, then I don’t think the paper will draw you in on its own.

**Update**: *I asked Anton if he’d read this review yet, and he said he hadn’t because it was too long and reminded him of this one paper he read once about floating-point arithmetic*.

Though it was exciting for me, it was also quite a slog. It took me full weekend days to work through all the examples and proofs and really understand everything. This is all despite the paper flowing and reading well.

#### Prerequisites

You do not need to be an official Computer Scientist to read this! I’m not sure what that means anymore. However, you will need an intuition about bits and should at least understand unsigned integer representation in binary first, and have used floating-point numbers in code.

Finally, you need to know your school math. Things can get real. And by real I mean imaginary. Do you remember complex numbers? I didn’t really, but they were brought up to explain why there was a -0 and +o in the IEEE standard. I got by without really understanding that, but I needed to know exponents, logarithms, bases, square roots, and a bit of limits to understand the paper as a whole.

#### Most surprising thing

What struck me most from this paper was that every kind of operation needs care and individual attention to get the accuracy it needs. Subtractions are handled differently than multiplications, which are handled differently from “transcendental functions” like *sine* or *log*.

While I know what a mess of edge cases high-level programming can be, I had this idea of hardware and low-level engineering being simple and beautiful. It is not so, it seems.

#### Band names from the paper

The Ulps (punk bluegrass), Catastrophic Cancellation (hardcore), The Limit Does Not Exist (double reference to Mean Girls), Machine Epsilon (futuristic rap).