How do you convert a fraction to binary?

后端 未结 5 1590
野性不改
野性不改 2020-11-30 17:42

1/10(decimal) = 0.0001100110011... (binary)

How do I do that? Am I supposed to convert to binary and then divide? Could someone show me?

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 18:17

    This may be somewhat confusing, but the decimal positions in binary would represent reciprocals of powers of two (e.g., 1/2, 1/4, 1/8, 1/16, for the first, second, third and fourth decimal place, respectively) just as in decimal, decimal places represent reciprocals of successive powers of ten.

    To answer your question, you would need to figure out what reciprocals of powers of two would need to be added to add up to 1/10. For example:

    1/16 + 1/32 = 0.09375, which is pretty close to 1/10. Adding 1/64 puts us over, as does 1/128. But, 1/256 gets us closer still. So:

    0.00011001 binary = 0.09765625 decimal, which is close to what you asked.

    You can continue adding more and more digits, so the answer would be 0.00011001...

提交回复
热议问题