Hacker News new | past | comments | ask | show | jobs | submit login
Convert hexadecimal to binary in your head (lukerissacher.com)
63 points by QuadrupleA on Feb 2, 2016 | hide | past | favorite | 24 comments



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.


Wow, I was going to post almost exactly this -- TI-99/4A and all.

    CALL CHAR(128,"3C4299A1A199423C")


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!


This is great! Here's a demo of the full set to illustrate your point more fully.

http://play.golang.org/p/T1eJ4prBHM


Missing 9 and 6.

mirror pairs

(1) 0001/1000 (8)

(2) 0010/0100 (4)

(3) 0011/1100 (C)

(5) 0101/1010 (A)

(7) 0111/1110 (E)

(B) 1011/1101 (D)

(0) 0000/1111 (F)

Program exited.


Same here. The visual pattern created by 0-15 in binary is forever be etched into my memory.


Flippy Bit is another great way to practice this: http://flippybitandtheattackofthehexadecimalsfrombase16.com/


Thanks :)


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


It's faster to just see 0xf3 and then compute 256 - 13.


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.


I giggled at `A/10` ... Thank you for that.


http://games.usvsth3m.com/binary/

UPDATE: seems like the game is broken now. It used to work and it was quite fun.


The archive.org version still works [1]. Thank you for the recommendation!

[1] https://web.archive.org/web/20150101030559/http://games.usvs...


Ah, thanks for the pointer. Good to have Wayback machine around :)


Thanks for pointing the archived version out.


If you're looking for an android app helping you master base conversions: https://play.google.com/store/apps/details?id=me.akeel.baseg...

Free version: https://play.google.com/store/apps/details?id=me.akeel.baseg...


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.


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.


The photoshop operatives are following me.... They want my lucky charms (hex digits!)


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.


Why can't imagemagick convert to 2k pixels.


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.


Have you ever considered this might be compulsive behavior?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: