In a hypothetical computer system small floats are always represented in floating point notation, where the mantissa always has exactly 4 digits and is multiplied by 10-3
To convert a decimal number into this notation, the decimal place is moved to the right by three places and the resulting number is multiplied by 10-3. If the number has more than four digits, the extra digits are dropped. Here is an example:
To convert the number 0.0865789, move the decimal place three times to the right and then multiply the resulting number by 10-3 to get 86.5789 x 10-3
Because 86.5789 has more than four digits, the last two digits are dropped so it can be stored in the available space, to give 86.57 x 10^-3Notice that we are not rounding as you would normally do.
The reason for representing floats in this way is that it simplifies the algorithm for adding two floats. For example to add 86.57 x 10-3 to 0.011 x 10-3, the mantissas are added and the result multiplied by 10-3:
86.57 x 10^-3+ 0.011 x 10^-3
(86.57 + 0.011) x 10^-3
= 86.581 x 10^-3
However, as there are more than four digits in the mantissa, the last digit is dropped and the result is stored as 86.58 x 10^-3.
- i.Convert the value 0.9999 into floating point notation where the mantissa is multiplied by 10^-3.
- ii.Convert the value 0.00005 into floating point notation where the mantissa is multiplied by 10^-3.
- iii.Find the value of0.9999 +0.00005 + 0.00005by doing each addition, in turn, in order from left to right, using the values you wrote down in parts (i) and (ii). Remember that after each addition, your answer must have a mantissa of exactly 4 digits.
- iv.Find the value of0.00005 + 0.00005 + 0.9999by doing each addition, in turn, in order from left to right, using the values you wrote down in parts (i) and (ii). Remember that after each addition, your answer must have a mantissa of exactly 4 digits.
- v.From your results in parts(iii) and (iv) explain the order in which you should add numbers in such a system in order to get the most precise result.