Digital number systems:
A digital system can understand positional number system only where there are only a few symbols called digits and these symbols represent different values depending on the position they occupy in the number.
A value of each digit in a number can be determined using
· The digit
· The position of the digit in the number
· The base of the number system (where base is defined as the total number of digits available in the number system).
A computer that stores data in terms of digits (numbers) and proceeds in discrete steps from one state to the next. The states of a digital computer typically involve binary digits which may take the form of the presence or absence of magnetic markers in a storage medium (see memory), on-off switches or relays. In digital computers, even letters, words and whole texts are represented digitally. Unlike analog computers, digital computers can only approximate a continuum by assigning large numbers of digits to a state description and by proceeding in arbitrarily small steps.
Digital Number systems:
Decimal and Binary Numbers
When we write decimal (base 10) numbers, we use a positional notation system. Each digit is multiplied by an appropriate power of 10 depending on its position in the number:
For whole numbers, the rightmost digit position is the one’s position (10⁰ = 1). The numeral in that position indicates how many ones are present in the number. The next position to the left is ten’s, then hundred’s, thousand’s, and so on. Each digit position has a weight that is ten times the weight of the position to its right.
In the decimal number system, there are ten possible values that can appear in each digit position, and so there are ten numerals required to represent the quantity in each digit position. The decimal numerals are the familiar zero through nine (0, 1, 2, 3, 4, 5, 6, 7, 8, 9).
In a positional notation system, the number base is called the radix. Thus, the base ten systems that we normally use have a radix of 10. The term radix and base can be used interchangeably.
When writing numbers in a radix other than ten, or where the radix isn’t clear from the context, it is customary to specify the radix using a subscript. Thus, in a case where the radix isn’t understood, decimal numbers would be written like this:
Generally, the radix will be understood from the context and the radix specification is left off.
The binary number system is also a positional notation numbering system, but in this case, the base is not ten, but is instead two. Each digit position in a binary number represents a power of two. So, when we write a binary number, each binary digit is multiplied by an appropriate power of 2 based on the position in the number
In the binary number system, there are only two possible values that can appear in each digit position rather than the ten that can appear in a decimal number. Only the numerals 0 and 1 are used in binary numbers. The term ‘bit’ is a contraction of the words ‘binary’ and ‘digit’, and when talking about binary numbers the terms bit and digit can be used interchangeably. When talking about binary numbers, it is often necessary to talk of the number of bits used to store or represent the number. This merely describes the number of binary digits that would be required to write the number. The number in the above example is a 6 bit number.
The following are some additional examples of binary numbers:
Conversion between Decimal and Binary
Converting a number from binary to decimal is quite easy. All that is required is to find the decimal value of each binary digit position containing a 1 and add them up.
The method for converting a decimal number to binary is one that can be used to convert from decimal to any number base. It involves using successive division by the radix until the dividend reaches 0. At each division, the remainder provides a digit of the converted number, starting with the least significant digit.
Number Systems and Codes:
Arithmetic operations using decimal numbers are quite common. However, in logical design it is necessary to perform manipulations in the so-called binary system of numbers because of the on-off nature of the physical devices used. The present chapter is intended to acquaint the reader with the fundamental concepts involved in dealing with number systems other than decimal. In particular, the binary system is covered in considerable detail.
1.1 POSITIONAL NOTATION
An ordinary decimal number can be regarded as a polynomial in powers of 10. For example, 423.12 can be regarded as 4 ´ 102 + 2 ´ 101 + 3 ´ 100 + 1 ´ 10-1 + 2 ´ 10-2. Decimal numbers like this are said to be expressed in a number system with base, or radix, 10 because there are 10 basic digits (0, 1, 2, …, 9) from which the number system is formulated. In a similar fashion we can express any number N in a system using any base b. We shall write such a number as (N)b . Whenever (N)b is written, the convention of always expressing b in base 10 will be followed. Thus (N)b = (pn pn–1 … p1 p0 . p–1p–2 … p–m )b where b is an integer greater than 1 and 0 < pi < b– 1. The value of a number represented in this fashion, which is called positional notation, is given by
For decimal numbers, the symbol “.” is called the decimal point; for more general base-b numbers, it is called the radix point. That portion of the number to the right of the radix point (p–1p–2 … p–m ) is called the fractional part, and the portion to the left of the radix point (pnpn –1 … p0 ) is called the integral part.
Numbers expressed in base 2 are called binary numbers. They are often used in computers since they require only two coefficient values. The integers from 0 to 15 are given in Table 1.1-1 for several bases. Since there are no coefficient values for the range 10 to b – 1 when b > 10, the letters A, B, C, . . . are used. Base-8 numbers are called octal numbers, and base-16 numbers are called hexadecimal numbers.
Octal and hexadecimal numbers are often used as a shorthand for binary numbers. An octal number can be converted into a binary number by converting each of the octal coefficients individually into its binary equivalent. The same is true for hexadecimal numbers. This property is true because 8 and 16 are both powers of 2. For numbers with bases that are not a power of 2, the conversion to binary is more complex.
1.1-1 Conversion of Base
To make use of non-decimal number systems, it is necessary to be able to convert a number expressed in one base into the correct representation of the number in another base. One way of doing this makes direct use of the polynomial expression (1.1-1).
For example, consider the binary number (1011.101)2. The corresponding polynomial expression is
This technique of directly evaluating the polynomial expression for a number is a general method for converting from an arbitrary base b1 to another arbitrary base b2. For convenience, it will be called the polynomial method. This method consists in:
1. Expressing the number (N)b1 as a polynomial, with base-b2 numbers used in the polynomial.
2. Evaluating the polynomial, base-b2 arithmetic being used.
This polynomial method is most often used by human beings whenever a number is to be converted to base 10, since it is then possible to use decimal arithmetic.
This method for converting numbers from one base to another is the first example of one of the major goals of this book: the development of algorithms. In general terms, an algorithm is a list of instructions specifying a sequence of operations which will give the answer to any problem of a given type.
The important characteristics of an algorithm are: (1) that it is fully specified and does not rely on any skill or intuition on the part of the person applying it and (2) that it always works, (i.e., that a correct answer is always obtained.) The notion of an algorithm is discussed in more detail in Section 1.1.
It is not always convenient to use base-b2 arithmetic in converting from base-b1 to base-b2 . An algorithm for carrying out this conversion by using base-b1arithmetic will be discussed next. This discussion is specifically for the situation in which b1 =10, but it can be extended easily to the more general case. This will be called the iterative method, since it involves iterated multiplication or division.
In converting (N)10 to (N)b the fraction and integer parts are converted separately.
First, consider the integer part (portion to the left of the decimal point). The general conversion procedure is to divide (N)10 by b, giving (N)10/b and a remainder. The remainder, call it p0, is the least significant (rightmost) digit of (N). The next least significant digit, p1, is the remainder of (N)10 /b divided by b, and succeeding digits are obtained by continuing this process. A convenient form for carrying out this conversion is illustrated in the following example.