How is 1 1 10

Math pages overview
back

Conversion of number systems

→ What are number systems?
→ Application of the Horner scheme
→ Conversion binary ↔ hexadecimal
→ Conversion of "decimal numbers" (b-adic fractions)
→ Calculate the period lengths of decimal numbers

Select the number systems and enter a number in one of the text fields in the corresponding selected system. In the other text field, the number appears converted into the other system.
If you choose a different number system, the associated text field is recalculated accordingly, and the number is not reinterpreted to calculate the other field.


 

Little mathematician joke

Why can't American mathematicians distinguish Christmas (not celebrated there until December 25th) from Halloween (October 31st)?

Answer: Because 31 (oct) = 25 (dec)



 
What are number systems?

We use the decimal system (lat. decimus, the tenth) and use the ten digits 0, 1, ... 9. The value of a digit in a number depends on its position, e.g. the first 3 in 373 has a different value than the second 3, namely threehundred and not three. In the decimal system, each digit corresponds to a power of the base 10: 100=1, 101=10, 102= 100 etc.

In this way, number systems can also be generated that have a base other than 10. Each digit stands for a multiple of the corresponding power of the base, and the range of digits is always 0 to base-1. The system for base 2 thus only has the two digits 0 and 1. Since "0 and 1" also for "Yes or no"or"on or off"or"Electricity or non-electricity"can stand, this is the number system in which computers actually" calculate "and store data: The smallest unit of information, the bit, is precisely the information about the two options 1 or 0.

Also used in computer technology is the hexadecimal system, the number system with the base 16. Since only 10 numerical characters are available, the first six letters of the alphabet are used for the numbers 10 to 15.
The standard unit of information size is one byte, which is 8 bits. A byte is the information about one of 256 possibilities, because the two states of the eight bits allow a total of 28= 256 possibilities.
(In decimal format: 0, 1, 2, ... to 255, in the binary system: 00000000, 00000001, 00000010, ... to 11111111.)
This unit can be handled much better with the 16 system than with the decimal system, because 256 is even 162. Thus, in a hexadecimal number, exactly two digits always correspond to one byte.

 
The Convert always takes place in this Javascript using the decimal system. i.e. the source number is first converted into the decimal system and only then into the target system. If one base represents a power of the other, there is also an easier way (see next section)! To find out details about the process, select two different systems in the list fields and enter a number in the corresponding system in one of the two text fields. Then click on the button [How does it work? ], and a detailed explanation of how the number was converted is displayed in the large text box.

 

Converting binary to hexadecimal numbers and vice versa
Hexa-
decimal
Binary         Hexa-
decimal
Binary  
0000081000
1000191001
20010A.1010
30011B.1011
40100C.1100
50101D.1101
60110E.1110
70111F.1111

4 binary digits each correspond to one hexadecimal digit, because 16 = 24. Therefore, these systems can also be converted directly and locally without any detours:

From binary to hexadecimal system:
Divide the binary number from right to left into packets of 4, and convert each packet into the corresponding hexadecimal number according to the table on the right.

From hexadecimal to binary:
Convert the hexadecimal digits to the corresponding four-digit binary numbers one by one.

Examples:
49A02(16) = 0100 1001 1010 0000 0010(2) = 1001001101000000010(2)
10010110101011(2) = 0010 0101 1010 1011(2) = 25AB(16)

 


Another joke (?)

There are 10 groups of people: those who understand the binary system and the others.


 

 

Converting decimal numbers

The place value system can be logically continued to the right of the comma: The first digit after the comma represents the multiple of b-1 = 1 / b to the number base b, the second digit is the multiple of b-2 = 1 / b² etc.
In the number 0.632, the 6 is on the tenths place, the 3 on the hundredths place and the 2 on the thousandths place. One tenth is 10-1, one hundredth of 10-2 etc.

If z1, e.g.2, e.g.3, ... are the digits after the decimal point of a number on base b, the value is calculated using the sum

z1 z2 z3 zn ——— + ——— + ——— + ... + ——— b1 b2 b3 bn

The main denominator of all fractions is bn. Extending it results in the algorithm that is used in the above script to convert to the decimal system and is explained using the interactive examples:

bn-1· Z1 + bn-2· Z2 + bn-3· Z3 + ... + zn = ——————————————————————————————————— bn

Example:
 
The binary number 0.1011 corresponds to the sum of the fractions

1 0 1 1 8·1 + 0 + 2·1 + 1 8 + 2 + 1 11 ——— + ——— + ——— + ———— = ————————————————————————— = ——————————— = ———— = 0,6875(10) 2 4 8 16 16 16 16

The strict analogy between converting integer and fractional parts can be seen in the interactive explanations about the calculator at the top of this page.

 

The conversion of decimal fractions into other number systems ("b-adic fractions") also shows analogies to the conversion of integers. Dividing with the remainder by the base for the integers corresponds to multiplying by the base and separating off the integer part.

The following is a numerical example for converting a decimal fraction to base 5.
Positive decimal numbers <1 can contain a maximum of four fifths (whole); the rest is made up of a maximum of 4/25 plus a maximum of 4/125 etc. How many fifths are completely contained in a decimal fraction is obtained by multiplying the decimal fraction (i.e. the decimal places) by 5.

If you multiply the decimal fraction 0.78 by 5, you get 3.9. In 0.78, three fifths (= 0.6) are completely contained. If you cut off 3 from 3.9, a remainder smaller than 1 remains, which in turn is made up of multiples of 1/5, 1/25, 1/125, 1/625, etc. However, since the 3.9 has already been created by multiplying by 5 and the multiples of 1/5 have already been deleted by "cutting off" the 3, the analogous next step, carried out with the remainder 0.9, already results in 0.78 contained multiples of 1/25, the next but one the multiples of 1/125, etc .:

0.9 x 5 = 4.5 -> four twenty-fifths, remainder 0.5
0.5 x 5 = 2.5 -> two hundred twenty-fifths, remainder 0.5
0.5 x 5 = 2.5 -> two six hundred twenty-fifth, remainder 0.5
etc. -> period 2.

This results in:

3 4 2 2 2 — 0,78(10) = ——— + ———— + ————— + ————— + —————— + ... = 0,342(5) 5 25 125 625 3125

 


Version: October 28, 2006
© Arndt Brünner
Math pages overview
back