Yesterday, in class our Prof introduced a shortcut for converting from decimal to binary but he didn’t know how it worked. Here is the method:

Why it works: What you are doing with each division is checking to see if the value needs to be represented with that particular bit and then dividing the value by that a factor of the new base. The easiest way to visualize converting from base 10 to base 10. Lets see how that looks

Back to base two, there are three options for each division

Option 1: You get a remainder of 1 — this means the bit is filled with a one and the number needs to be represented with that bit

Option 2: You get no remainder — this means the value doesn’t need to be represented by the current bit

Option 2a: The value remaining is greater than zero — the value needs larger bits to represent it

Option 2b: The value is equal to zero — the value is already fully represented

Hope this helped if you have been taught the “shortcut” method and didn’t know why it worked.

Quick note – I think you can extend this to converting from a number in base n to base m if you initially represent the number in base n and divide by m continuously. The difficulty is dividing in base n when n is not ten. I’ll check it out later

Advertisements