FLOATING POINT addition Mr. C.KARTHIKEYAN, ASSISTANT PROFESSOR, ECE , RMKCET
FLOATING POINT addition ALGORITHM Step 0: Convert the numbers in Normalized Binary Step 1: Compare the exponents and match it with the larger exponent Step 2: Add the significant bits Step 3: Normalize the sum Step 4: Round the significant bits if there is no overflow
Example 1 Perform addition of the numbers 0.5 ten and 0.4375 ten in binary using the floating point addition algorithm Step 0: Convert to Normalized Binary Binary Representation 0.5 x 2 = 1.0 1 0.75 x 2 = 1.50 1 0.50 x 2 = 1.00 1 0.875 x 2 = 1.75 1 0.4375 x 2 = 0.875 Binary Representation 0.5 10 = 0.1 2 0.4375 10 = 0.0111 2 1.000 x 2 -1 1.110 x 2 -2
Example 1 Perform addition of the numbers 0.5 ten and 0.4375 ten in binary using the floating point addition algorithm Step 1: Exponent Comparison 1.000 x 2 -1 1.110 x 2 -2 1.000 x 2 -1 1.110 x 2 -2 1.000 x 2 -1 0.111 x 2 -1
Example 1 Perform addition of the numbers 0.5 ten and 0.4375 ten in binary using the floating point addition algorithm Step 2 : Addition 1.000 x 2 -1 0.111 x 2 -1 1.000 0.111 (+) 1.111 1.111 x 2 -1
Example 1 Perform addition of the numbers 0.5 ten and 0.4375 ten in binary using the floating point addition algorithm Step 3: Normalization 1.111 x 2 -1 1.111 x 2 -1 (-1) S x 1.F x 2 E
Example 1 Perform addition of the numbers 0.5 ten and 0.4375 ten in binary using the floating point addition algorithm Step 4 : Rounding 1.111 x 2 -1 G R S Rounding Action Truncate 1 Truncate 1 Truncate 1 1 Truncate 1 Round to Even 1 1 Round Up 1 1 Round Up 1 1 1 Round Up
Example 1 Perform addition of the numbers 0.5 ten and 0.4375 ten in binary using the floating point addition algorithm Final Answer 1.111 x 2 -1 = 0.1111 0.9375 10
Example 2 Perform addition of the numbers 10.01101 x 2 1 and 0.00101101 x 2 2 in binary using the floating point addition algorithm Step 0: Convert to Normalized Binary 10.01101 x 2 1 0.00101101 x 2 2 1.001101 x 2 2 1.01101 x 2 -1
Example 2 Perform addition of the numbers 10.01101 x 2 1 and 0.00101101 x 2 2 in binary using the floating point addition algorithm 1.001101 x 2 2 1.01101 x 2 -1 Step 1: Exponent Comparison 0.00101101 x 2 2
Example 2 Perform addition of the numbers 10.01101 x 2 1 and 0.00101101 x 2 2 in binary using the floating point addition algorithm 1.001101 x 2 2 0.00101101 x 2 2 Step 2 : Addition 1.001101 0.00101101 (+) 1.01100001 1.01100001 x 2 2
Example 2 Perform addition of the numbers 10.01101 x 2 1 and 0.00101101 x 2 2 in binary using the floating point addition algorithm Step 3: Normalization 1.01100001 x 2 2
Example 2 Perform addition of the numbers 10.01101 x 2 1 and 0.00101101 x 2 2 in binary using the floating point addition algorithm Step 4 : Rounding 1.01100001 x 2 2 G R S Rounding Action Truncate 1 Truncate 1 Truncate 1 1 Truncate 1 Round to Even 1 1 Round Up 1 1 Round Up 1 1 1 Round Up 1.011 001 x 2 2 GUARD BIT(G) ROUND BIT(R) STICKY BITS (S) 1.011 x 2 2