Floating-Point Unit
A floating-point unit implements real-number arithmetic in hardware following the IEEE 754 format of sign, exponent, and mantissa.
Representing Reals
Hardware represents real numbers in the IEEE 754 floating-point format: a sign bit, an exponent, and a fraction (mantissa). A value is roughly the mantissa times two to the exponent, giving a wide dynamic range with a fixed number of bits. Single precision uses 32 bits, double precision 64. A floating-point unit (FPU) performs arithmetic on this format directly in silicon.
Addition Is Harder Than It Looks
Floating-point addition cannot just add the fields. The operands' exponents must first be aligned by shifting the smaller number's mantissa (a barrel shift), then the mantissas are added, then the result is normalized by shifting so the leading digit sits in the standard position, adjusting the exponent, and finally rounded. Detecting how far to normalize uses leading-zero detection, a priority encode.
- Align exponents, add mantissas, normalize, round
- Multiplication multiplies mantissas and adds exponents
- Fused multiply-add computes a*b+c with a single rounding
Rounding and Special Values
IEEE 754 defines rounding modes (round to nearest even is the default) and special values: signed zeros, infinities, and NaN (not a number) for undefined results like zero divided by zero. Denormalized numbers extend the range gracefully toward zero. Handling all these cases correctly, including the exact rounding the standard mandates, is a large part of what makes an FPU complex.
Fused Operations and Precision
A fused multiply-add computes a times b plus c with only one rounding step instead of two, which is both faster and more accurate; it is the backbone of dense linear algebra. Scientific computing, including the numerical simulation used to model plasma and magnetic fields in fusion research, depends on well-behaved floating-point arithmetic, since rounding error accumulated over billions of operations can dominate a result if the hardware and algorithms are not carefully matched.