A Different and Realistic Approach to Inter Base Conversion for Number System
Total Page:16
File Type:pdf, Size:1020Kb
International Journal of Computer Applications (0975 – 8887) Volume 52– No.18, August 2012 A Different and Realistic Approach to Inter Base Conversion for Number System Saurabh Rawat Bhaskar Nautiyal Anushree Sah Dept. of Computer Science & Dept. of Computer Science & University of Greenwich, Engg. Engg. London, U.K Graphic Era University Graphic Era University Dehradun, India Dehradun, India ABSTRACT number system. Apart from the decimal number system, there A number system (or system of numeration) is a writing are binary number system, octal number system and system for expressing numbers, that is a mathematical hexadecimal number system. notation for representing numbers of a given set, using digits Base (Radix)- In the number system the base or radix tells the or other symbols in a consistent manner. It can be seen as the number of symbols used in the system. In the earlier days, context that allows the symbols "11" to be interpreted as the different civilizations were using different radixes. The binary symbol for three, the decimal symbol for eleven, or a Egyptian used the radix 2, the Babylonians used the radix 60 symbol for other numbers in different bases. A number system and Mayans used 18 and 20. is a set of rules and symbols used to represent a number. Binary ( 0 , 1 ) and other famous number systems, octal ( 0-7 The base of a number system is indicated by a subscript ), hexadecimal ( 0-15 ) are based on same fundamental (decimal number) and this will be followed by the value of the number. For example concept of decimal number system ( 0-9 ). The knowledge of (879)10,(457)8 and(56A)16. number systems, their representation, limits, arithmetic Beside the fact that many students know the decimal (base 10) compliments and inter conversion of numbers between system, and are very comfortable with performing operations prescribed number systems is essential for understanding of using this number system, it is too important for students to computers and successful programming for digital devices. know and understand that the decimal system is not the only Understanding all these number conversions ( from one base number system. By studying other number systems such as to decimal and to another base ) and related concepts requires binary (base 2) quaternary (base 4), senary (base 6), octal a lot of time and large time consuming techniques to (base 8), unodecimal ( base 11 ) , duodecimal ( base 12 ) , expertise. In this paper we have elaborated concepts of tridecimal ( base 13 ), quadrodecimal (base 14 ), pentadecimal conversion among different bases and proposed with the help (base 15 ), hexadecimal (base 16) and so forth [3], students of a table to obtain simply and effectively solution from one will gain a better understanding of how number systems work base to another base conversion, without converting to in general. It is well known that the design of computers decimal number system. This effort will also enhance the begins with the choice of number system, which determines knowledge intellectuals understanding and practicing of many technical characteristics of computers. In modern number system conversions. computer, number system used is binary number system. All other number systems are converted to binary number system General Terms for computer to access data. Number system, binary,octal, hexadecimal,inter conversions 2.1 Digits and their positions Keywords Such a symbol used in a system of numeration or one of the Number system, binary,octal, hexadecimal,inter conversions ten Arabic number symbols, 0 through 9 is called digit. The 1. INTRODUCTION first digit of/in any number system is always a zero. For A number system defines a set of values to represent quantity. example, a base 2 (binary) numbers have 2 digits: 0 and 1, a We talk about the number of people attending a class, the base 8 (octal) numbers have 8 digits: 0 through 7 and so forth. number of modules taken by each student and use numbers to Remember that a base 10 or decimal numbers does not represent grade.[2] contain the digit 10, similarly base 8 or octal numbers does not contain a digit 8, and same is the case for the other Number System can be categorized in two systems:- number systems. Once the digits of a number system are understood, each and every larger numbers can be constructed (a) Non-Positional Number System using positional notation or place-value notation method. (b) Positional Number System According to this method, the first right most digit (integer) has a unit’s position in decimal number. Further, to the left of Non-Positional Number System- In ancient times, people used the units position is the ten’s position, the position to the left to count on fingers, when the fingers became insufficient for of the ten’s position is the hundred’s position and so forth. counting, stones, pebbles or sticks were used to indicate 0 Here, the units position has a weight of 10 , or 1; the tens values. But it was very difficult to perform arithmetic with 101 such a number system as there is no symbol for zero. position has a weight of , or 10; and the hundreds position has a weight of 102 , or 100. The exponential Positional Number System- In this system the value of each powers of the positions are significant for understanding digit is defined not by the symbol but also by the symbol numbers in other number systems. Always, the unit’s position position. Positional Number System is used to perform in any number system is the position to the left of the radix arithmetic. Existing Positional number system is decimal point. For example the position to the left of the binary (radix) 37 International Journal of Computer Applications (0975 – 8887) Volume 52– No.18, August 2012 point is always 20 , or 1; the position to the left of the octal Let’s examine the decimal value of 365.5. You know that this 0 value is three hundred sixty five and one-half. Now examine (radix) point is always 8 , or 1 and so on. Similarly the the position of each number: position to the left of the unit’s position is always the number 1 whose base is raised to the first power; i.e. 21, 8 and so 365.5 * .5 represents 0.5 or ½ units on. These concepts can be extended to each and every number system. 2.2 Representation of number in any base system A number in any base system can be represented in a generalized format as follows: Each digit has its own value (weight) as shown in the above N a bn a bn1 a b1 a b0 example. Now let’s look at the value of the base 10 number n n1 1 0 , 365.5 with the positional notation line graph: where N = Number, b=Base, a= any digit in that base Decimal point For example number 142 can be represented in various number systems as follows: Table 1. Number representations in various number systems 2 1 0 1 10 10 10 . 10 142 2 1 0 142 Decimal 110 410 210 100 40 2 ----------------------------------------------- 100 142 3 6 5 . 5 011 1 27 0 26 1 23 1 22 1 20 Binary 10 --------------------------------------------- 128 0 0 0 8 4 2 0 2 10 3100,or300 216 142 Octal 2 1 0 1 28 18 68 128 8 6 10 610,or60 8E 142 100 51or5 Hexa- 1 0 1 decimal 816 E 16 128 4 10 5.1or.5 We can see that the power of the base is multiplied by the number in that position to determine the value for that 2.3 Decimal Number System position. All numbers to the left of the decimal point are whole numbers or integers, and all numbers to the right of the The decimal number system is known as international system decimal point are fractions. of numbers [8]. It is also called base 10 or denary number system. It uses 10 as its base. It is the numerical base most 2.4 Binary Number System widely used by modern civilization [7]. The number system with base 2 is known as the binary Decimal notation is a base-10 positional notation system. number system. Only two symbols are used to represent Positional decimal systems include a zero and use symbols numbers in this system i.e. 0 and 1 known as bits. It is a (called digits) for the ten values i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8, and positional system i.e. every position is assigned a specific 9 to represent any number, no matter how large or how small. weight. Moreover, its number has two parts the Integral part or integers and the fractional part or fractions, set a part by a radix point. For example (1101.101)2 0 9 Decimal 1 8 Binary 2 7 0 1 3 6 4 5 Fig 2: Symbols used in binary number system In the binary number system the left–most bit is known as most significant bit (MSB) and the right–most bit is known as Fig 1: Symbols used in decimal number system the least significant bit (LSB). The following graph shows the position and the power of the base (2 in this case): 38 International Journal of Computer Applications (0975 – 8887) Volume 52– No.18, August 2012 3 2 1 0 1 2 3 .....2 2 2 2 .2 2 2 ... The arithmetic operations such as addition, subtraction, D C B multiplication and division of decimal numbers are also E performed on binary numbers. Also binary arithmetic is much F A simpler than decimal arithmetic because only two digits, 0 and 1 are used here.