Computer science is a number system. Types of number systems

In the computer science course, regardless of school or university, a special place is given to such a concept as the number system. As a rule, several lessons or practical exercises are allocated to it. The main goal is not only to learn the basic concepts of the topic, to study the types of number systems, but also to get acquainted with binary, octal and hexadecimal arithmetic.

What does it mean?

Let's start by defining the basic concept. As the textbook "Computer Science" notes, the number system is a number recording system that uses a special alphabet or a specific set of numbers.

number system translation

Depending on whether the value of the digit changes from its position in the number, two are distinguished: positional and non-positional number systems.

In positional systems, the value of a digit changes along with its position in the number. So, if you take the number 234, then the number 4 in it means units, if you consider the number 243, then here it will already mean tens, not units.

In non-positional systems, the value of a digit is static, regardless of its position in the number. The most striking example is the wand system, where each unit is indicated with a dash. No matter where you put the stick, the value of the number changes only by one.

Non Positioning Systems

Non-positional number systems include:

  1. A single system that is considered one of the first. It used sticks instead of numbers. The more there were, the greater the value of the number. You can find an example of the numbers recorded in this way in films, where we are talking about people lost in the sea, prisoners who are celebrated every day with nicks on a stone or tree.
  2. Roman, in which Latin letters were used instead of numbers. Using them, you can write any number. Moreover, its value was determined using the sum and difference of the digits that made up the number. If a smaller number was to the left of the digit, then the left digit was subtracted from the right one, and if the digit to the right was less than or equal to the digit to the left, then their values ​​were summed. For example, the number 11 was written as XI, and 9 - IX.
  3. Alphabetic, in which numbers are indicated using the alphabet of one or another language. One of them is the Slavic system, in which a number of letters had not only phonetic, but also numerical value.
  4. The Babylonian number system, in which only two notation was used for writing - wedges and arrows.
  5. In Egypt, special characters were also used to indicate numbers. When writing a number, each character could be used no more than nine times.

Position systems

Much attention is paid in computer science to positional number systems. These include the following:

  • binary
  • octal;
  • decimal;
  • hexadecimal
  • six-decimal used in counting time (for example, in a minute - 60 seconds, in an hour - 60 minutes).

Each of them has its own alphabet for writing, translation rules and arithmetic operations.

number system table

Decimal system

This system is the most familiar for us. It uses numbers from 0 to 9 to write numbers. They are also called Arab. Depending on the position of the number in the number, it can denote different digits - units, tens, hundreds, thousands or millions. We use it everywhere, we know the basic rules by which arithmetic operations on numbers are performed.

Binary system

One of the main number systems in computer science is binary. Its simplicity allows the computer to perform cumbersome calculations several times faster than in the decimal system.

To record numbers, only two digits are used - 0 and 1. At the same time, depending on the position of 0 or 1 in the number, its value will change.

Initially, it was with the help of binary code that computers received all the necessary information. At the same time, one means the presence of a signal transmitted using voltage, and zero means its absence.

types of number systems

Octal system

Another well-known computer number system, which uses numbers from 0 to 7. It was used mainly in those areas of knowledge that are associated with digital devices. But recently it has been used much less frequently, since it has been replaced by a hexadecimal number system.

Binary decimal system

Representation of large numbers in a binary system for a person is a rather complicated process. To simplify it, a binary-decimal number system was developed . It is usually used in electronic watches, calculators. In this system, not the whole number is converted from the decimal system to binary, but each digit is converted to the corresponding set of zeros and ones in the binary system. Similarly, a conversion from binary to decimal occurs. Each digit, represented as a four-digit set of zeros and ones, is converted to a decimal number. In principle, there is nothing complicated.

To work with numbers, in this case, the number system table is useful, in which the correspondence between the numbers and their binary code will be indicated.

Hexadecimal system

Recently, the hexadecimal number system has become increasingly popular in programming and computer science. It uses not only numbers from 0 to 9, but also a number of Latin letters - A, B, C, D, E, F.

addition of number systems

Moreover, each of the letters has its own meaning, so A = 10, B = 11, C = 12, and so on. Each number is represented as a set of four characters: 001F.

Translation of numbers: from decimal to binary

Translation in number systems takes place according to certain rules. The most common translation from binary to decimal system and vice versa.

In order to convert a number from the decimal system to binary, it is necessary to divide it sequentially on the basis of the number system, that is, the number two. In this case, the remainder of each division must be fixed. This will happen until the remainder of the division is less than or equal to one. Computing is best done in a column. Then, the resulting remainder from the division is written to the string in the reverse order.

binary decimal notation

For example, translate the number 9 into the binary system:

Divide 9, since the number is not completely divisible, then we take the number 8, the remainder will be 9 - 1 = 1.

After dividing 8 by 2, we get 4. Again, divide it, since the number is completely divided - we get in the remainder 4 - 4 = 0.

We carry out the same operation with 2. In the remainder we get 0.

As a result of division, we get 1.

Next, we write down all the residues we received in the reverse order, starting with the result of the division: 1001.

Regardless of the final number system, the conversion of numbers from decimal to any other will occur on the principle of dividing the number by the basis of the positional system.

Translation of numbers: from binary to decimal

It is quite easy to translate numbers into a decimal notation from binary. To do this, it is enough to know the rules for raising numbers to a power. In this case, to the power of two.

The translation algorithm is as follows: each digit from the binary number code must be multiplied by two, moreover, the first two will be in degree m-1, the second will be in degree m-2, and so on, where m is the number of digits in the code. Then add the results of the addition to get an integer.

For students, this algorithm can be explained more simply:

To get started, take and write down each digit times two, then put down the power of two from the end, starting from zero. Then add the resulting number.

number systems number translation

For example, we will analyze with you the number 1001 obtained earlier, converting it to the decimal system, and at the same time check the correctness of our calculations.

It will look like this:

1 * 2 3 + 0 * 2 2 + 0 * 2 1 + 1 * 2 0 = 8 + 0 + 0 + 1 = 9.

When studying this topic, it is convenient to use a table with powers of two. This will significantly reduce the amount of time required for the calculations.

Other translation options

In some cases, the translation can be carried out between the binary and octal number system, binary and hexadecimal. In this case, you can use special tables or run the calculator application on the computer by selecting the option “Programmer” in the view tab.

Arithmetic operations

Regardless of the form in which the number is presented, it is possible to carry out calculations that are familiar to us. This can be division and multiplication, subtraction and addition in the number system that you have chosen. Of course, each of them has its own rules.

So for the binary system developed its own tables for each of the operations. The same tables are used in other positional systems.

It is not necessary to memorize them - just print it out and have it handy. You can also use the calculator on your PC.

computer science number system

One of the most important topics in computer science is the number system. Knowing this topic, understanding the algorithms for translating numbers from one system to another is a guarantee that you can understand more complex topics, such as algorithmization and programming, and you can write your first program yourself.

Source: https://habr.com/ru/post/F35081/


All Articles