Binary system
The binary system, also called the dyadic system in computer science, is a numeral system in which numbers are represented using only two digits: 0 (zero) and 1 (one). It is one of the systems used in computers, because they work internally with two voltage levels, which is why their natural numbering system is the binary system.
History of the binary system
The ancient Indian mathematician Penguin
He presented the first known description of a binary number system in the 3rd century BC, which coincided with his discovery of the concept of the number zero.
In ancient China, in the classical text of the I Ching, a complete series of 8 trigrams and 64 hexagrams (analogous to 3-bits) and 6-bit binary numbers are described. Similar series of binary combinations have also been used in traditional African divination systems, such as Ifá, as well as in Western medieval geomancy.
Chinese scholar and philosopher Shao Yong in the 11th century developed an ordered binary arrangement of the I Ching hexagrams, representing the decimal sequence from 0 to 63, and a method for generating the same.
In 1605 Francis Bacon spoke of a system by which the letters of the alphabet could be reduced to sequences of binary digits, which could be encoded as faint variations in the font of any arbitrary text.
In 1670 Juan Caramuel published his book Mathesis Biceps; and on pages XLV to XLVIII he gave a description of the binary system.
The modern binary system was fully documented by Leibniz, in the 18th century, in his article "Explication de l'Arithmétique Binaire". It mentions the binary symbols used by Chinese mathematicians. Leibniz used a mathematical system of two variables - 0/1 - to transform linguistic terms and, in this way, distribute information, just like the current binary system.
In 1854, the British mathematician George Boole published a paper that marked a before and after, detailing a system of logic that would come to be called Boolean Algebra. Such a system would play a fundamental role in the development of the current binary system, particularly in the development of electronic circuits.
Applications
In 1937, Claude Shannon completed his doctoral thesis at MIT, in which he implemented Boolean algebra and binary arithmetic using relays and switches for the first time in history. Entitled A Symbolic Analysis of Switching and Relay Circuits, Shannon's thesis essentially founded the practical design of digital circuits.
In November 1937, George Stibitz, then working at Bell Laboratories, built a relay-based calculator — which he nicknamed the "Model K" (because he built it in a kitchen, in English & # 34; k itchen & # 34;) — that used binary addition to perform the calculations. Bell Laboratories authorized a full research program in late 1939, with Stibitz in command.
On January 8, 1940, they finished designing a "Complex Number Calculator," which was capable of performing calculations with complex numbers. In a demonstration at the American Mathematical Society conference on September 11, 1940, Stibitz was able to remotely send commands to the Complex Number Calculator over the telephone line using a teletypewriter. It was the first computing machine used remotely over the telephone line. Some conference participants who witnessed the demonstration were John von Neumann, John Mauchly and Norbert Wiener, who wrote about the event in his different types of memoirs in which he achieved different achievements.
Representation
In the binary system only two digits are needed.
In computing, a binary number can be represented by any sequence of bits (binary digits), which usually represent any mechanism capable of using two mutually exclusive states. The following sequences of symbols could be interpreted as the same binary numeric value:
1 | 0 | 1 | 0 | 0 | 1 | 1 | 0 | 1 | 1 |
. | − | . | − | − | . | . | − | . | . |
x | or | x | or | or | x | x | or | x | x |
and | n | and | n | n | and | and | n | and | and |
The numerical value represented in each case depends on the value assigned to each symbol. On a computer, numerical values can represent two different voltages; they can also indicate magnetic polarities on a magnetic disk. A "positive", "yes", or "on the status" is not necessarily the equivalent of the numerical value of one; this depends on the nomenclature used.
According to the most common representation, which is using Arabic numerals, binary numbers are commonly written using the symbols 0 and 1. Binary numbers are often written with subscripts, prefixes, or suffixes to indicate their base. The following notations are equivalent:
- 100101 binary (exclusive format statement)
- 100101b (a suffix that indicates binary format)
- 100101B (a suffix that indicates binary format)
- bin 100101 (a prefix that indicates binary format)
- 1001012 (a subscript indicating base 2 (binary) notation)
- %100101 (a prefix that indicates binary format)
- 0b100101 (a prefix that indicates binary format, common in programming languages)
Conversion between binary and decimal
Decimal to Binary
The number of the decimal system is divided by 2, whose integer result is divided again by 2, and so on until the dividend is less than the divisor, 2. That is, when the number to divide is 1 ends the division.
Next, it is ordered from the last quotient to the first remainder, they are simply placed in the reverse order of how they appear in the division. This will be the binary number we are looking for.
- Example
- Transform the decimal number 131 into binary. The method is very simple:
131 divided between 2 da 65 with residue equal to 1 65 divided between 2 da 32 with residue equal to 1 32 divided between 2 da 16 with residue equal to 0 16 divided between 2 da 8 with residue equal to 0 8 divided between 2 da 4 with residue equal to 0 4 divided between 2 da 2 with residue equal to 0 2 divided between 2 da 1 with residue equal to 0 the last quotient is 1
-> We order the residues, from last to first: 10000011 In binary, 131 is written as 10000011.
- Example
- Transform the decimal number 100 into binary.
Another form of conversion is a method similar to prime factorization. It is relatively easy to divide any number by 2. This method also consists of successive divisions. Depending on whether the number is even or odd, we will place a zero or a one in the right column. If it is odd, we will subtract one and continue dividing by two, until it is no longer possible and the number 1 is placed. Then we only have to take the last result from the left column and all those from the right column and order the results. digits from bottom to top.
- Example
100UD0
50UD0
25IVA1 -- 1, 25-1=24 and we continue to divide between 2
12UD0
6UD0
3UD1
1UD1 -- 2005 ( 100 ) 10 = ( 1100100 ) 2 {displaystyle (100)_{10}=(1100100)_{2}}}
Example
To convert the decimal number 77 to the binary system we will make a series of divisions that will yield the following results:
77 / 2 = 38 Waste == 38 / 2 = 19 Waste == 19 / 2 = 9 Waste == 9 / 2 = 4 Waste == 4 / 2 = 2 Waste == 2 / 2 = 1 Waste == Last quotient == Now taking the last quotient and waste in reverse order, the result is: 1001101(binary)
There is a final method called distribution. It consists of distributing the necessary ones between the successive powers of 2 so that their sum turns out to be the decimal number to be converted. Take, for example, the number 151, for which the first 8 powers of 2 will be needed, since the next one, 28=256, is greater than the number to be converted. It begins by putting a 1 in 128, so there are still 23 missing, 151-128 = 23, to reach 151. This value will be obtained by distributing ones among the powers whose sum gives the result sought and putting zeros in the rest. In the example they turn out to be the powers 4, 2, 1 and 0, that is, 16, 4, 2 and 1, respectively.
- Example
20= 1UD1
21= 2UD1
22= 4UD1
23= 8UD0
24= 16dica1
25= 32,000
26= 64.
27= 128. 128 + 16 + 4 + 2 + 1 = ( 151 ) 10 = ( 10010111 ) 2 {displaystyle 128+16+4+2+1=(151)_{10}=(10010111)_{2}}}
Decimal (with decimals) to binary
To transform a number from the decimal system to the binary system:
- It transforms the whole part to binary. (If the whole part is 0 in binary will be 0, if the whole part is 1 in binary will be 1, if the whole part is 5 in binary will be 101 and so on).
- It follows the fractional part, multiplying each number by 2. If the result obtained is greater or equal to 1 is recorded as a binary one (1). If it is less than 1 it is noted as a binary 0. (For example, by multiplying 0.6 by 2 we get as result 1.2 which indicates that our result is one (1) in binary, only the decimal part of the result is taken.)
- After each multiplication is performed, the numbers obtained in the order of their obtaining are placed.
- Some numbers are transformed into periodic digits, for example: 0.1.
- Example
0.3125 (decimal) = 0.0001 (binary). Process: 0,3125 * 2 = 0,625 = 0,625 * 2 = 1,25 = 2005 0.25 * 2 = 0.5 = 0.001 0.5 * 2 = 1 = 2005 In order: 0101 - plan 0.0101 (binary)
- Example
0.1 (decimal) = voluntary 0.0 0011 0011... (binary). Process: 0.1 * 2 = 0.2 == 0.2 * 2 = 0.4 == 0.4 * 2 = 0.8 == 0.8 * 2 = 1.6 == 0.6 * 2 = 1.2 == 0,2 * 2 = 0,4 == tax 0 θ- the four figures are repeated periodically 0.4 * 2 = 0.8 == taxpayer 0 0.8 * 2 = 1,6 == 2005 1 0.6 * 2 = 1.2 == 2005 1. In order: 0 0011 0011... = 2005 0,0 0011 0011...
- Example
Convert 0.2 (decimal) to binary. Process: 0.2 * 2 = 0.4 == 0.4 * 2 = 0.8 == 0.8 * 2 = 1.6 == 0.6 * 2 = 1.2 == 0.2 * 2 = 0.4 == as values are repeated indefinitely, the result is: In order: 0.001100110011...(binary)
- Example
5.5 = 5.5 5.5 (decimal) = education 101.1 (binary). Process: 5 = education 101 0.5 * 2 = 1 = 2005 In order: 1 (one single digit fraction) - plan 101,1 (binary)
- Example
6.83 (decimal) = voluntary 110,110101000111 (binary). Process: 6 = 2005 110 0.83 * 2 = 1.66 = 2005 0.66 * 2 = 1.32 = 2005 0.32 * 2 = 0.64 = 0.001 0.64 * 2 = 1.28 = 2005 0.28 * 2 = 0.56 =.56 0.56 * 2 = 1.12 = 1 0.12 * 2 = 0.24 = 2005 0.24 * 2 = 0.48 = 0.001 0.48 * 2 = 0.96 = 2005 0.96 * 2 = 1.92 = 2005 0.92 * 2 = 1.84 = 2005 0.84 * 2 = 1.68 = 2005 In order: 110101000111 (binary) Whole part: 110 (binary) Chaining whole and fractional part: 110,110101000111 (binary)
Binary to Decimal
To convert from binary to decimal, do the following:
- Start on the right side of the binary number. Multiply each digit by 2 elevated to consecutive power (starting by power 0.20).
- After each of the multiplications, add them all and the resulting number will be the equivalent of the decimal system.
Examples:
- (The numbers located at the top of the binary number indicate the power to which the number must be raised 2)
1514031201102=1⋅ ⋅ 25+1⋅ ⋅ 24+0⋅ ⋅ 23+1⋅ ⋅ 22+0⋅ ⋅ 21+1⋅ ⋅ 20=32+16+0+4+0+1=53{cHFFFFFF}{cH00FF}{cHFFFFFF}{cHFFFFFF}{cH00FF}{cHFFFF00}{cHFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFF}{cHFFFF}{cH00}{cH00}{cHFFFFFFFFFFFFFFFFFF}{cH00}{cH00}{cH00}{cH00}{cH00}{cHFFFFFFFFFFFFFFFFFFFFFFFFFF00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00FFFFFF00}{cH00}{cH00}{cH00FFFFFFFFFFFFFFFFFFFFFF
17060514031211102=1⋅ ⋅ 27+0⋅ ⋅ 26+0⋅ ⋅ 25+1⋅ ⋅ 24+0⋅ ⋅ 23+1⋅ ⋅ 22+1⋅ ⋅ 21+1⋅ ⋅ 20=128+0+0+16+0+4+2+1=151{cHFFFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFFFFFF}{cHFFFFFF}{cHFFFF}{cHFFFF}{cH00}{cH00}{cHFFFFFFFFFF}{cH00}{cH00}{cH00}{cH00}{cHFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
1514031211102=1⋅ ⋅ 25+1⋅ ⋅ 24+0⋅ ⋅ 23+1⋅ ⋅ 22+1⋅ ⋅ 21+1⋅ ⋅ 20=32+16+0+4+2+1=55{cHFFFFFF}{cH00FFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFFFFFFFF}{cHFFFFFF}{cHFFFF}{cHFFFFFF}{cHFFFFFFFFFF}{cHFFFFFFFF}{cH00}{cH00}{cH00}{cH00}{cH00}{cHFFFFFFFFFFFFFFFFFFFFFFFFFFFF00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{cHFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00}{cH00}{cH00}{cH00}{cH00}{cHFFFFFFFFFFFF
You can also choose to use the values presented by each position of the binary number to be transformed, starting from right to left, and adding the values of the positions that have a 1.
- Example
The binary number 1010010 corresponds in decimal to 82. It can be represented as follows:
164032116080412012¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶ ¶
then add the numbers 64, 16 and 2:
164032116080412012=64+16+2=82{cHFFFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFFFF}{cHFFFF}{cHFFFFFF}{cH00}{cH00}{cHFFFFFFFFFF}{cH00}{cH00}{cH00}{cH00}{cH00}{cHFFFFFFFFFFFFFFFFFFFFFFFFFF}{cH00}{cHFFFFFFFFFF}{cH00}{cH00}{cH00}{cH00}{cH00}{cHFFFFFFFFFFFFFFFFFFFF}{cH00}{cH00}{cH00}{cH00}{cH00}{cH00}{
To change from binary with decimals to decimal, do exactly the same, except that the zero position (in which the two is raised to zero) is the one to the right of the comma and is counted to the left to starting from -1:
151403120110,1− − 10− − 21− − 3=1⋅ ⋅ 25+1⋅ ⋅ 24+0⋅ ⋅ 23+1⋅ ⋅ 22+0⋅ ⋅ 21+1⋅ ⋅ 20+1⋅ ⋅ 2− − 1+0⋅ ⋅ 2− − 2+1⋅ ⋅ 2− − 3==32+16+0+4+0+1+121+022+123=32+16+0+4+0+1+0,5+0+0,125=53,625###### ######################################################################################################
Binary to Decimal (with binary fractional part)
1. Start on the left side (the first digit to the right of the comma), each number should be multiplied by 2 raised to the consecutive power in reverse (starting with the power -1, 2-1).
2. After performing each of the multiplications, add them all and the resulting number will be the equivalent of the decimal system.
- Examples
- 0,101001 (binary) = 0,640625(decimal). Process:
1 * 2 elevated to -1 = 0.5 0 * 2 elevated to -2 = 0 1 * 2 elevated to -3 = 0,125 0 * 2 elevated to -4 = 0 0 * 2 elevated to -5 = 0 1 * 2 elevated to -6 = 0.015625 The sum is: 0,640625
- 0,110111 (binary) = 0,859375(decimal). Process:
1 * 2 elevated to -1 = 0.5 1 * 2 elevated to -2 = 0.25 0 * 2 elevated to -3 = 0 1 * 2 elevated to -4 = 0.0625 1 * 2 elevated to -5 = 0.03125 1 * 2 elevated to -6 = 0.015625 The sum is: 0,859375
Operations with binary numbers
Adding binary numbers
The addition table for binary numbers is as follows:
+ | 0 | 1 |
---|---|---|
0 | 0 | 1 |
1 | 1 | 10 |
The possible combinations when adding two bits are:
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 0 = 1
- 1 + 1 = 10
Note that adding 1 + 1 is 102, that is, we carry 1 to the next position on the left (carry). This is equivalent in the decimal system to adding 9 + 1, which gives 10: zero in the position we are adding and a carry 1 to the next position.
- Example
1 10011000 + 00010101 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 10101101
You can convert the binary operation to a decimal operation, solve for the decimal, and then transform the result into a binary (number). We operate as in the decimal system: we start adding from the right, in our example, 1 + 1 = 10, so we write 0 in the result row and carry 1 (this "1" 34; it's called a carry or drag). The carry is then added to the next column: 1 + 0 + 0 = 1, and we continue until all columns are finished (exactly as in decimal).
Subtracting binary numbers
The subtraction algorithm in the binary system is the same as in the decimal system. But it is convenient to review the operation of subtracting in decimal to understand the binary operation, which is simpler. The terms involved in subtraction are called minuend, subtrahend, and difference.
The basic subtractions 0 - 0, 1 - 0 and 1 - 1 are self-evident:
- 0 - 0 = 0
- 1 - 0 = 1
- 1 - 1 = 0
- 0 - 1 = 1 (be transformed into 10 - 1 = 1) (in decimal system it is equivalent to 2 - 1 = 1)
The subtraction 0 - 1 is solved in the same way as in the decimal system, borrowing a unit from the following position: 0 - 1 = 1 and I take 1 (this value is subtracted from the result you get, between the minuend and the subtrahend of the next column), which is equivalent to saying in the decimal system, 2 - 1 = 1.
- Examples
10001 11011001 -01010 -10101011 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 00111 00101110
In decimal system it would be: 17 - 10 = 7 and 217 - 171 = 46.
There are several methods to simplify subtraction and reduce the possibility of making mistakes:
- Split the long numbers into groups. In the following example, we see how a long subtraction is divided into three short sections:
100110011101 1001 1001 -010101110010 -010111 -0010 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 0100001011 0100 0010 1011
- Using the complement to two (C2). The subtraction of two binary numbers can be obtained by adding to the minuendo the "complement to two" of the subtracting.
- Example
The following subtraction, 91 - 46 = 45, in binary is:
1011011 1011011 -0101110 the C2 of 0101110 is 1010010 +1010010 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 10101101
There is one bit left over in the result, which overflows to the left. But, since the resulting number cannot be longer than the minuend, the extra bit is ignored.
One last example: let's subtract 219 - 23 = 196, directly and using two's complement:
11011011 11011011 -00010111 C2 of 00010111 is 11101001 +11101001 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 11000100 111000100
And, neglecting the left-overflow bit, we arrive at the correct result: 11000100 in binary, 196 in decimal.
- Using the complement to one. The subtraction of two binary numbers can be obtained by adding to the minuendo the complement to one of the subtracting and in turn adding the bit that is overwhelmed.
Product of binary numbers
The multiplication table for binary numbers is as follows:
· | 0 | 1 |
---|---|---|
0 | 0 | 0 |
1 | 0 | 1 |
The algorithm of the product in binary is the same as in decimal numbers; although it is carried out more simply, since 0 multiplied by any number gives 0, and 1 is the neutral element of the product.
For example, let's multiply 10110 by 1001:
10110 x 1001 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 10110 000 000 10110 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 11000110
In electronic systems, where larger numbers are often used, the method called Booth's algorithm is used.
11101111 x 111011 _______ 11101111 11101111 000 11101111 11101111 11101111 ___________ 11011100010101
Division of binary numbers
Division in binary is similar to division in decimal; the only difference is that when doing the subtractions, within the division, these must be done in binary.
- Example
Divide 100010010 (274) by 1101 (13):
100010010 /1101 = 010101 - 0000 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 10001 -1101 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 01000 - 0000 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 10000 - 1101 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 00111 - 0000 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 01110 - 1101 ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 00001
Conversion between binary and octal systems
Binary to octal system
Because the octal system has as base 8, which is the third power of 2, and that two is the base of the binary system, it is possible to establish a direct method to convert from base two to base eight, without having to convert from binary to decimal and then from decimal to octal. This method is described below:
To convert from binary to octal, do the following:
1) Group the binary quantity in groups of 3 by 3 starting from the right side. If when you finish grouping you do not complete 3 digits, then add leading zeros.
2) Later see the corresponding value according to the table:
Number in binary | 000 | 001 | 010 | 011 | 100 | 101 | 110 | 111 |
---|---|---|---|---|---|---|---|---|
Number in octal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
3) The corresponding quantity in octal is grouped from left to right.
- Examples
- 110111 (binary) = 67 (octal). Process:
111 = 7 110 = 6 Group left to right: 67
- 11001111 (binary) = 317 (octal). Process:
111 = 7 001 = 1 11 then add a zero, so you get 011 = 3 Group from left to right: 317
- 1000011 (binary) = 103 (octal). Process:
011 = 3 000 = 0 1 then add 001 = 1 Group from left to right: 103
If the binary number has a decimal part, it is grouped in threes from the decimal point to the right following the same criteria established above for integers. For example:
0.01101 (binary) = 0.32 (octal) Process: 011 = 3 01 then add 010 = 2 Group from left to right: 32 Add the integer part: 0.32
Octal to Binary
Each octal digit is converted to its 3-bit binary equivalent and put together in the same order.
- Example
- 247 (octal) = 010100111 (binary). The 2 in binary is 10, but in 3-bit binary is Oc(2) = B(010); the Oc(4) = B(100) and the Oc(7) = (111), then the binary number will be 010100111.
Conversion between binary and hexadecimal
Binary to Hexadecimal
To convert from binary to hexadecimal, do the following:
1) Group the binary quantity in groups of 4 by 4 starting from the right side. If when you finish grouping you do not complete 4 digits, then add leading zeros.
2) Later see the corresponding value according to the table:
Number in binary | 0000 | 0001 | 0010 | 0011 | 0100 | 0101 | 0110 | 0111 | 1000 | 1001 | Dorotheergasse | 1011 | 1100 | 1101 | 1110 | 1111 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Number in hexadecimal | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
3) The corresponding quantity in hexadecimal is grouped from right to left.
- Examples
- 110111010 (binary) = 1BA (hexadecimal). Process:
1010 = A 1011 = B 1 then add 0001 = 1 Group from right to left: 1BA
- 11011110101 (binary) = 6F5 (hexadecimal). Process:
0101 = 5 1111 = F 110 then add 0110 = 6 Right to left group: 6F5
Hex to Binary
Note that to convert from Hexadecimal to binary, replace the Hexadecimal number with the 4-bit equivalent, similar to how you do octal to binary.
Conversion table between decimal, binary, hexadecimal, octal, BCD, Excess 3 and Gray or Reflected
Decimal | Binario | Hexadecimal | Eighth | BCD | Excess 3 | Gray or Reflected |
---|---|---|---|---|---|---|
0 | 0000 | 0 | 0 | 0000 | 0011 | 0000 |
1 | 0001 | 1 | 1 | 0001 | 0100 | 0001 |
2 | 0010 | 2 | 2 | 0010 | 0101 | 0011 |
3 | 0011 | 3 | 3 | 0011 | 0110 | 0010 |
4 | 0100 | 4 | 4 | 0100 | 0111 | 0110 |
5 | 0101 | 5 | 5 | 0101 | 1000 | 0111 |
6 | 0110 | 6 | 6 | 0110 | 1001 | 0101 |
7 | 0111 | 7 | 7 | 0111 | Dorotheergasse | 0100 |
8 | 1000 | 8 | 10 | 1000 | 1011 | 1100 |
9 | 1001 | 9 | 11 | 1001 | 1100 | 1101 |
10 | Dorotheergasse | A | 12 | 0001 0000 | 1111 | |
11 | 1011 | B | 13 | 0001 0001 | 1110 | |
12 | 1100 | C | 14 | 0001 0010 | Dorotheergasse | |
13 | 1101 | D | 15 | 0001 0011 | 1011 | |
14 | 1110 | E | 16 | 0001 0100 | 1001 | |
15 | 1111 | F | 17 | 0001 0101 | 1000 |
Factorization
- Conversion table between binary, binary factor, hexadecimal, octal and decimal
Binario | binary factor | Hexadecimal | Eighth | Decimal |
---|---|---|---|---|
0000 0010 | 21 | 2 | 2 | 2 |
0000 0100 | 22 | 4 | 4 | 4 |
0000 1000 | 23 | 8 | 10 | 8 |
0001 0000 | 24 | 10 | 20 | 16 |
0010 0000 | 25 | 20 | 40 | 32 |
0100 0000 | 26 | 40 | 100 | 64 |
1000 | 27 | 80 | 200 | 128 |
See also
- Octal system
- Duodecimal system
- Hexadecimal system
- Bit
- Nibble
- Byte
- Operator at bit level
- Arithmetic saturation
References
- ↑ Thomas: infinitesimal calculation and analytical geometry, Aguilar, Madrid. See also Drae
- ↑ BCD, hexadecimal, etc. is used; "Digital Mathematics" ISBN 958-600-821-5.
- ↑ « binary code: why do we use the binary system?». IONOS Digitalguide. Consultation on 29 March 2022.
- ↑ a b ING. EVA VIVEROS ZENTENO. « Discreet Math». Consultation on 14 March 2016.
- ↑ Nieves, Antonio (1999). Numerical methods. Continental, S.A. of C.V.
Contenido relacionado
Printer
Free Software Foundation
Equidistant