Question

convert 20.085 to IEEE-754 single precision and double precision both. Need a lot of explanation. (Atleast...

convert 20.085 to IEEE-754 single precision and double precision both.
Need a lot of explanation. (Atleast 1000 words)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1)
20.085
Converting 20.085 to binary
   Convert decimal part first, then the fractional part
   > First convert 20 to binary
   Divide 20 successively by 2 until the quotient is 0
       > 20/2 = 10, remainder is 0
       > 10/2 = 5, remainder is 0
       > 5/2 = 2, remainder is 1
       > 2/2 = 1, remainder is 0
       > 1/2 = 0, remainder is 1
   Read remainders from the bottom to top as 10100
   So, 20 of decimal is 10100 in binary
   > Now, Convert 0.08500000 to binary
       > Multiply 0.08500000 with 2.    Since 0.17000000 is < 1. then add 0 to result
       > Multiply 0.17000000 with 2.    Since 0.34000000 is < 1. then add 0 to result
       > Multiply 0.34000000 with 2.    Since 0.68000000 is < 1. then add 0 to result
       > Multiply 0.68000000 with 2.    Since 1.36000000 is >= 1. then add 1 to result
       > Multiply 0.36000000 with 2.    Since 0.72000000 is < 1. then add 0 to result
       > Multiply 0.72000000 with 2.    Since 1.44000000 is >= 1. then add 1 to result
       > Multiply 0.44000000 with 2.    Since 0.88000000 is < 1. then add 0 to result
       > Multiply 0.88000000 with 2.    Since 1.76000000 is >= 1. then add 1 to result
       > Multiply 0.76000000 with 2.    Since 1.52000000 is >= 1. then add 1 to result
       > Multiply 0.52000000 with 2.    Since 1.04000000 is >= 1. then add 1 to result
       > Multiply 0.04000000 with 2.    Since 0.08000000 is < 1. then add 0 to result
       > Multiply 0.08000000 with 2.    Since 0.16000000 is < 1. then add 0 to result
       > Multiply 0.16000000 with 2.    Since 0.32000000 is < 1. then add 0 to result
       > Multiply 0.32000000 with 2.    Since 0.64000000 is < 1. then add 0 to result
       > Multiply 0.64000000 with 2.    Since 1.28000000 is >= 1. then add 1 to result
       > Multiply 0.28000000 with 2.    Since 0.56000000 is < 1. then add 0 to result
       > Multiply 0.56000000 with 2.    Since 1.12000000 is >= 1. then add 1 to result
       > Multiply 0.12000000 with 2.    Since 0.24000000 is < 1. then add 0 to result
       > Multiply 0.24000000 with 2.    Since 0.48000000 is < 1. then add 0 to result
       > Multiply 0.48000000 with 2.    Since 0.96000000 is < 1. then add 0 to result
       > Multiply 0.96000000 with 2.    Since 1.92000000 is >= 1. then add 1 to result
       > Multiply 0.92000000 with 2.    Since 1.84000000 is >= 1. then add 1 to result
       > Multiply 0.84000000 with 2.    Since 1.68000001 is >= 1. then add 1 to result
       > Multiply 0.68000001 with 2.    Since 1.36000001 is >= 1. then add 1 to result
       > Multiply 0.36000001 with 2.    Since 0.72000003 is < 1. then add 0 to result
       > Multiply 0.72000003 with 2.    Since 1.44000006 is >= 1. then add 1 to result
       > Multiply 0.44000006 with 2.    Since 0.88000011 is < 1. then add 0 to result
       > Multiply 0.88000011 with 2.    Since 1.76000023 is >= 1. then add 1 to result
       > Multiply 0.76000023 with 2.    Since 1.52000046 is >= 1. then add 1 to result
       > Multiply 0.52000046 with 2.    Since 1.04000092 is >= 1. then add 1 to result
       > Multiply 0.04000092 with 2.    Since 0.08000183 is < 1. then add 0 to result
       > Multiply 0.08000183 with 2.    Since 0.16000366 is < 1. then add 0 to result
       > Multiply 0.16000366 with 2.    Since 0.32000732 is < 1. then add 0 to result
       > Multiply 0.32000732 with 2.    Since 0.64001465 is < 1. then add 0 to result
       > Multiply 0.64001465 with 2.    Since 1.28002930 is >= 1. then add 1 to result
       > Multiply 0.28002930 with 2.    Since 0.56005859 is < 1. then add 0 to result
       > Multiply 0.56005859 with 2.    Since 1.12011719 is >= 1. then add 1 to result
       > Multiply 0.12011719 with 2.    Since 0.24023438 is < 1. then add 0 to result
       > Multiply 0.24023438 with 2.    Since 0.48046875 is < 1. then add 0 to result
       > Multiply 0.48046875 with 2.    Since 0.96093750 is < 1. then add 0 to result
       > Multiply 0.96093750 with 2.    Since 1.92187500 is >= 1. then add 1 to result
       > Multiply 0.92187500 with 2.    Since 1.84375000 is >= 1. then add 1 to result
       > Multiply 0.84375000 with 2.    Since 1.68750000 is >= 1. then add 1 to result
       > Multiply 0.68750000 with 2.    Since 1.37500000 is >= 1. then add 1 to result
       > Multiply 0.37500000 with 2.    Since 0.75000000 is < 1. then add 0 to result
       > Multiply 0.75000000 with 2.    Since 1.50000000 is >= 1. then add 1 to result
       > Multiply 0.50000000 with 2.    Since 1.00000000 is >= 1. then add 1 to result
       > This is equal to 1, so, stop calculating
   0.08500000000000085 of decimal is .00010101110000101000111101011100001010001111011 in binary
   so, 20.085 in binary is 10100.00010101110000101000111101011100001010001111011
20.085 in simple binary => 10100.00010101110000101000111101011100001010001111011
so, 20.085 in normal binary is 10100.00010101110000101000111101011100001010001111011 => 1.010000010101110000101 * 2^4

single precision:
--------------------
sign bit is 0(+ve)
exponent bits are (127+4=131) => 10000011
   Divide 131 successively by 2 until the quotient is 0
       > 131/2 = 65, remainder is 1
       > 65/2 = 32, remainder is 1
       > 32/2 = 16, remainder is 0
       > 16/2 = 8, remainder is 0
       > 8/2 = 4, remainder is 0
       > 4/2 = 2, remainder is 0
       > 2/2 = 1, remainder is 0
       > 1/2 = 0, remainder is 1
   Read remainders from the bottom to top as 10000011
   So, 131 of decimal is 10000011 in binary
frac/significant bits are 01000001010111000010100

so, 20.085 in single-precision format is 0 10000011 01000001010111000010100
Hexadecimal Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111
Use this table to convert from binary to hexadecimal
Converting 01000001101000001010111000010100 to hexadecimal
0100 => 4
0001 => 1
1010 => A
0000 => 0
1010 => A
1110 => E
0001 => 1
0100 => 4
So, in hexadecimal 01000001101000001010111000010100 is 0x41A0AE14

in hexadecimal it is 0x41A0AE14

2)
20.085
Converting 20.085 to binary
   Convert decimal part first, then the fractional part
   > First convert 20 to binary
   Divide 20 successively by 2 until the quotient is 0
       > 20/2 = 10, remainder is 0
       > 10/2 = 5, remainder is 0
       > 5/2 = 2, remainder is 1
       > 2/2 = 1, remainder is 0
       > 1/2 = 0, remainder is 1
   Read remainders from the bottom to top as 10100
   So, 20 of decimal is 10100 in binary
   > Now, Convert 0.08500000 to binary
       > Multiply 0.08500000 with 2.    Since 0.17000000 is < 1. then add 0 to result
       > Multiply 0.17000000 with 2.    Since 0.34000000 is < 1. then add 0 to result
       > Multiply 0.34000000 with 2.    Since 0.68000000 is < 1. then add 0 to result
       > Multiply 0.68000000 with 2.    Since 1.36000000 is >= 1. then add 1 to result
       > Multiply 0.36000000 with 2.    Since 0.72000000 is < 1. then add 0 to result
       > Multiply 0.72000000 with 2.    Since 1.44000000 is >= 1. then add 1 to result
       > Multiply 0.44000000 with 2.    Since 0.88000000 is < 1. then add 0 to result
       > Multiply 0.88000000 with 2.    Since 1.76000000 is >= 1. then add 1 to result
       > Multiply 0.76000000 with 2.    Since 1.52000000 is >= 1. then add 1 to result
       > Multiply 0.52000000 with 2.    Since 1.04000000 is >= 1. then add 1 to result
       > Multiply 0.04000000 with 2.    Since 0.08000000 is < 1. then add 0 to result
       > Multiply 0.08000000 with 2.    Since 0.16000000 is < 1. then add 0 to result
       > Multiply 0.16000000 with 2.    Since 0.32000000 is < 1. then add 0 to result
       > Multiply 0.32000000 with 2.    Since 0.64000000 is < 1. then add 0 to result
       > Multiply 0.64000000 with 2.    Since 1.28000000 is >= 1. then add 1 to result
       > Multiply 0.28000000 with 2.    Since 0.56000000 is < 1. then add 0 to result
       > Multiply 0.56000000 with 2.    Since 1.12000000 is >= 1. then add 1 to result
       > Multiply 0.12000000 with 2.    Since 0.24000000 is < 1. then add 0 to result
       > Multiply 0.24000000 with 2.    Since 0.48000000 is < 1. then add 0 to result
       > Multiply 0.48000000 with 2.    Since 0.96000000 is < 1. then add 0 to result
       > Multiply 0.96000000 with 2.    Since 1.92000000 is >= 1. then add 1 to result
       > Multiply 0.92000000 with 2.    Since 1.84000000 is >= 1. then add 1 to result
       > Multiply 0.84000000 with 2.    Since 1.68000001 is >= 1. then add 1 to result
       > Multiply 0.68000001 with 2.    Since 1.36000001 is >= 1. then add 1 to result
       > Multiply 0.36000001 with 2.    Since 0.72000003 is < 1. then add 0 to result
       > Multiply 0.72000003 with 2.    Since 1.44000006 is >= 1. then add 1 to result
       > Multiply 0.44000006 with 2.    Since 0.88000011 is < 1. then add 0 to result
       > Multiply 0.88000011 with 2.    Since 1.76000023 is >= 1. then add 1 to result
       > Multiply 0.76000023 with 2.    Since 1.52000046 is >= 1. then add 1 to result
       > Multiply 0.52000046 with 2.    Since 1.04000092 is >= 1. then add 1 to result
       > Multiply 0.04000092 with 2.    Since 0.08000183 is < 1. then add 0 to result
       > Multiply 0.08000183 with 2.    Since 0.16000366 is < 1. then add 0 to result
       > Multiply 0.16000366 with 2.    Since 0.32000732 is < 1. then add 0 to result
       > Multiply 0.32000732 with 2.    Since 0.64001465 is < 1. then add 0 to result
       > Multiply 0.64001465 with 2.    Since 1.28002930 is >= 1. then add 1 to result
       > Multiply 0.28002930 with 2.    Since 0.56005859 is < 1. then add 0 to result
       > Multiply 0.56005859 with 2.    Since 1.12011719 is >= 1. then add 1 to result
       > Multiply 0.12011719 with 2.    Since 0.24023438 is < 1. then add 0 to result
       > Multiply 0.24023438 with 2.    Since 0.48046875 is < 1. then add 0 to result
       > Multiply 0.48046875 with 2.    Since 0.96093750 is < 1. then add 0 to result
       > Multiply 0.96093750 with 2.    Since 1.92187500 is >= 1. then add 1 to result
       > Multiply 0.92187500 with 2.    Since 1.84375000 is >= 1. then add 1 to result
       > Multiply 0.84375000 with 2.    Since 1.68750000 is >= 1. then add 1 to result
       > Multiply 0.68750000 with 2.    Since 1.37500000 is >= 1. then add 1 to result
       > Multiply 0.37500000 with 2.    Since 0.75000000 is < 1. then add 0 to result
       > Multiply 0.75000000 with 2.    Since 1.50000000 is >= 1. then add 1 to result
       > Multiply 0.50000000 with 2.    Since 1.00000000 is >= 1. then add 1 to result
       > This is equal to 1, so, stop calculating
   0.08500000000000085 of decimal is .00010101110000101000111101011100001010001111011 in binary
   so, 20.085 in binary is 10100.00010101110000101000111101011100001010001111011
20.085 in simple binary => 10100.00010101110000101000111101011100001010001111011
so, 20.085 in normal binary is 10100.00010101110000101000111101011100001010001111011 => 1.010000010101110000101000111101011100001010001111011 * 2^4

64-bit format:
--------------------
sign bit is 0(+ve)
exponent bits are (1023+4=1027) => 10000000011
   Divide 1027 successively by 2 until the quotient is 0
       > 1027/2 = 513, remainder is 1
       > 513/2 = 256, remainder is 1
       > 256/2 = 128, remainder is 0
       > 128/2 = 64, remainder is 0
       > 64/2 = 32, remainder is 0
       > 32/2 = 16, remainder is 0
       > 16/2 = 8, remainder is 0
       > 8/2 = 4, remainder is 0
       > 4/2 = 2, remainder is 0
       > 2/2 = 1, remainder is 0
       > 1/2 = 0, remainder is 1
   Read remainders from the bottom to top as 10000000011
   So, 1027 of decimal is 10000000011 in binary
frac/significant bits are 0100000101011100001010001111010111000010100011110110

so, 20.085 in 64-bit format is 0 10000000011 0100000101011100001010001111010111000010100011110110
Hexadecimal Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111
Use this table to convert from binary to hexadecimal
Converting 0100000000110100000101011100001010001111010111000010100011110110 to hexadecimal
0100 => 4
0000 => 0
0011 => 3
0100 => 4
0001 => 1
0101 => 5
1100 => C
0010 => 2
1000 => 8
1111 => F
0101 => 5
1100 => C
0010 => 2
1000 => 8
1111 => F
0110 => 6
So, in hexadecimal 0100000000110100000101011100001010001111010111000010100011110110 is 0x403415C28F5C28F6

in hexadecimal it is 0x403415C28F5C28F6

Add a comment
Know the answer?
Add Answer to:
convert 20.085 to IEEE-754 single precision and double precision both. Need a lot of explanation. (Atleast...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT