How to set up smartphones and PCs. Informational portal
  • home
  • In contact with
  • Convert 115 decimal to binary. Converting numbers to binary, hexadecimal, decimal, octal number systems

Convert 115 decimal to binary. Converting numbers to binary, hexadecimal, decimal, octal number systems

Methods for converting numbers from one number system to another.

Translation of numbers from one positional number system to another: translation of integers.

To convert an integer from one number system with base d1 to another with base d2, you must sequentially divide this number and the resulting quotients by the d2 base of the new system until the quotient is less than the d2 base. The last quotient is the highest digit of the number in the new number system with base d2, and the numbers following it are the remainders from division, written in the reverse order of their receipt. Perform arithmetic operations in the number system in which the translated number is written.

Example 1. Convert the number 11(10) to the binary number system.

Answer: 11(10)=1011(2).

Example 2. Convert the number 122(10) to the octal number system.


Answer: 122(10)=172(8).

Example 3. Convert the number 500(10) to hexadecimal number system.


Answer: 500(10)=1F4(16).

Translation of numbers from one positional number system to another: translation of proper fractions.

To convert a proper fraction from a number system with base d1 to a system with base d2, it is necessary to successively multiply the original fraction and the fractional parts of the resulting products by the base of the new number system d2. The correct fraction of a number in the new number system with base d2 is formed as integer parts of the resulting products, starting from the first.
If the translation results in a fraction in the form of an infinite or divergent series, the process can be completed when the required accuracy is reached.

When translating mixed numbers, it is necessary to translate the integer and fractional parts separately into the new system according to the rules for translating integers and proper fractions, and then combine both results into one mixed number in the new number system.

Example 1. Convert the number 0.625(10) to the binary number system.


Answer: 0.625(10)=0.101(2).

Example 2. Convert the number 0.6 (10) to the octal number system.


Answer: 0.6(10)=0.463(8).

Example 2. Convert the number 0.7(10) to hexadecimal.


Answer: 0.7(10)=0.B333(16).

Convert binary, octal and hexadecimal numbers to decimal.

To convert the number of the P-ary system to decimal, you must use the following expansion formula:
anan-1…a1a0=anPn+ an-1Pn-1+…+ a1P+a0 .

Example 1. Convert the number 101.11(2) to the decimal number system.

Answer: 101.11(2)= 5.75(10) .

Example 2. Convert the number 57.24(8) to the decimal number system.

Answer: 57.24(8) = 47.3125(10) .

Example 3. Convert the number 7A,84(16) to the decimal number system.

Answer: 7A,84(16)= 122.515625(10) .


Converting octal and hexadecimal numbers to binary and vice versa.

To convert a number from octal to binary, each digit of this number must be written as a three-digit binary number (triad).

Example: Write down the number 16.24(8) in binary.


Answer: 16.24(8)= 1110.0101(2) .

To convert a binary number back to the octal number system, you need to divide the original number into triads to the left and right of the decimal point and represent each group as a number in the octal number system. Extreme incomplete triads are completed with zeros.

Example: Write the number 1110.0101(2) in octal.


Answer: 1110.0101(2)= 16.24(8) .

To convert a number from a hexadecimal number system to a binary one, each digit of this number must be written as a four-digit binary number (tetrad).

Example: write down the number 7A,7E(16) in binary number system.


Answer: 7A,7E(16)= 1111010,0111111(2) .

Note: Insignificant zeros on the left for integers and on the right for fractions are not recorded.

To convert a binary number back to the hexadecimal number system, you need to divide the original number into tetrads to the left and right of the decimal point and represent each group as a number in the hexadecimal number system. Extreme incomplete triads are completed with zeros.

Example: write the number 1111010.0111111(2) in hexadecimal.

Instruction

Related videos

In the counting system that we use every day, there are ten digits - from zero to nine. That is why it is called decimal. However, in technical calculations, especially those related to computers, other systems, specifically binary and hexadecimal. Therefore, you need to be able to translate numbers from one systems reckoning to another.

You will need

  • - a piece of paper;
  • - pencil or pen;
  • - calculator.

Instruction

The binary system is the simplest. It has only two digits - zero and one. Each digit of binary numbers, starting from the end, corresponds to a power of two. Two equals one, the first equals two, the second equals four, the third equals eight, and so on.

Suppose you are given a binary number 1010110. Units in it are in the second, third, fifth and seventh places from the end. So in decimal this number is 2^1 + 2^2 + 2^4 + 2^6 = 2 + 4 + 16 + 64 = 86.

Inverse problem - decimal numbers system. Suppose you have the number 57. To get its record, you must sequentially divide this number by 2 and write down the remainder of the division. The binary number will be built from the end to the beginning.
The first step will give you the last digit: 57/2 = 28 (remainder 1).
Then you get the second one from the end: 28/2 = 14 (remainder 0).
Further steps: 14/2 = 7 (remainder 0);
7/2 = 3 (remainder 1);
3/2 = 1 (remainder 1);
1/2 = 0 (remainder 1).
This is the last step because the result of the division is zero. As a result, you got the binary number 111001.
Check if your answer is correct: 111001 = 2^0 + 2^3 + 2^4 + 2^5 = 1 + 8 + 16 + 32 = 57.

The second, used in computer matters, is hexadecimal. It has not ten, but sixteen digits. To prevent new conventions, the first ten digits of the hexadecimal systems are indicated by ordinary numbers, and the remaining six - in Latin letters: A, B, C, D, E, F. they correspond to decimal notation numbers m from 10 to 15. To avoid confusion, a number written in hexadecimal is preceded by a # sign or 0x characters.

To number from hexadecimal systems, you need to multiply each of its digits by the corresponding power of sixteen and add the results. For example, #11A in decimal notation is 10*(16^0) + 1*(16^1) + 1*(16^2) = 10 + 16 + 256 = 282.

Reverse translation from decimal systems to hexadecimal is performed by the same method of remainders as in binary. For example, take the number 10000. By dividing it by 16 successively and writing down the remainder, you get:
10000/16 = 625 (remainder 0).
625/16 = 39 (remainder 1).
39/16 = 2 (remainder 7).
2/16 = 0 (remainder 2).
The result of the calculation will be the hexadecimal number #2710.
Check your answer: #2710 = 1*(16^1) + 7*(16^2) + 2*(16^3) = 16 + 1792 + 8192 = 10000.

Transfer numbers from hexadecimal systems binary is much easier. The number 16 is a two: 16 = 2^4. Therefore, each hexadecimal digit can be written as a four-digit binary number. If you get less than four digits in binary, add zeros to the beginning.
For example, #1F7E = (0001)(1111)(0111)(1110) = 1111101111110.
Check if your answer is correct: both numbers in decimal notation are 8062.

To translate, you need to break the binary number into groups of four digits, starting from the end, and replace each such group with a hexadecimal digit.
For example, 11000110101001 becomes (0011)(0001)(1010)(1001), which in hexadecimal is #31A9. The correctness of the answer is confirmed by converting to decimal notation: both numbers are equal to 12713.

Advice 5: How to convert a number to binary

Due to the limited use of symbols, the binary system is the most convenient for use in computers and other digital devices. There are only two characters: 1 and 0, so this system used in registers.

Instruction

Binary is positional, i.e. the position of each digit in the number corresponds to a certain digit, which is equal to two in the corresponding degree. The degree starts at zero and increases as you move from right to left. For example, number 101 is equal to 1*2^0 + 0*2^1 + 1*2^2 = 5.

Octal, hexadecimal and decimal systems are also widely used among positional systems. And if the second method is more applicable for the first two, then both are applicable for the translation from.

Consider decimal number to binary system method of successive division by 2. To translate the decimal number 25 in

Hello site visitor! We continue to study the IP network layer protocol, and to be more precise, its IPv4 version. At first glance, the topic binary numbers and binary number system has nothing to do with the IP protocol, but if you remember that computers work with zeros and ones, it turns out that the binary system and its understanding is the basis of the basics, we need learn how to convert numbers from binary to decimal and vice versa: decimal to binary. This will help us better understand the IP protocol, as well as how variable length netmasks work. Let's get started!

If you are interested in the topic of computer networks, you can read other course records.

4.4.1 Introduction

Before we start, it is worth explaining why a network engineer needs this topic. Although you could be convinced of its necessity when we talked, but, you can say that there are IP calculators that greatly facilitate the task of distributing IP addresses, calculating the necessary subnet / network masks and determining the network number and host number in IP address. That's how it is, but the IP calculator is not always at hand, this is the number one reason. Reason number two is that Cisco exams won't give you an IP calculator and that's it. converting IP addresses from decimal to binary you will have to do on a piece of paper, and there are not so few questions where this is required in the exam / exams for obtaining a CCNA certificate, it will be a shame if the exam is overwhelmed because of such a trifle. And finally, understanding the binary number system leads to a better understanding of the principle of operation.

In general, a network engineer is not required to be able to translate numbers from binary to decimal and vice versa in the mind. Moreover, rarely anyone knows how to do this in their minds, mainly teachers of various courses on computer networks belong to this category, since they are constantly faced with this every day. But with a piece of paper and a pen, you should learn how to translate.

4.4.2 Decimal digits and numbers, digits in numbers

Let's start simple and talk about binary digits and numbers, you know that numbers and numbers are two different things. A digit is a special symbol for designation, and a number is an abstract notation that means a quantity. For example, to write that we have five fingers on our hand, we can use Roman and Arabic numerals: V and 5. In this case, five is both a number and a number. And, for example, to write the number 20, we use two digits: 2 and 0.

In total, in the decimal number system, we have ten digits or ten characters (0,1,2,3,4,5,6,7,8,9), by combining which we can write different numbers. What principle do we follow when using the decimal number system? Yes, everything is very simple, we raise ten to one degree or another, for example, take the number 321. How can it be written differently, but like this: 3*10 2 +2*10 1 +1*10 0 . Thus, it turns out that the number 321 represents three digits:

  1. The number 3 means the most significant digit, or in this case it is the hundreds digit, otherwise their number.
  2. The number 2 is in the tens place, we have two tens.
  3. The number one is the least significant digit.

That is, in this entry, a deuce is not just a deuce, but two tens or two times ten. A triple is not just a triple, but three times a hundred. It turns out such a dependence: the unit of each next digit is ten times more than the unit of the previous one, because what 300 is is three times a hundred. A digression about the decimal number system was needed to make it easier to understand the binary.

4.4.3 Binary digits and numbers and their notation

There are only two digits in the binary number system: 0 and 1. Therefore, writing a number in binary is often much larger than in decimal. With the exception of the numbers 0 and 1, zero in binary is equal to zero in decimal, and the same is true for one. Sometimes, in order not to confuse in which number system the number is written, sub-indices are used: 267 10, 10100 12, 4712 8. The number in the sub-index indicates the number system.

The characters 0b and &(ampersand) can be used to write binary numbers: 0b10111, &111. If in the decimal number system, to pronounce the number 245, we use this construction: two hundred and forty-five, then in the binary number system, to name the number, we need to pronounce the number from each digit, for example, the number 1100 in the binary number system should not be pronounced as a thousand hundred, but as one, one, zero, zero. Let's look at the numbers from 0 to 10 in binary notation:

I think the logic should be clear by now. If in the decimal number system for each digit we had ten options available (from 0 to 9 inclusive), then in the binary number system in each of the digits of a binary number we have only two options: 0 or 1.

To work with IP addresses and subnet masks, natural numbers in the binary number system are enough for us, although the binary system allows us to write fractional and negative numbers, but we do not need this.

4.4.4 Converting numbers from decimal to binary

Let's get better at it, how to convert a number from decimal to binary. And here everything is actually very, very simple, although it is difficult to explain in words, so I will immediately give example of converting numbers from decimal to binary. Let's take the number 61, in order to convert to the binary system, we need to divide this number by two and see what happens in the remainder of the division. And the result of the division is again divided by two. In this case, 61 is the dividend, we will always have a two as a divisor, and we divide the quotient (the result of division) again by two, continue dividing until the quotient is 1, this last unit will be the leftmost digit . The figure below demonstrates this.

At the same time, note that the number 61 is not 101111, but 111101, that is, we write out the result from the end. There is no particular sense in dividing by two in the last one, since in this case integer division is used, and with this approach it turns out as in Figure 4.4.2.

This is not the fastest way to convert a number from binary to decimal. We have several accelerators. For example, the number 7 in the binary system is written as 111, the number 3 as 11, and the number 255 as 11111111. All these cases are outrageously simple. The fact is that the numbers 8, 4, and 256 are powers of two, and the numbers 7, 3, and 255 are one less than these numbers. So for a number that is one less than a number equal to a power of two, a simple rule applies: in the binary system, such a decimal number is written as a number of units equal to a power of two. So, for example, the number 256 is two to the eighth power, therefore, 255 is written as 11111111, and the number 8 is two to the third power, and this tells us that 7 in the binary system will be written as 111. Well, understand, how to write 256, 4 and 8 in binary is also not difficult, just add one: 256 = 11111111 + 1 = 100000000; 8 = 111 + 1 = 1000; 4 = 11 + 1 = 100.
You can check any of your results on a calculator, and at first it’s better to do so.

As you can see, we have not forgotten how to share yet. And now we can move on.

4.4.5 Converting numbers from binary to decimal

Converting numbers from the binary system is much easier than converting from decimal to binary. We will use the number 11110 as an example of translation. Pay attention to the table below, it shows the power to which you need to raise a two in order to eventually get a decimal number.

To get a decimal number from this binary number, you need to multiply each number in the digit by two to the power, and then add the multiplication results, it's easier to show:

1*2 4 +1*2 3 +1*2 2 +1*2 1 +0*2 0 = 16+8+4+2+0=30

Let's open the calculator and make sure that 30 in decimal is 11110 in binary.

We see that everything is done correctly. From the example it can be seen that converting a number from binary to decimal is much easier than converting back. To work with confidence, you only need to remember the powers of two up to 2 8 . For clarity, I will give a table.

We don’t need more, because the maximum possible number that can be written in one byte (8 bits or eight binary values) is 255, that is, in each octet of the IP address or IPv4 subnet mask, the maximum possible value is 255. There are fields , in which there are values ​​​​greater than 255, but we do not need to calculate them.

4.4.6 Addition, subtraction, multiplication of binary numbers and other operations with binary numbers

Let's now look at operations that can be performed on binary numbers. Let's start with simple arithmetic operations and then move on to Boolean algebra operations.

Binary addition

Adding binary numbers is not that hard: 1+0 =1; 1+1=0 (later I will give an explanation); 0+0=0. These were simple examples where only one digit was used, let's look at examples where the number of digits is more than one.
101 + 1101 in decimal is 5 + 13 = 18. Let's count in a column.

The result is highlighted in orange, the calculator says that we calculated correctly, you can check it. Now let's see why it happened, because at first I wrote that 1 + 1 = 0, but this is for the case when we have only one digit, for cases when there are more than one digits, 1 + 1 = 10 (or two in decimal), which is logical.

Then look what happens, we perform additions by digits from right to left:

1. 1+1=10, write zero, and one goes to the next bit.

2. In the next digit, 0+0+1=1 is obtained (this unit came to us from the result of addition in step 1).

4. Here we have a unit only for the second number, but it has been transferred here, so 0 + 1 + 1 = 10.

5. Glue everything together: 10|0|1|0.

If laziness is in a column, then let's count like this: 101011 + 11011 or 43 + 27 = 70. What can we do here, but let's look, because no one forbids us to make transformations, and the sum does not change from changing the places of the terms, for the binary number system this rule also applies.

  1. 101011 = 101000 + 11 = 101000 + 10 + 1 = 100000 + 1000 + 10 + 1.
  2. 11011 = 11000 + 10 + 1 = 10000 + 1000 + 10 + 1.
  3. 100000 + 10000 + (1000 +1000) + (10+10) + (1+1).
  4. 100000 + (10000 + 10000) + 100 + 10.
  5. 100000 + 100000 +110
  6. 1000000 + 110.
  7. 1000110.

You can check with a calculator, 1000110 in binary is 70 in decimal.

Subtraction of binary numbers

Immediately example for subtracting single-digit numbers in binary number system, we didn’t talk about negative numbers, so we don’t take 0-1 into account: 1 - 0 = 1; 0 - 0 = 0; 1 - 1 = 0. If there are more than one digits, then everything is also simple, even no columns and tricks are needed: 110111 - 1000, this is the same as 55 - 8. As a result, we get 101111. And the heart stopped beating , where does the unit in the third digit come from (numbering from left to right and starts from zero)? Yes, everything is simple! In the second digit of the number 110111 there is 0, and in the first digit there is 1 (if we assume that the numbering of the digits starts from 0 and goes from left to right), but the unit of the fourth digit is obtained by adding two units of the third digit (a kind of virtual two is obtained) and from this deuces we subtract one, which is in the zero digit of the number 1000, but 2 - 1 \u003d 1, well, 1 is a valid digit in the binary number system.

Multiplication of binary numbers

It remains for us to consider the multiplication of binary numbers, which implements by shifting one bit to the left. But first, let's look at the results of a single-digit multiplication: 1*1 = 1; 1*0=0 0*0=0. Actually, everything is simple, now let's look at something more complex. Let's take the numbers 101001 (41) and 1100 (12). We will multiply by a column.

If it is not clear from the table how it happened, then I will try to explain in words:

  1. It is convenient to multiply binary numbers in a column, so we write out the second factor under the first, if the numbers have a different number of digits, then it will be more convenient if the larger number is on top.
  2. The next step is to multiply all the digits of the first number by the least significant digit of the second number. We write down the result of the multiplication below; in this case, it is necessary to write it down so that the result of the multiplication is written under each corresponding digit.
  3. Now we need to multiply all the digits of the first number by the next digit of the second number and write the result one more line below, but this result needs to be shifted one digit to the left, if you look at the table, then this is the second sequence of zeros from the top.
  4. You need to do the same for subsequent digits, each time moving one digit to the left, and if you look at the table, you can say that one cell to the left.
  5. We got four binary numbers, which we now need to add and get the result. Addition we recently considered, problems should not arise.

In general, the multiplication operation is not so difficult, you just need to practice a little.

Boolean algebra operations

In Boolean algebra, there are two very important concepts: true (true) and false (false), the equivalent for them are zero and one in the binary number system. Boolean algebra operators expand the number of available operators on these values, let's take a look at them.

Operation "Logical AND" or AND

The operation "Logical AND" or AND is equivalent to multiplying one-bit binary numbers.

1 AND 1 = 1; 1 AND 0 = 1; 0 AND 0 = 0; 0 AND 1 = 0.

1 AND 1 = 1 ;

1 AND 0 = 1 ;

0 AND 0 = 0 ;

0 AND 1 = 0.

The result of "Logical AND" will be one only if both values ​​are equal to one, in all other cases it will be zero.

Operation "Logical OR" or OR

The operation "Logical OR" or OR works according to the following principle: if at least one value is equal to one, then the result will be one.

1 OR 1 = 1; 1 OR 0 = 1; 0 OR 1 = 1; 0 OR 0 = 0.

1 OR 1 = 1 ;

1 OR 0 = 1 ;

0 OR 1 = 1 ;

0 OR 0 = 0.

XOR Operation

The XOR operation or XOR will give us a result of one only if one of the operands is equal to one and the second is equal to zero. If both operands are zero, it will be zero, and even if both operands are equal to one, the result will be zero.

The calculator allows you to convert whole and fractional numbers from one number system to another. The base of the number system cannot be less than 2 and more than 36 (10 digits and 26 Latin letters, after all). Numbers must not exceed 30 characters. To enter fractional numbers, use the symbol. or, . To convert a number from one system to another, enter the original number in the first field, the base of the original number system in the second, and the base of the number system to which you want to convert the number in the third field, then click the "Get Entry" button.

original number recorded in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 -th number system.

I want to get a record of a number in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 -th number system.

Get an entry

Transfers completed: 1237200

Number systems

Number systems are divided into two types: positional And not positional. We use the Arabic system, it is positional, and there is also the Roman one - it is just not positional. In positional systems, the position of a digit in a number uniquely determines the value of that number. This is easy to understand by looking at the example of some number.

Example 1. Let's take the number 5921 in the decimal number system. We number the number from right to left starting from zero:

The number 5921 can be written in the following form: 5921 = 5000+900+20+1 = 5 10 3 +9 10 2 +2 10 1 +1 10 0 . The number 10 is a characteristic that defines the number system. The values ​​of the position of the given number are taken as degrees.

Example 2. Consider the real decimal number 1234.567. We number it starting from the zero position of the number from the decimal point to the left and to the right:

The number 1234.567 can be written as follows: 1234.567 = 1000+200+30+4+0.5+0.06+0.007 = 1 10 3 +2 10 2 +3 10 1 +4 10 0 +5 10 -1 + 6 10 -2 +7 10 -3 .

Converting numbers from one number system to another

The easiest way to transfer a number from one number system to another is to convert the number first to the decimal number system, and then, the result obtained to the required number system.

Converting numbers from any number system to decimal number system

To convert a number from any number system to decimal, it is enough to number its digits, starting from zero (the digit to the left of the decimal point) similarly to examples 1 or 2. Let's find the sum of the products of the digits of the number by the base of the number system to the power of the position of this digit:

1. Convert number 1001101.1101 2 to decimal number system.
Solution: 10011.1101 2 = 1 2 4 +0 2 3 +0 2 2 +1 2 1 +1 2 0 +1 2 -1 +1 2 -2 +0 2 -3 +1 2 - 4 = 16+2+1+0.5+0.25+0.0625 = 19.8125 10
Answer: 10011.1101 2 = 19.8125 10

2. Convert number E8F.2D 16 to decimal number system.
Solution: E8F.2D 16 = 14 16 2 +8 16 1 +15 16 0 +2 16 -1 +13 16 -2 = 3584+128+15+0.125+0.05078125 = 3727.17578125 10
Answer: E8F.2D 16 = 3727.17578125 10

Converting numbers from a decimal number system to another number system

To convert numbers from the decimal number system to another number system, the integer and fractional parts of the number must be translated separately.

Converting the integer part of a number from a decimal number system to another number system

The integer part is converted from the decimal number system to another number system by successively dividing the integer part of the number by the base of the number system until an integer remainder is obtained, which is less than the base of the number system. The result of the transfer will be a record from the remains, starting with the last one.

3. Convert number 273 10 to octal number system.
Solution: 273 / 8 = 34 and remainder 1, 34 / 8 = 4 and remainder 2, 4 is less than 8, so the calculation is complete. The record from the remnants will look like this: 421
Examination: 4 8 2 +2 8 1 +1 8 0 = 256+16+1 = 273 = 273 , the result is the same. So the translation is correct.
Answer: 273 10 = 421 8

Let's consider the translation of correct decimal fractions into various number systems.

Converting the fractional part of a number from a decimal number system to another number system

Recall that a proper decimal fraction is real number with zero integer part. To translate such a number into a number system with base N, you need to consistently multiply the number by N until the fractional part is zeroed or the required number of digits is obtained. If during multiplication a number with an integer part other than zero is obtained, then the integer part is not taken into account further, since it is sequentially entered into the result.

4. Convert number 0.125 10 to binary number system.
Solution: 0.125 2 = 0.25 (0 is the integer part, which will be the first digit of the result), 0.25 2 = 0.5 (0 is the second digit of the result), 0.5 2 = 1.0 (1 is the third digit of the result, and since the fractional part is zero , the translation is complete).
Answer: 0.125 10 = 0.001 2

Top Related Articles