How to convert binary to octal

Author: Peter Berry
Date Of Creation: 16 February 2021
Update Date: 28 June 2024
Anonim
Binary to Octal Conversion
Video: Binary to Octal Conversion

Content

Binary and octal are two different coefficients commonly used in computers. Different from radix: base 2 has octal and octal 8, so they need to be grouped for conversion. This sounds complicated, but the transformation is actually very simple.

Steps

Method 1 of 2: Manual transfer

  1. Recognize the binary sequence. Binary strings are simple strings composed of the characters 1 and 0, such as 101001, 001, or even 1. These strings are usually binary numbers. Additionally, some books and teachers also symbolize binary numbers through subscript "2", such as 1001.2, to avoid confusion with the number "one thousand and one".
    • The subscript indicates the "base" for a number. Binary is the base two system, and octal is the base 8 system.

  2. Group the characters 1 and 0 in a binary number into sets of three, starting from right to left. There are eight different characters or digits used in octal and only two in binary. So we need three binary digits to represent an octal number. Group numbers from right to left. For example, the binary number 101001 will be divided into 101 001.

  3. Add zeros to the left of the last digit if there are not enough digits to form a triple. The number 10011011 has eight digits, and even though eight is not divisible by three, you can convert it to octal by adding zeros first until the triples are complete. For example:
    • Original number: 10011011
    • Group: 10 011 011
    • Add zeros so that each group has three elements: 010 011 011

  4. Add 4, 2 and 1 below each of the trio to note location. Each binary number in each triplet represents a place in the octal coefficient. The first number is position 4, the second number is position 2, and the third number corresponds to position 1. For simplicity, write these numbers directly below your binary triplets. For example:
    • 010 011 011
      421 421 421
    • 001
      421
    • 110 010 001
      421 421 421
    • Note: for the shortcut, you can skip this step and just compare binary sets with this octal conversion table.
  5. When 1 is on a number indicating a position, write that number (4, 2, or 1) to start the octal number. If on "4" there is a number 1 then your octal number has a number 4. If 0 is above a number indicating a position, your octal number will not contain that number and we will leave it blank, no or sign dash there. Consider the example problem:
    • Threads:
      • Transfer 1010100112 to octal.
    • Group three:
      • 101 010 011
    • Add location indicators:
      • 101 010 011
        421 421 421
    • Evaluate each position:
      • 101 010 011
        421 421 421
        401 020 021
  6. Add up the new numbers in each triple. Once you locate the octal number, simply find the sum of the values ​​in the triple. So with 101, we have 4, 0, 1 and get 5 (). Continuing the example above:
    • Threads:
      • Transfer 1010100112 to octal.
    • Group three, add location metrics, and evaluate each placement:
      • 101 010 011
        421 421 421
        401 020 021
    • Add up each of the three groups:
  7. Combine the results obtained to form the final octal number. Dividing a binary number makes it easier to solve math problems - the initial number is just a simple string of characters. So now, after converting, we need to merge everything together to get the final result. That is all.
    • Threads:
      • Transfer 1010100112 to octal.
    • Group three, add location numbers, evaluate locations, and find totals:
      • 101 010 011
        5 — 2 — 3
    • Combine the numbers together:
      • 523
  8. Add subscript under 8 (like this one 8) to complete the conversion. Without this notation, it would be impossible to determine if 523 is an ordinary octal number or a decimal number. To let your teacher know that you got the correct answer, add an index below 8, indicating that it is an octal number, in base 8, in your answer.
    • Threads:
      • Transfer 1010100112 to octal.
    • Convert:
      • 523.
    • Final answer:
      • 5238
    advertisement

Method 2 of 2: Toggle switches and variations

  1. Use a simple octal converter to save time and do your homework. Although not used in the test, this is a great choice for other cases. Since there are only 8 number combinations, memorizing is not difficult at all. Just divide the numbers into groups of three and compare them with the table in the picture.
    • Note there is no direct conversion for 8 and 9. In octal, these numbers are does not exist because there are only 8 digits (0-7) in the base 8 system.
  2. If there is an odd part, we will keep the comma and start converting from there. Consider the case of converting the binary number 10010,11 into an octal number. Usually, you switch from right to left and start with a group of three. With a comma, you make the transition from that position: for the part to the left of the comma (10010), you start from there and convert from right to left (010 010). With the right part (, 11), you start from the comma and convert from left to right (110). When adding zero, zeros are always added in the conversion direction. Our third group result would be 010 010, 110.
    • 101,1 → 101 , 100
    • 1,01001 → 001 , 010 010
    • 1001101,0101 → 001 001 101 , 010 100
  3. Use the octal converter table to convert octal back to binary. You need the table for the reverse conversion, because just "3" will not give you enough information to do the math unless you already understand the octal system and want to rethink each combinator. Using the table below will make it easy to convert each octal digit into a set of three binary digits and then combine them together:
    • 0 → 000
    • 1 → 001
    • 2 → 010
    • 3 → 011
    • 4 → 100
    • 5 → 101
    • 6 → 110
    • 7 → 111
    advertisement

Advice

  • Take your time to break down numbers. Ideally, you should use large paper with plenty of space to work with.