Question

convert -297.875 to single precision and double precision. Please show all the steps(atleast 500 words)

convert -297.875 to single precision and double precision.
Please show all the steps(atleast 500 words)

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

1)
-297.875
Converting 297.875 to binary
   Convert decimal part first, then the fractional part
   > First convert 297 to binary
   Divide 297 successively by 2 until the quotient is 0
       > 297/2 = 148, remainder is 1
       > 148/2 = 74, remainder is 0
       > 74/2 = 37, remainder is 0
       > 37/2 = 18, remainder is 1
       > 18/2 = 9, remainder is 0
       > 9/2 = 4, remainder is 1
       > 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 100101001
   So, 297 of decimal is 100101001 in binary
   > Now, Convert 0.87500000 to binary
       > Multiply 0.87500000 with 2.    Since 1.75000000 is >= 1. then add 1 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.875 of decimal is .111 in binary
   so, 297.875 in binary is 100101001.111
-297.875 in simple binary => 100101001.111
so, -297.875 in normal binary is 100101001.111 => 1.00101001111 * 2^8

single precision:
--------------------
sign bit is 1(-ve)
exponent bits are (127+8=135) => 10000111
   Divide 135 successively by 2 until the quotient is 0
       > 135/2 = 67, remainder is 1
       > 67/2 = 33, remainder is 1
       > 33/2 = 16, remainder is 1
       > 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 10000111
   So, 135 of decimal is 10000111 in binary
frac/significant bits are 00101001111000000000000

so, -297.875 in single-precision format is 1 10000111 00101001111000000000000
in hexadecimal it is 0xC394F000

2)
-297.875
Converting 297.875 to binary
   Convert decimal part first, then the fractional part
   > First convert 297 to binary
   Divide 297 successively by 2 until the quotient is 0
       > 297/2 = 148, remainder is 1
       > 148/2 = 74, remainder is 0
       > 74/2 = 37, remainder is 0
       > 37/2 = 18, remainder is 1
       > 18/2 = 9, remainder is 0
       > 9/2 = 4, remainder is 1
       > 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 100101001
   So, 297 of decimal is 100101001 in binary
   > Now, Convert 0.87500000 to binary
       > Multiply 0.87500000 with 2.    Since 1.75000000 is >= 1. then add 1 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.875 of decimal is .111 in binary
   so, 297.875 in binary is 100101001.111
-297.875 in simple binary => 100101001.111
so, -297.875 in normal binary is 100101001.111 => 1.00101001111 * 2^8

64-bit format:
--------------------
sign bit is 1(-ve)
exponent bits are (1023+8=1031) => 10000000111
   Divide 1031 successively by 2 until the quotient is 0
       > 1031/2 = 515, remainder is 1
       > 515/2 = 257, remainder is 1
       > 257/2 = 128, remainder is 1
       > 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 10000000111
   So, 1031 of decimal is 10000000111 in binary
frac/significant bits are 0010100111100000000000000000000000000000000000000000

so, -297.875 in 64-bit format is 1 10000000111 0010100111100000000000000000000000000000000000000000
in hexadecimal it is 0xC0729E0000000000

Add a comment
Know the answer?
Add Answer to:
convert -297.875 to single precision and double precision. Please show all the steps(atleast 500 words)
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