The decimal system has ten digits or symbols (0, 1, 2, 3, 4, 5, 6, 7, 8 and 9) that confers depending on their position in the figure value.
The value of each digit is associated to a power base 10, which number corresponds with the number of symbols or digits of the decimal system, and an exponent equal to the position of the least one digit, counting from the right.
Binary numbering system.
The binary number system uses only two digits, zero (0) and one (1).
In a binary number, each digit has a different value depending on the position occupied. The value of each position is that of a power base 2 raised to an exponent equal to the digit minus one. It can be seen that, as was the case with the decimal system, the base of the power equal to the number of digits used (2) to represent numbers.
According to these rules, the binary number 1011 has a value that is calculated as:
1*23 + 0*22 + 1*21 + 1*20 ,
8 + 0 + 2 + 1 = 11
and express both figures describe the same amount write it like:
10
1110
Conversion between decimal and binary numbers
Convert a decimal number to binary is very simple: just perform successive divisions by 2 and write the remains from each division in the reverse order they were obtained.
For example, to convert the binary number 7710 will make a series of divisions that yield the following radicals:
77: 2 = 38 Rest: 1
38: 2 = 19 Rest: 0
19: Rest 2 = 9: 1
9: Rest 2 = 4: 1
4: 2 = 2 Rest: 0
2: 2 = 1 Other: 0
1: 2 = 0 Other: 1
and taking the residue in reverse order obtain the binary number: 7710 = 10011012
Converting binary to decimal
The process to convert a number from binary to decimal is even simpler; enough to develop the number, considering the value of each digit in its position, which is a power of 2, the exponent is 0 in the bit farthest to the right, and is incremented by one as we move forward positions counterclockwise.
For example, to convert binary to decimal number 10100112, which developed considering the value of each bit:
1*26 + 0*25 + 1*24 + 0*23 + 0*22 + 1*21 + 1*20 = 83
10100112 = 8310
Code ascii
No hay comentarios:
Publicar un comentario