wpe41.gif (23084 bytes)CIS3355: Business Data Structures
Fall, 2008
 

What is Octal, and why is it important?

As we saw, In decimal (Base 10) there were 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9
Binary (base 2) consisted of 2 digits: 0 and 1
 

In Octal (Base 8) we have 8 digits: 0, 1, 2, 3, 4, 5, 6, and 7

So ?? How is that helpful ??

It just so happens that it is very convenient to convert from binary to octal, and octal to binary.

Remember that 23 = 8, meaning that we could represent all of the digits from 0 to 7 (the digits available in octal). Let's take a look at all of the combinations we have with three bits:

Octal Binary
0 000
1 001
2 010
3 011
4 100
5 101
6 110
7 111

So ?? I still don't see how this is helpful ??

Remember how difficult it was to change, say, 15710 to binary?

Or to convert the binary value 100111012 to decimal?

Binary Digit 1 0 0 1 1 1 0 1  
Position (Exponent): 7 6 5 4 3 2 1 0  

Multiplier:

128     16 8 4   1  
         
Sum

128 +

    16  +

8  +

4  +

  1  = 157

Converting between Octal and binary is a piece of cake. Suppose you wish to convert the octal value 6528 into binary. All we have to do is directly map the digits as given in the first table above:

6 5 2
110 101 010

Or:    6528  = 1 1 0 1 0 1 0 1 02.

Similarly, if we wanted to find out what the octal value of the binary number 100011110110111012 was in octal, we could again directly map the value from the table. All we need to do is take 3-bits at a time, starting from the right:

10 001 111 011 011 101
2 1 7 3 3 5

Or:    1 0 0 0 1 1 1 1 0 1 1 0 1 1 1 0 12 = 2173358

How do we know that this is true ??

Let's do this the hard way. Let's first convert in 6528 decimal, and then the decimal equivalent into binary (they should all be the same).

How can we convert from Octal to decimal ??

Remember, when we converted from binary to decimal, we noted that the procedure applied would work regardless of base. Therefore:

Octal Digit   6 5 2  
Position (Exponent):    2 1 0*  

Multiplier:

  82 = 64 81 = 8 80 = 1  

'True' Value:

  6 * 64 5 * 8 2 * 1  
     

Sum:

 

384   +

40     + 2  = 426

Wait!! How do we know that is true ??

 OK, let's convert 42610 back to Octal:

Now let's convert 42610  to binary:

Which is the binary value we began with.

Similarly, 1 0 0 0 1 1 1 1 0 1 1 0 1 1 1 0 12  is:

=  216       +     212   +     211    +     210   +    29   +    27   +  26 +   24 +  23 +  22 +  20
=  65,536 + 4,096  +  2, 048  +  1,024  +  512  +  128  +  64  + 16  +  8  +   4  +   1
73,43710

Now let's convert  73,43710 to Octal:

Which is where we started.

What about Hexadecimal ??

We'll get to that shortly.

Related Websites:

     http://www.purplemath.com/modules/numbbase3.htm
http://www.danbbs.dk/~erikoest/octal.htm

http://www.muine.org/~minhqt/Nax_website/c/binary.html
http://educ.queensu.ca/~compsci/units/encoding/numsys.html
http://www.danbbs.dk/~erikoest/octal.htm
www.psinvention.com/zoetic/base8.htm

Review Questions:

1.  The number 62 (decimal) in Octal would be: 

a.   62                                                        d.   76
b.   66                                                        e.   82
c.   67

[Correct Answer: D]

2.  The number 53 (Octal) in Decimal would be:

a.   35                                             d.   53
b.   43                                             e.   55
c
.   45

[Correct Answer: B]

3.  Why do we use octal?

The main reason is that it is very easy to convert from binary to Octal (base 8). Given three (3) bits we can represent 8 items (23 = 8) or all of the digits in the octal system (1 .. 7).

4.  Convert  the decimal value 43210 first to binary, then to Octal, then back to decimal.

5.  Convert  the 0ctal value 4328 first to binary, then to decimal, then back to Octal.

 

This page was last updated on 05/27/05