Number Representation


Binary Floating Point

We can develop a similar notation in binary.

Example:

    001011001 = 1.011001 * 26

Since we know the base (2), we need to keep track of

How many bits do we use for each component?

Sign: 1 bit

Accuracy vs. Range

IEEE 754 Standard

32-bit word
31 30      23 22                   0
S Exp Significand
 ↑ 8 bits  ↑ 23 bits

Range is approx. 2.0 * 10-38 → 2.0 * 1038

64-bit word
63 62        52 51                                       0
S Exp Significand
 ↑ 11 bits  ↑ 52 bits

Range is roughly 2.0 * 10-308 → 2.0 * 10308 (bigger range and more accurate)

Note: A number can be too big, but also too small.
Overflow: exponent too large
Underflow: negative exponent too large


Alyce Brady, Kalamazoo College