Information Technology Reference
In-Depth Information
Steps Required to Add / Subtract Two Floating-Point Numbers
1. Compare the magnitude of the two exponents and make suitable alignment to
the number with the smaller magnitude of exponent.
2. Perform the addition
subtraction.
3. Perform normalization by shifting the resulting mantissa and adjusting the
resulting exponent.
/
Consider adding the two FP numbers 1.1100 * 2 4 and 1.1000 * 2 2 .
Example
1. Alignment: 1.1000 * 2 2 has to be aligned to 0.0110 * 2 4
2. Addition: Add the two numbers to get 10.0010 * 2 4 .
3. Normalization: The final normalized result is 0.1000 * 2 6
(assuming 4 bits
are allowed after the radix point).
subtraction of two FP numbers can be illustrated using the schematic
shown in Figure 4.13.
Addition
/
Multiplication of a pair of FP numbers X ¼ m x * 2 a and Y ¼
m y * 2 b is represented as X * Y ¼
Multiplication
(m x m y ) * 2 a þ b .
A general algorithm for multiplication of FP numbers consists of three basic
steps. These are:
1. Compute the exponent of the product by adding the exponents together.
2. Multiply the two mantissas.
3. Normalize and round the final product.
1.000 * 2 2 2
Example
Consider multiplying the two FP numbers X ¼
and
1.010 * 2 2 1 .
Y ¼ 2
1. Add exponents:
2
2
þ
(
2
1)
¼ 2
3.
2. Multiply mantissas: 1.000 * 2
1.010
¼ 2
1.010000.
1.0100 * 2 2 3 .
The product is
2
Figure 4.13 Addition / subtraction of FP numbers
Search WWH ::




Custom Search