Reputation: 801
Given a floating point number M represented in IEEE754 as
0 10000000 01010101010101010101010
How to compute the result of Round(Mx20) ?
I know how to translate M into normalized form,
M = 1.01010101010101010101010(base 2) x 2^1
But I don't know how to do the multiplication M x 20 by hand effectively, because there are so many numbers in mantissa.
any hint is appreciated!
Upvotes: 1
Views: 215
Reputation: 222273
The way forward is the standard Long Multiplication method, but in base 2:
1.010101010101010101010102•21 × 20
= 1.010101010101010101010102•21 × 5•4
= 1.010101010101010101010102•21 × 5•22
= 1.010101010101010101010102•21 × 1012•22
1.010101010101010101010102 • 21 1012 • 22 × _________________________________ 1.010101010101010101010102 • 23 00.000000000000000000000002 • 23 101.010101010101010101010002 • 23 + _________________________________ 110.101010101010101010100102 • 23
Then we want to round the significand to 24 bits, shown in bold: 110.101010101010101010100102 • 23.
So the result is 110.10101010101010101012 • 23, or 1.10101010101010101010100102 • 25.
Upvotes: 2