Decimal to Octal Conversion                                       octal1.rtf  p1 of 2

 Preface:

 In octal as in decimal (and any other numbering system) a given digit represents not only

 its own face value but the power or "weight" of its position in the number. This power

 increases from right to left.

 

 (Any number to the power of 0 is equal to 1. So 80 =1 and also 2,345,6780 equals 1.)

 (lsd =least significant digit ; msd =most significant digit)

 

 So in decimal, 7 standing alone represents 7 x 100 which is 7. But in the number 70 the 7

 represents its own face value (7) multiplied by the next power of 10 which is  7x101 =70.

 Octal is similar except that the powers are powers of 8 instead of 10. So 7 octal standing

 alone represents 7x80 =7.  (7 x1)

 But  70 octal represents 7x81 +0 =56 decimal.  

 And 356 octal would represent 3x82 + 5x81 + 6x80 =192 [3x64] +40 [5x8] +6 [6x1] =238

 decimal.

 

 Method:  

 This method determines the octal digits sequentially from right to left (lsd to msd) by

 imitating the increasing powers of 8 from lsd to msd.

 

 A simple approach is to divide the decimal number into groups of 8 (octets). Any remaind-

 er (rem) will be less than 8 and can be placed in the position of 80.  It's important to note

 that any remainder even zero is stored.

 Then, the number of octets is placed in the position of 81 and the resulting octal number

 is evaluated as  number of octets x8 + rem x80. =decimal equivalent.

 

 Example 1: Quotient Less Than 7 - Convert 55 decimal to octal

 Divide the original decimal value by 8. This quotient is the number of octets.

  (55 / 8) =6 (quotient)  with remainder (REM) 7

 Put the quotient (6) into octal value at 81  and the REM  (7) into octal value at position 80

 The resulting octal number is  678 (The subscript 8 denotes the numbering system - in

 this case octal).

 This is evaluated as 6 x81 + 7 x80   =48 +7  =5510

 We're done because both the quotient and remainder lay between 0 and 7.

 

 Example 2: Quotient Greater than 7 - Convert 35710 to octal.

 Most of the time a simple division by 8 will result in a quotient greater than 7.

    N8 represents the octal number.

 

 The first division by 8 will produce a REM between 0 and 7. This can go into the 80  slot of

 N8 (lsd).

  357 / 8  =44 (quotient) with REM =5

   N8 at 80 (lsd)  =5

  Our intermediate octal value is N8  =??58

 

 But the quotient is greater than 7 so it needs to be expressed in such a way that all of the

 digits of N8 lie between 0 and 7.

 Again divide the quotient  by 8. Division by 8 will always result in REM between 0 and 7

  44 /8 =5 (quotient) with REM 4

 This REM (4) goes into N8 at 81

  Now, our intermediate octal value is N8  =?458

 But now the quotient (5) also lies between 0 and 7 so it is put into the 82 position:

  N10 357  =N8 545

 And we're done.

 

 What's happening ?

 Dividing 35710 by 8 redefines 35710 as  44(8) plus 5(1). In octal, any value with a weight of

 8 lies in the 81 position - the second digit from the right. The value in this position is under-

 stood to be multiplied by 8. But octal requires all digits to be between 0 and 7 and 44 is

 outside this range.

 After the first pass the only value we can use is the REM of 5 which goes into the 80

 position with a weight of 1 - which means that its value is its face value of 5 ( 1 x 5).

 

 We need to redefine 4410 in such a way that all results fall between 0 and 7. So we divide

 44 by 8 to get a quotient of 5 with a remainder of 4. Again, the remainder goes into the

 next higher position of the octal value which now is 81 meaning that the value in this

 position equates to its face value (4) times 8.

 

 But now the quotient is also below 8 so it can go into the next higher position which is 82

 which means that any value in this position is multiplied by 64. So the transformation is

 complete :

   35710 which equates to 3(100) +5(10) +7(1)

 

 has been transformed into

 

  5458 which equates to 5(64) +4(8) +5(1)

 

 

 afk April 13, 2021

 afk May 17, 2024