Adding two numbers

To add two real numbers, the computer has to write them with the same exponent:

> number1:=M1*16^(exp1);

[Maple Math]

> number2:=M2*16^(exp2);

[Maple Math]

> number1+number2;

[Maple Math]

One can obtain the same exponent by dividing or multiplying the second mantissa by a power of 16. This shifts the binary form by a multiple of four positions, a process whereby information may be lost. To illustrate this, consider the following calculation:

> number1:=655*16^2;

[Maple Math]

> number2:=evalf(12*16^(-8));

[Maple Math]

> number1+number2;

[Maple Math]

This shows that although both numbers can be represented adequately in the computer, their sum can not be distinguished from the biggest number. This type of error always affects floating point calculations!