- Published: September 20, 2022
- Updated: September 20, 2022
- University / College: University of Washington
- Language: English
- Downloads: 6
When computer programmers write decimal numbers, they use positional notation technique. Every number in the base is multiplied by a particular power of 10 subject to the position of the integer.
For instance 843= 8*102+4*102+3*100
= 8*100+4*10+3*1
= 800+40+3
The rightmost digit for whole numbers is the one’s position (100= 1). The numeral in this position indicates the number of ones in the number. To the left, the next position is tens, followed by hundreds, thousands, in that order. In decimal systems, there exist ten values which may appear in every digit position. Thus, there are ten numerals that are needed to represent the value in each position.
Numbers can be converted between bases. The first way is converting base five to decimal form. For example, 1342five can be converted to decimal form
The number 1342 has one 125, four 5s, two 1s, and three 25s.
So, 1342five= (1*125) + (3*25) + (4*5) + (2*1)
= 125 + 75 + 20 +2
= 222
Another way of converting 1342five to decimal form is by using a calculator.
For example 1342five= (1*53) + (3*52) + (4*5) + 2
5 is then factored out of the parentheses, and it becomes
1342five= ((1*52) + (3*5) + 4) *5+ 2
Again, we factor out 5 out of inner values, so
1342five= (((1*5) + 3) * 5+ 4) * 5+ 2
Therefore, the inner parentheses of 1*5 would not be required because the product would be automatically done before 3 is added up. Therefore, the base can be written as
1342five= ((1*5 + 3) * 5 + 4) *5 + 2
Numbers can be converted from other bases to base 10. For instance,
2358 can be converted to base 10. Above each digit of 235, the power of the base is listed. The result would be 5 * 80 = 5
3 * 81= 24
2 * 82= 128. Then we add the values to give us 5 + 24 +128= 157
Thus, 2358= 15710
A different process is used when converting numbers from base 10 to other bases. For instance, to convert 510 to base 2, we use the following process
We divide the base into the number one is trying to convert.
The quotient is written with the remainder
The division is repeated using the whole number used in the previous quotient
The division is repeated until the number in the front of the remainder is zero
The answer is then read from the bottom
Binary numbers are also converted to decimals and vice versa. To convert from binary to decimal all that is essential is finding the decimal value of the binary numeral point.
For instance, to convert 101102 to decimal, we use the same process
According to the binary number, the decimal values would be
1 * 21= 2
1* 22= 4
1* 22= 16. The total, which is 22, is the decimal value.
Additionally, binary numbers are converted to hexadecimal numbers. For example, to convert 10110101 to hexadecimal value, we divide the number into 4 digits. I. e. 1011 0101. We then convert each group to a hexadecimal number. Therefore, 1011 becomes B while 0101 becomes 5. Thus, the hexadecimal value becomes B516 Combet et al, 1965).
The knowledge of number bases is important to programmers. Understanding how numbers are represented in each base will help in a better understanding of programming languages such as C++. Additionally, in computer engineering and software design, the knowledge of number bases is important and crucial in the technique of designing software and websites.
References
Combet, M., Van Zonneveld, H., & Verbeek, L. (1965). Computation of the base two logarithm of binary numbers. Electronic Computers, IEEE Transactions on, (6), 863-867.