## Converting Between Number Systems

It is often necessary to convert values written in one number system to another. The simplest way is to reach for your calculator or use a conversion app. from the web. That is fine, but converting a number in this way does not help you to understand the way each number system works and how different systems are related.

The purpose of this blog is to explain just that, and to get you to carry out some simple conversions so that you can not only convert between number systems, but also understand how the conversion process works. There are various ways to tackle conversions without a calculator; once the conversion methods are learned, the only skills needed are the ability to multiply and divide by two, and to add together a few numbers.

## Conversion from any system to decimal

• The number of values that can be expressed by a single digit in any number system is called the system radix, and any value can be expressed in terms of its system radix.
• For example the system radix of octal is 8, since any of the 8 values from 0 to 7 can be written as a single digit.
• Using the values of each column, (which in an octal integer are powers of 8) the octal value 1268 can also be written as:

Convert 1268 to decimal. As (82 = 64), (81) = 8 and (80 =1), this gives a multiplier value for each column.

Multiply the digit in each column by the column multiplier value for that column to give: Then simply add these results to give the decimal value. Therefore, The same method can be used to convert binary number to decimal:

Convert 11012 to decimal. Therefore 11012 = 1310

The same method can be used to convert any system to decimal.

## Converting from Decimal to any Radix

• To convert a decimal integer number (a decimal number in which any fractional part is ignored) to any other radix, all that is needed is to continually divide the number by 2 and with each division, write down the remainder, which will be either 1 or 0.

Decimal to Binary Figure 1.Decimal to Binary Conversion

• For example, to convert the decimal number 5710 to binary:
• Divide 5710 by the system radix, which when converting to binary is 2. This gives the answer 28, with a remainder of 1.
• Continue dividing the answer by 2 and writing down the remainder until the answer = 0
• Now simply write out the remainders, starting from the bottom, to give 1110012
• Therefore, 5710 = 1110012

Decimal to Octal Figure 2.Decimal  to Octal Conversion

• The same process works to convert decimal to octal, but this time the system radix is 8:
• Therefore, 5710 = 718 • It also works to convert decimal to hexadecimal, but now the radix is 16:
• Therefore 5710 = 3916

## Numbers with Fractions

• It is very common in the decimal system to use fractions; that is any decimal number that contains a decimal point, but how can decimal numbers, such as 34.62510 be converted to binary fractions?
• In electronics this is not normally done, as binary does not work well with fractions. However as fractions do exist, there has to be a way for binary to deal with them.
• The method used is to get rid of the radix (decimal) point by NORMALISING the decimal fraction using FLOATING POINT arithmetic.
• As long as the binary system keeps track of the number of places the radix point was moved during the normalisation process, it can be restored to its correct position when the result of the binary calculation is converted back to decimal for display to the user.
• However, for the sake of completeness, here is a method for converting decimal fractions to binary fractions.
• By carefully selecting the fraction to be converted, the system works, but with many numbers the conversion introduces inaccuracies; a good reason for not using binary fractions in electronic calculations. Figure 4. Converting the Decimal Integer to Binary

## Converting the Decimal Integer to Binary

• The radix point splits the number into two parts; the part to the left of the radix point is called the INTEGER. The part to the right of the radix point is the FRACTION.
• A number such as 34.62510 is therefore split into 3410 (the integer), and .62510 (the fraction).
• To convert such a fractional decimal number to any other radix, the method described above is used to convert the integer.
• So 3410 = 1000102

## Converting the Decimal Fraction to Binary Figure 5.Converting the Fraction to Binary

• To convert the fraction, this must be MULTIPLIED by the radix (in this case 2 to convert to binary). Notice that with each multiplication a CARRY is generated from the third column.
• The Carry will be either 1 or 0 and these are written down at the left hand side of the result.
• However when each result is multiplied the carry is ignored (don’t multiply the carry).
• Each result is multiplied in this way until the result (ignoring the carry) is 000. Conversion is now complete.
• For the converted value just read the carry column from top to bottom. So 0.62510 = .1012
• Therefore the complete conversion shows that 34.62510 = 100010.1012
• However, with binary, there is a problem in using this method, .625 converted easily but many fractions will not.
• For example if you try to convert .626 using this method you would find that the binary fraction produced goes on to many, many places without a result of exactly 000 being reached.
• With some decimal fractions, using the above method will produce carries with a repeating pattern of ones and zeros, indicating that the binary fraction will carry on infinitely.
• Many decimal fractions can therefore only be converted to binary with limited accuracy.
• The number of places after the radix point must be limited, to produce as accurate an approximation as required.

## Converting Binary to Decimal

• To convert from binary to decimal write down the binary number giving each column its correct ‘weighting’ i.e. the value of the columns, starting with a value of one for the right hand (least significant column or LEAST SIGNIFICANT BIT) column.
• Giving each column twice the value of the previous column as you move left. • Converting between binary and hexadecimal is a much simpler process; hexadecimal is really just a system for displaying binary in a more readable form.
• Binary is normally divided into Bytes (of 8 bits) it is convenient for machines but quite difficult for humans to read accurately.
• Hexadecimal groups each 8-bit byte into two 4-bit nibbles, and assigns a value of between 0 and 15 to each nibble.
• This reduces the eight 1 or 0 characters of binary into just two characters. The bits in the most significant nibble (11102) add up to 8+4+2+0 = 1410 = E16.

The bits in the least significant nibble (10012) add up to 8+0+0+1 = 910 = 916 Therefore 111010012 = E916

AUTHORS
1.Bunty B. Bommera
2.Dakshata U. Kamble