Articles from February, 2009

Google is a Binary, Hex, and Octal Number Calculator

Did you know you can use Google as a calculator? Type 1 + 2 + 4 + 8 + 16 + 32 into Google’s search box and you’ll get 63 as the result.

Did you know you can use the calculator with numbers in different bases? It can convert numbers between decimal, binary, hexadecimal, and octal, as well as do arithmetic in those bases. To work in a non-decimal base, just prefix numbers as follows: 0b for binary, for example, 0b1010; 0x for hexadecimal, for example, 0xFF; and 0o for octal, for example, 0o701.

Continue reading …

What a Binary Counter Looks and Sounds Like

This is what it sounds like to count from 1 to 255 in binary (music courtesy of Jake Joaquin). It’s so simple, reflecting the simplicity of binary code; yet it speaks volumes about the structure of binary numbers. It inspired me to draw a picture, so I could see what binary counting looks like as well:

Binary counter diagram thumbnail

Visual Interpretation of the Binary Clicker (click image for higher resolution).

Continue reading …

Ki-Adi-Mundi Has a Binary Brain Too

I’m not the only one with a binary brain.

The other day my son showed me a page in a Star Wars® book which described a character named Ki-Adi-Mundi, who up until that point we knew as “big brain head.” I read in his bio that he has a binary brain, at which point I exclaimed, “Hey, just like me!” Well, not quite — his is binary in a different sense:

From starwars.com:

“Ki’s most distinguishing physical feature was an enlarged conical cranium that contained a binary brain.”

Continue reading …

A Simple C Program That Prints 2,098 Powers of Two

To write a computer program to print the first 1000 nonnegative powers of two, do you think you’d need to use arbitrary precision arithmetic? After all, 21000 is a 302-digit number. How about printing the first 1000 negative powers of two? 2-1000 weighs in at a whopping 1000 decimal places. It turns out all you need is standard double-precision floating-point arithmetic — and the right compiler!

Continue reading …

Print Precision of Floating-Point Integers Varies Too

Recently I showed that programming languages vary in how much precision they allow in printed floating-point fractions. Not only do they vary, but most don’t meet my standard — printing, to full precision, decimal values that have exact floating-point representations. Here I’ll present a similar study for floating-point integers, which had similar results.

Continue reading …

A Pattern in Powers of Ten and Their Binary Equivalents

In my article “One Hundred Cheerios in Binary”, I made a comment about the decimal number 100, and its binary equivalent, 1100100:

“And will they wonder if the two sub strings of ‘100′ in the binary number have any significance?”

What I meant is if a novice might wonder if a decimal string made up of 1s and 0s must appear in its binary equivalent. Of course that’s not true in general, but it is true for nonnegative powers of ten — the trailing digits of the binary number will match the power of ten!

Continue reading …

One Hundred Cheerios in Binary

My son had to do a project for his 100th day of first grade. Since I’ve been teaching him binary — he knows the powers of two from 1 to 512 — we decided to incorporate it into his project. His assignment was to assemble 100 objects in a creative way. This is as creative as I get:

One Hundred Cheerios, in Binary.

One Hundred Cheerios®, in Binary.

Continue reading …