To perform arithmetic operations, the values of the operands are loaded into registers; the Arithmetic and Logic Unit (ALU) performs the operation, and puts the result in a third register; the value is then stored back in memory.
The two operands are obviously floating point numbers. The result of the operation stored in memory must also be a floating point number.
Is there any problem here? Yes! Even if the operands are FP numbers, the result of an arithmetic operation may not be a FP number.
To understand this, let us add two floating point numbers, = (97.2) and = (6.43), using our toy FP system. To perform the summation we need to align the numbers by shifting the smaller one (6.43) to the right.
The result (103.63) is not a floating number. We can round the result to obtain (104).
From this example we draw a first useful conclusion: the result of any arithmetic operation is, in general, corrupted by roundoff errors. Thus, the arithmetic result is different from the mathematical result.
If are floating point numbers, and is the result of mathematical addition, we will denote by the computed addition.
The fact that
has surprising consequences.
Let c= (0.999).