Question

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

convert 22/7 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)
3.142857142857143
Converting 3.142857142857143 to binary
   Convert decimal part first, then the fractional part
   > First convert 3 to binary
   Divide 3 successively by 2 until the quotient is 0
       > 3/2 = 1, remainder is 1
       > 1/2 = 0, remainder is 1
   Read remainders from the bottom to top as 11
   So, 3 of decimal is 11 in binary
   > Now, Convert 0.14285714 to binary
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571428 is < 1. then add 0 to result
       > Multiply 0.28571428 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285713 is >= 1. then add 1 to result
       > Multiply 0.14285713 with 2.    Since 0.28571427 is < 1. then add 0 to result
       > Multiply 0.28571427 with 2.    Since 0.57142854 is < 1. then add 0 to result
       > Multiply 0.57142854 with 2.    Since 1.14285707 is >= 1. then add 1 to result
       > Multiply 0.14285707 with 2.    Since 0.28571415 is < 1. then add 0 to result
       > Multiply 0.28571415 with 2.    Since 0.57142830 is < 1. then add 0 to result
       > Multiply 0.57142830 with 2.    Since 1.14285660 is >= 1. then add 1 to result
       > Multiply 0.14285660 with 2.    Since 0.28571320 is < 1. then add 0 to result
       > Multiply 0.28571320 with 2.    Since 0.57142639 is < 1. then add 0 to result
       > Multiply 0.57142639 with 2.    Since 1.14285278 is >= 1. then add 1 to result
       > Multiply 0.14285278 with 2.    Since 0.28570557 is < 1. then add 0 to result
       > Multiply 0.28570557 with 2.    Since 0.57141113 is < 1. then add 0 to result
       > Multiply 0.57141113 with 2.    Since 1.14282227 is >= 1. then add 1 to result
       > Multiply 0.14282227 with 2.    Since 0.28564453 is < 1. then add 0 to result
       > Multiply 0.28564453 with 2.    Since 0.57128906 is < 1. then add 0 to result
       > Multiply 0.57128906 with 2.    Since 1.14257812 is >= 1. then add 1 to result
       > Multiply 0.14257812 with 2.    Since 0.28515625 is < 1. then add 0 to result
       > Multiply 0.28515625 with 2.    Since 0.57031250 is < 1. then add 0 to result
       > Multiply 0.57031250 with 2.    Since 1.14062500 is >= 1. then add 1 to result
       > Multiply 0.14062500 with 2.    Since 0.28125000 is < 1. then add 0 to result
       > Multiply 0.28125000 with 2.    Since 0.56250000 is < 1. then add 0 to result
       > Multiply 0.56250000 with 2.    Since 1.12500000 is >= 1. then add 1 to result
       > Multiply 0.12500000 with 2.    Since 0.25000000 is < 1. then add 0 to result
       > Multiply 0.25000000 with 2.    Since 0.50000000 is < 1. then add 0 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.1428571428571428 of decimal is .001001001001001001001001001001001001001001001001001 in binary
   so, 3.142857142857143 in binary is 11.001001001001001001001001001001001001001001001001001
3.142857142857143 in simple binary => 11.001001001001001001001001001001001001001001001001001
so, 3.142857142857143 in normal binary is 11.001001001001001001001001001001001001001001001001001 => 1.1001001001001001001001 * 2^1

single precision:
--------------------
sign bit is 0(+ve)
exponent bits are (127+1=128) => 10000000
   Divide 128 successively by 2 until the quotient 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 10000000
   So, 128 of decimal is 10000000 in binary
frac/significant bits are 10010010010010010010010

so, 3.142857142857143 in single-precision format is 0 10000000 10010010010010010010010
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 01000000010010010010010010010010 to hexadecimal
0100 => 4
0000 => 0
0100 => 4
1001 => 9
0010 => 2
0100 => 4
1001 => 9
0010 => 2
So, in hexadecimal 01000000010010010010010010010010 is 0x40492492

in hexadecimal it is 0x40492492

2)
3.142857142857143
Converting 3.142857142857143 to binary
   Convert decimal part first, then the fractional part
   > First convert 3 to binary
   Divide 3 successively by 2 until the quotient is 0
       > 3/2 = 1, remainder is 1
       > 1/2 = 0, remainder is 1
   Read remainders from the bottom to top as 11
   So, 3 of decimal is 11 in binary
   > Now, Convert 0.14285714 to binary
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571429 is < 1. then add 0 to result
       > Multiply 0.28571429 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285714 is >= 1. then add 1 to result
       > Multiply 0.14285714 with 2.    Since 0.28571428 is < 1. then add 0 to result
       > Multiply 0.28571428 with 2.    Since 0.57142857 is < 1. then add 0 to result
       > Multiply 0.57142857 with 2.    Since 1.14285713 is >= 1. then add 1 to result
       > Multiply 0.14285713 with 2.    Since 0.28571427 is < 1. then add 0 to result
       > Multiply 0.28571427 with 2.    Since 0.57142854 is < 1. then add 0 to result
       > Multiply 0.57142854 with 2.    Since 1.14285707 is >= 1. then add 1 to result
       > Multiply 0.14285707 with 2.    Since 0.28571415 is < 1. then add 0 to result
       > Multiply 0.28571415 with 2.    Since 0.57142830 is < 1. then add 0 to result
       > Multiply 0.57142830 with 2.    Since 1.14285660 is >= 1. then add 1 to result
       > Multiply 0.14285660 with 2.    Since 0.28571320 is < 1. then add 0 to result
       > Multiply 0.28571320 with 2.    Since 0.57142639 is < 1. then add 0 to result
       > Multiply 0.57142639 with 2.    Since 1.14285278 is >= 1. then add 1 to result
       > Multiply 0.14285278 with 2.    Since 0.28570557 is < 1. then add 0 to result
       > Multiply 0.28570557 with 2.    Since 0.57141113 is < 1. then add 0 to result
       > Multiply 0.57141113 with 2.    Since 1.14282227 is >= 1. then add 1 to result
       > Multiply 0.14282227 with 2.    Since 0.28564453 is < 1. then add 0 to result
       > Multiply 0.28564453 with 2.    Since 0.57128906 is < 1. then add 0 to result
       > Multiply 0.57128906 with 2.    Since 1.14257812 is >= 1. then add 1 to result
       > Multiply 0.14257812 with 2.    Since 0.28515625 is < 1. then add 0 to result
       > Multiply 0.28515625 with 2.    Since 0.57031250 is < 1. then add 0 to result
       > Multiply 0.57031250 with 2.    Since 1.14062500 is >= 1. then add 1 to result
       > Multiply 0.14062500 with 2.    Since 0.28125000 is < 1. then add 0 to result
       > Multiply 0.28125000 with 2.    Since 0.56250000 is < 1. then add 0 to result
       > Multiply 0.56250000 with 2.    Since 1.12500000 is >= 1. then add 1 to result
       > Multiply 0.12500000 with 2.    Since 0.25000000 is < 1. then add 0 to result
       > Multiply 0.25000000 with 2.    Since 0.50000000 is < 1. then add 0 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.1428571428571428 of decimal is .001001001001001001001001001001001001001001001001001 in binary
   so, 3.142857142857143 in binary is 11.001001001001001001001001001001001001001001001001001
3.142857142857143 in simple binary => 11.001001001001001001001001001001001001001001001001001
so, 3.142857142857143 in normal binary is 11.001001001001001001001001001001001001001001001001001 => 1.1001001001001001001001001001001001001001001001001001 * 2^1

64-bit format:
--------------------
sign bit is 0(+ve)
exponent bits are (1023+1=1024) => 10000000000
   Divide 1024 successively by 2 until the quotient is 0
       > 1024/2 = 512, remainder is 0
       > 512/2 = 256, remainder is 0
       > 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 10000000000
   So, 1024 of decimal is 10000000000 in binary
frac/significant bits are 1001001001001001001001001001001001001001001001001001

so, 3.142857142857143 in 64-bit format is 0 10000000000 1001001001001001001001001001001001001001001001001001
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 0100000000001001001001001001001001001001001001001001001001001001 to hexadecimal
0100 => 4
0000 => 0
0000 => 0
1001 => 9
0010 => 2
0100 => 4
1001 => 9
0010 => 2
0100 => 4
1001 => 9
0010 => 2
0100 => 4
1001 => 9
0010 => 2
0100 => 4
1001 => 9
So, in hexadecimal 0100000000001001001001001001001001001001001001001001001001001001 is 0x4009249249249249

in hexadecimal it is 0x4009249249249249


Add a comment
Know the answer?
Add Answer to:
convert 22/7 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