Post

Have you ever thought about how your computer adds and subtracts? It takes a lot of hardware to handle floating-point numbers like 12.34. I opened up Intel's 8087 math coprocessor chip from 1980 to see how it works...

With a microscope, I zoomed in on the tiny silicon die and identified the circuitry. The ROM holds the software (microcode) that controls the chip. The adder is the heart of the chip, while the shifter aligns numbers, sliding them back and forth.

Subtracting two floating-point numbers, say 8-7.5, takes a few steps. Floating-point numbers are stored as a power of 2 times a binary number. The numbers are shifted so the exponents align, and then subtracted in binary. To get rid of zeros at the front, the result is shifted (normalized).

The 8087 chip went beyond regular numbers, supporting special values such as infinities, positive and negative 0, Not-A-Number. Computer scientist W. Kahan made sure special values were handled in mathematically sensible ways, so the chip had pages of special-case rules to follow.

0 reposts37 likes

The 8087 chip's microcode implemented infinity and other special cases in complicated code. This flowchart shows part of the code. Don't worry, you're not expected to understand this "spaghetti" code :-) The point is that there's a lot going on.

Although the 8087 chip was complicated, it became popular because its made floating-point operations 100 times faster on the IBM PC and other systems. Its math became the standard (IEEE 754) used by all modern computers, so every time you do math, thank the 8087 chip :-)