0% found this document useful (0 votes)
9 views13 pages

Module 2 Part2

Uploaded by

mishravivek3500
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views13 pages

Module 2 Part2

Uploaded by

mishravivek3500
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Module 2 Part2

Floating Point Addition/Subtraction


Add/Subtract Rule
1. Choose the number with the smaller exponent and shift its
mantissa right a number of steps equal to the difference in
exponents.
2. Set the exponent of the result equal to the larger exponent.
3. Perform addition/subtraction on the mantissas and determine
the sign of the result.
4. Normalize the resulting value, if necessary.
Multiplication and division are somewhat easier than addition and
subtraction, in that no alignment of mantissas is needed.
Truncation
-The next simplest method of truncation is von Neumann
rounding.
-If the bits to be removed are all 0s, they are simply dropped, with
no changes to the retained bits.
-However, if any of the bits to be removed are 1, the least
significant bit of the retained bits is set to 1.
Floating point multiplication
Multiply Rule
1. Add the exponents and subtract 127 to maintain the excess-
127 representation.
2. Multiply the mantissas and determine the sign of the result.
3. Normalize the resulting value, if necessary.
Divide Rule
1. Subtract the exponents and add 127 to maintain the excess-
127 representation.
2. Divide the mantissas and determine the sign of the result.
3. Normalize the resulting value, if necessary.
Floating-Point Division

Basic steps:
– Subtract the exponents E1 and E2 and add the BIAS.
– Divide M1 by M2 and determine the sign of the result.
– Normalize the resulting value, if necessary.
Problem:1. Consider the following 12-bit floating-point number
representation format that is manageable for working through numerical
exercises. The first bit is the sign of the number. The next five bits represent
an excess-15 exponent for the scale factor, which has an implied base of 2.
The last six bits represent the fractional part of the mantissa, which
has an implied 1 to the left of the binary point.
Perform Subtract and Multiply operations on the operands
Solution: The required operations are performed as follows:
• Subtraction
According to the Add/Subtract rule, we perform the following four
steps:
1. Shift the mantissa of B to the right by two bit positions, giving 0.01101010.
2. Set the exponent of the result to 10001.
3. Subtract the mantissa of B from the mantissa of A by adding mantissas, because
B is negative, giving

and set the sign of the result to 0 (positive).


4. The result is in normalized form, but the fractional part of the mantissa needs to
be truncated to six bits. If this is done by rounding, the two bits to be removed
represent the tie case, so we round to the nearest even number by adding 1,
obtaining a result mantissa of 1.110110. The answer is
Solution: The required operations are performed as follows:
• Subtraction
4. The result is in normalized form, but the fractional part of the mantissa needs to
be truncated to six bits. If this is done by rounding, the two bits to be removed
represent the tie case, so we round to the nearest even number by adding 1,
obtaining a result mantissa of 1.110110. The answer is
10.01011010111
Multiplication
According to the Multiplication rule , we perform the following three
steps:
1. Add the exponents and subtract 15 to obtain 10001 as the exponent of the result.
2. Multiply mantissas to obtain 10.010110101110 as the mantissa of the result. The
sign of the result is set to 1 (negative).
3. Normalize the resulting mantissa by shifting it to the right by one bit position.
Then add 1 to the exponent to obtain 10010 as the exponent of the result.
Truncate the mantissa fraction to six bits by rounding to obtain the answer
Practice Question 2
Add the numbers A and B, formatted as follows:
Practice Question 3
Perform Add, Subtract, Multiply, and Divide operations on the operands

You might also like