Decimal to binary

Thread Starter

Aria Nemati

Joined Jul 19, 2019
27
I am asked to convert 1.1 from decimal to 8 bit binary code, 4 bit for whole numbers and 4 bit for decimals.

When using the multiply by 2 method. I get 0001.0001. But the answer says it's rounded up to 0001.0010. I don't understand this "rounding up" How do I do that? When do I do that? How do I know if I should round up or not?
 

ci139

Joined Jul 11, 2016
1,696
try https://repl.it/repls/BronzeHomelyResource (check the script.js module , check the output - reveals the need for rounding ...)
you can get your binary and by dividing 11 by 10 . . . in binary (manually)
Code:
1011 / 1010 = 1.000110011001100...
00010···.234  1 23456789ABCDEFG
····01100.5
·····00100··.678
········01100.9
·········00100··.ABC
············01100.D
·············00100··.EFG
...
a bit different method :
 
Last edited:

WBahn

Joined Mar 31, 2012
26,398
I am asked to convert 1.1 from decimal to 8 bit binary code, 4 bit for whole numbers and 4 bit for decimals.

When using the multiply by 2 method. I get 0001.0001. But the answer says it's rounded up to 0001.0010. I don't understand this "rounding up" How do I do that? When do I do that? How do I know if I should round up or not?
You probably know how to do this (and have for many, many years).

Say I'm given 25/7 and I want to convert that to decimal to the nearest tenth. How do I determine whether or not to round up?
 

WBahn

Joined Mar 31, 2012
26,398
I get it. I have to manually check my answer after doing the multiply by 2 method and round up to the 2^x value that closest represents my decimal.
That's one way to do it, but you can also just do it the way you would do it if rounding the price of something to the nearest cent or your taxes to the nearest dollar.
 
Top