top | item 11023332

Convert hexadecimal to binary in your head

63 points| QuadrupleA | 10 years ago |lukerissacher.com | reply

24 comments

order
[+] svachalek|10 years ago|reply
I learned programming on a TI-99/4A which required you to enter graphics as bitmaps in hex. I've never lost the ability to "see" hex numbers as binary.

I don't know if there's still a use for such a skill, but if you care, I learned it as a set of 8 pairs: first, 0 and F are easy, right? 9 and 6 are 1001 and 0110, and a 9 looks like an upside-down 6 so hopefully you can remember that pair.

That leaves 12 digits, and they come in mirror-image pairs: 1/8, 2/4, 3/C, 5/A, 7/E, B/D. You know which hex digit is larger, and the larger binary is heavier on the left side, e.g. D is 1101 and B is 1011.

[+] bitwize|10 years ago|reply
Wow, I was going to post almost exactly this -- TI-99/4A and all.

    CALL CHAR(128,"3C4299A1A199423C")
[+] aji|10 years ago|reply
I do something similar, but instead of 8 groups of 2 I have 4 groups of 4: 00xx 01xx 10xx and 11xx.

I also have some freebie groups that I just know, like 0001 0011 0111 1111, the powers of two, 5 and 6 from working with chmod, etc.

A B D E still give me trouble, but that's what a tool like this hex quiz is good for!

[+] colanderman|10 years ago|reply
Same here. The visual pattern created by 0-15 in binary is forever be etched into my memory.
[+] tdeck|10 years ago|reply
All this talk about mental-math base conversions reminded me of the "double-dabble" algorithm, which lets you quickly convert binary to decimal in your head.

> In the 1960s, the term double dabble was also used for a different mental algorithm, used by programmers to convert a binary number to decimal. It is performed by reading the binary number from left to right, doubling if the next bit is zero, and doubling and adding one if the next bit is one.[4] In the example above, 11110011, the thought process would be: "one, three, seven, fifteen, thirty, sixty, one hundred twenty-one, two hundred forty-three," the same result as that obtained above.

https://en.wikipedia.org/wiki/Double_dabble#Historical

[+] pklausler|10 years ago|reply
It's faster to just see 0xf3 and then compute 256 - 13.
[+] tbabb|10 years ago|reply
Cool. Many languages allow 0b11110000 style notation, though. If that's available, it's much preferable to hex when the bit arrangement matters. One should not ever force the reader to do the mental work of this quiz if it can be helped.
[+] hrrld|10 years ago|reply
I giggled at `A/10` ... Thank you for that.
[+] Theodores|10 years ago|reply
I do find it shocking that 'kids today' really do not appreciate knowing a little bit of 'hex' and how that relates to 1's and 0's. Numbers like 384, 768 and other common multiples should be understood as computationally significant. Same with numbers like 255, 16383 and so forth - people who work with code should mentally have an image of lots of '1's with these numbers, but they don't. One should not have to explain this stuff except to people, and, this article kind of sums that up, there are a lot of people out there that just were not brought up on the cusp of 8/16 bit computing!!!

For me this has been the case with images in particular. Why have some Photoshop operative spend all day cropping images to (say) 2000 pixels square when you could have Imagemagick just do all of them to 2048 pixels square in a lot less time than it takes to have a cup of tea?

Many, many micro-managers prefer the former option, thinking that the Photoshop operative will not have the ability to type '2048' on their Wacom tablet. Sure, those images are not going to be OpenGL rendered but they might be shown on a web page with OpenSeaDragon (what?) and those 8x8 pixel tiles in the JPEG will survive making the thumbnails better. What is not to like? Why go for the computing equivalent of 'imperial measurements'???

The odd thing about these scenarios is that these micro-manager types get hung up on things like image dimensions whereas programmers just let the computer do the work, to 'abstract out' those little details and let the code do it.

[+] bschwindHN|10 years ago|reply
What are you even ranting about? Plenty of 'kids today' appreciate knowing a bit of hex. Are we talking about programmers, "micro-managers", or "Photoshop operatives"? Most programmers today are familiar with hex. But if you're expecting managers or Photoshop operatives to be able to convert hex to binary in their head, then I feel you have the wrong expectations.
[+] melbourne_mat|10 years ago|reply
On your point about young folks not learning about binary and hex.

I know these things myself since I started writing code 30 years ago and they were a necessity back then.

I'd love to justify all the obsolete stuff I have in my head (systems and microprocessor assembly languages that are long dead) but I cannot.

[+] netaustin|10 years ago|reply
This reminds me of a patience game I play. I count to 32 on one hand, with each finger representing a bit. If I'm doing it repeatedly, I'll count in my head in binary, octal, decimal, and hexadecimal. Works wonders when waiting for the subway or rocking a screaming baby.
[+] jquast|10 years ago|reply
Have you ever considered this might be compulsive behavior?