# Base 10 to Base 2

Discussion in 'Homework Help' started by David Waddell, Apr 11, 2015.

Dec 3, 2014
24
1
I have an assignment which asks me to convert a denary number to 8 bit binary. The first number I have been given is 42.

42(BASE10) = 101010(BASE2)

I don't know if I'm being stupid or not. My answer only has 6 numbers, does an 8 bit binary have to have 8 numbers? Any clarification would be great.

2. ### Papabravo Expert

Feb 24, 2006
11,123
2,171
You can add two leading zeros. They don't affect the value and they satisfy the the requirement.

3. ### WBahn Moderator

Mar 31, 2012
20,221
5,746
If you were asked to write 42 as a six-digit decimal integer you would write it as 000042, right?

4. ### crutschow Expert

Mar 14, 2008
16,508
4,441
The number of bits indicates the maximum number that can be represented (for 8-bits it would be 255d), not that every number has to have 8-bits.

5. ### KeepItSimpleStupid Well-Known Member

Mar 4, 2014
2,068
359
8 bits can also represent 0-255, -128 to +127 or +-127 depending on the representation.

So, if you were asked to convert -42d into 8 bit binary, would you flinch? There could be two answers. What did teach say 8 bit binary is?

This is where I might win with lots of answers.

6. ### KeepItSimpleStupid Well-Known Member

Mar 4, 2014
2,068
359
"Convert to 8" means have 8 digits.

7. ### MrAl Distinguished Member

Jun 17, 2014
3,721
789
Hi,

A number like 1010 would simply be written as 00001010 to show all 8 bits.
So fill the missing leading digits with zeros because those bits have to be zero.