Addition and Subtraction of Floating Point Numbers
The exponents of floating point numbers must be the same before they can be added or subtracted. The steps to add or subtract floating point numbers are:
• Shift the smaller number to the right until the exponents of both numbers are the same. Increment the exponent of the smaller number after each shift.
• Add (or subtract) the mantissa of each number as an integer calculation, without considering the decimal points.
• Normalize the result. An example follows. Example 1.37
Show decimal numbers 0.510 and 0.7510 in floating point and then calculate the sum of these numbers.
This floating point number is equal to decimal number 1.25, which is the sum of decimal numbers 0.5 and 0.75.
A program for converting floating point numbers into decimal, and decimal numbers into floating point, is available for free on the following web site:
http://babbage.cs.qc.edu/courses/cs341/IEEE-754.html