CIS3355:
Business Data Structures |
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 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:
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?
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:
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:
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:
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 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 Review Questions: 1. The number 62 (decimal) in Octal would be:
2. The number 53 (Octal) in Decimal would be:
3. Why do we use octal?
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.
|