Computer Math

As many of us have already been told, computers only understand two different bits of information, 1 and 0.  However, an endless combination of 1s and 0s provides us with limitless information and computation capabilities.

The binary, or base 2, language is based on factorials of two.  In any binary string, the furthest right number represents 2 to the 0 (or 1).  The next number to the left, represents 2 to the power of 1 (or simply 2).  The next number to the left represents 2 squared (or 4).  This process continues on until we reach the furthest digit to the left.  If the binary character in the given position is one, we add that value to the number.  If the character is 0, we do not add the value.

For example, the binary number,  10011101b is equivalent to 128 + 16 + 8 + 4 + 1 or 157.   The place values for an 8 bit number are 128, 64, 32, 16, 8, 4, 2, 1.  We do not add the 2, 32 or 64 values as their positions are held by 0.

Each binary digit equals one bit.  Four bits equal a nibble.  Two nibbles (or 8 bits) is a byte.  Current computing systems typically allow for up to 64 bits for any given number.  The largest 64 bit number is somewhere around 9,223,372,036,854,776,000 (but not exactly).

Now imagine, converting a 64 bit binary number:


We can represent larger binary numbers using the hexadecimal system.  Hexidecimal can serve as a shorthand for binary.  Hexidecimal are a base 16 numbers.  Each binary nibble (4 bits) is broken down into one character.  The maximum number represented by any binary number is 2 to the nth – 1, where n represents the length of the binary string.  So, the largest number that can be represented by a nibble is 15.  In hexadecimal, we use the numeric characters to represent 0 – 9 and alpha characters A – F to represent 10 – 15 respectively.

So, using our previous example,  10011101b, which we earlier determined represented the decimal value of 157, we convert to a hexidecimal as follows:

  1. Break the binary number into nibbles:  1001   1101
  2. determine the decimal value of each nibble:  8 & 13
  3. Express in hexidecimal with the prefix of 0x:   0x8D

It is hardly worth converting this 8 bit binary number, but our 64 bit number above can be expressed as: 0xB777BEFDF875B83D.  Although still long, it is still 47 digits smaller than its binary counter part (including prefix/suffix for both expressions).

In a upcomming post, I will explain how binary is used to express alpha characters and negative numbers.


About Jesse Alber

Jesse Alber attained a Bachelor of Arts Degree in Speech Communications with an Athletic Coaching Endorsement from Hastings College in May, 1993. From 1994 - 2000, Alber served in leadership roles in human resources, retail, and production. Alber enlisted in the U.S. Army in 2000. He served as a Armored Cavalry Scout and Troop Training Manager with A 3/7 CAV 3d ID until 2004. Alber deployed to Bosnia in 2001 and Kwait / Iraq in 2003. Alber served in the Army Reserves from 2005 - 2008. From 2004 - 2010 Alber served as the Adult Education Coordinator for Central Community College and Executive Director for the Hastings Literacy Program. Alber returned to Hastings College in 2010 to study Computer Science and Web Design. He is currently emploed as a Programming and Web Development Intern with Servi-Tech Industries. Alber will complete his program of study in the summer of 2012.
This entry was posted in Uncategorized. Bookmark the permalink.

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s