Decimal to binary step 19: illustration of binary misleading


Just working through JavaScript and I thought the representation of binary was a bit misleading. That’s if I remember correctly from what I learned when working with C in the past.

I thought the right way to think about it is:

Decimal 1 = 0001
Decimal 2 = 0010
Decimal 3 = 0011

The table in the exercise depicts binary without the leading 0 which I think are key.

It also uses the wording “binary numbers are formed from left to right” based on the on the greatest value . I think a simpler way to explain binary is that you count up from left to right… i.e. 0001, 0010, 0011.

Any thoughts on whether it’s clear enough as it is or if my way of looking at it might be easier or clearer?

Remember C was the first programming language and was alot different at its core beginning, So C had one way of doing this and ? all have another. I hope this helps.

would you also like to write the base-10 numbers as 0001, 0002 and so on?
leading 0 have no meaning, some programming languages require them as numbers are of a fixed length

I think to bring this introduction to binary more in line with the way binary is commonly depicted I would make the table from 1-15 and show all binary values up to 1111.

(I would put a footnote to mention that this is also maps to the 0-9, A-F Hex values).

You are right leading zeros are not so important, but I think in explanatory text when you are discussing decimals and binary you know when you see 0001 that it’s binary. It also helps to start to visualise in terms of bytes.

For the table I would at least right align the binary, that way it’s easier to visualise that the 1001 is 1000 + 0001 as you glance down the table.

I think the paragraph below the table is too wordy. I would probably make some simpler bullet points like;

  • Decimal 0 = binary 0000
  • Decimal 1 = binary 0001
  • Decimal 2; we have to add a second binary digit to the left = binary 0010
  • Decimal 3; we can add binary 1 to the above: = binary 0011
    (above can be with / without leading zeros)

Explanatory bullets like that could remove a lot of the wordiness in the text before and after the table.

Step 20 goes on to explain more about bytes and larger numbers, I also think it’s a bit wordy and step 19 / 20 can be streamlined a bit.

I’d be happy to draft an altnernate proposal, but just really gauging if anyone else thinks it is worthwhile for now.

Thanks Rob, it’s more the way I generally see binary depicted, but it might just be my more limited viewpoint :slight_smile:

1 Like

Note - C definitely was not the first programming language

Then Google must be wrong or I misread it. :grinning:

There’s a ton of languages older than C, to include Fortran and COBOL.