# Decimal to binary

#### 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?

#### BobTPH

Joined Jun 5, 2013
3,821
What would be needed to round to 8 bits?

Bob

#### Aria Nemati

Joined Jul 19, 2019
27

#### jpanhalt

Joined Jan 18, 2008
11,088
What does 0.001 (binary) equal in decimal? What does 0.0001 in binary equal in decimal?

#### jpanhalt

Joined Jan 18, 2008
11,088
Are you sure? Doesn't 0.1 binary = 1/(2^1) = 0.5 decimal?

#### Aria Nemati

Joined Jul 19, 2019
27
What does 0.001 (binary) equal in decimal? What does 0.0001 in binary equal in decimal?
I didnt see the comma. I read 0001 and 00001
0.001 would be 2^-3 = 0.125 and 0.0001 would be 2^-4 = 0.0625

#### jpanhalt

Joined Jan 18, 2008
11,088
And so, rounding 0.1 decimal up would be???? Moreover, to which value (0.125 or 0.0625) is 0.1 decimal closest?

#### 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:

#### Aria Nemati

Joined Jul 19, 2019
27
And so, rounding 0.1 decimal up would be???? Moreover, to which value (0.125 or 0.0625) is 0.1 decimal closest?
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.

#### jpanhalt

Joined Jan 18, 2008
11,088
Great.

#### 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.