The Truth of Falsehood

A thought came to me on the way home from work today.  How many computer programmers today understand how something as simple as a Boolean works?  I know it sounds silly to some of you, but if you grew up in a time when you have been abstracted from such concepts, you may take our humble data type for granted.  In the next few paragraphs I hope to enlighten you and give you a deeper understanding of the Boolean operator and why it works the way it does.

Let’s start off with a web definition for the Boolean and then I will explain what the title of this post “The Truth of Falsehood” really means.



adjective: Boolean

  1. Denoting a system of algebraic notation used to represent logical propositions, esp. in computing and electronics.

noun: Boolean; plural noun: Booleans

  1. A binary variable, having two possible values called “true” and “false.”

If we look at the definition for the noun, it states that the boolean is a binary value.  This is our first clue as to how the Boolean does what it does.  Binary data is data whose unit can take on only two possible values, traditionally termed 0 and 1 in accordance with the binary numeral system and Boolean algebra.  Computer work with ones and zeros only.  They do this because underneath all the programming, the computer can only store two states.  As the character Gary Winston said in the movie Antitrust: “You’re either a one or a zero. Alive or dead.”

Let’s take a look at the answer to life the universe and everything, the number 42.  double-methodIf this number is represented as a binary value it is 0010 1010.  Each digit is right to left represents a higher number.  Let’s take a look at this binary to decimal conversion chart.

This demonstrates how the number can be represented in the computer’s memory.  This representation of the byte is only 1 byte.  A computer with only 4 gigabytes of RAM can store 4,294,967,296 bytes in its memory alone!

So how many of these bits are needed to make a Boolean?  One.  That’s right only 1 bit is needed.  You remember bit from the movie Tron right?  He was Bit_transparentFlynn’s companion that could only answer yes or no.  If you don’t know what I’m talking about, time to cowboy up and go watch the movie.

Now let’s get back to the title of the post.  What does “The Truth of Falsehood” mean?  Well put simply, when a computer needs to determine if something is true or false it looks for the false value.  The Boolean determines if the bit is turned off.  If it is, then the Boolean is false.  Allow me to demonstrate with the help of some C# code.

Boolean ConversionNotice that all of the numbers that were not zero evaluate to true.  Thus the truth of falsehood means that if the bit is turned off, or 0, then the value is false.  Therefore any other value must be true.

I hope you enjoyed this glimpse into the life of the Boolean operator.  If you liked this post and want to see more, drop me a line.  Until then, allow me to leave you this little riddle from the 1986 movie Labyrinth, Sarah’s Certain Death Riddle.  It’s what got me thinking about this in the first place.


One thought on “The Truth of Falsehood

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s