Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 12

3.

Number systems
Decimal Number System
 A number consists of digits that have 10 possible values, from 0 to 9.
 Decimal numbers are also called base (radix) -10 numbers.
 Each digit represents a multiple of a power of 10.

Consider the following general representation of a number with a decimal


point
a5a4a3a2a1a0. a-1a-2a-3
 The coefficients aj are any of the 10 digits (0, 1, 2, . . ., 9), and the subscript value j
gives the place value.
 Thus, the decimal number representation can be expressed as
105a5 + 104a4 + 103a3 + 102a2 + 101a1 + 100a0 + 10-1a-1 + 10-2a-2 + 10-3a-3
• For example, the number 8547 represents
8 × 103 + 5 × 102 + 4 × 101 + 7 × 100
 Decimal numbers are familiar but not practical in digital circuits.

1
Binary (base-2) Number System

 Digits can be 0 or 1.
 Each binary digit (0 or 1) is called a bit.
 Used in digital systems.
 Nibble: A group of four bits.
 Byte: A group of eight bits.
 Using positional number representation, the binary number
B = a5a4a3a2a1a0. a-1a-2a-3
represents an integer that has the value
V(B) = 25a5 + 24a4 + 23a3 + 22a2 + 21a1 + 20a0 + 2-1a-1 + 2-2a-2 + 2-3a-3
. . . . . . Eq. (1)
 For example, the binary number 1101 represents the value
V = 1 × 23 + 1 × 2 2 + 0 × 2 1 + 1 × 2 0
To specify that 1101 is a base-2 number, we will write (1101) 2.
Evaluating the preceding expression for V gives.
V = 8 + 4 + 1 = 13
Hence,
2 (1101)2 = (13)10
 There are many different number systems. In general, a number expressed in a
base‐r system has coefficients multiplied by powers of r:
an r n + an-1 r n-1 + . . . + a2r 2 + a1r + a0 + a-1 r-1+ a-2r-2 + . . .+ a-m
r-m
The coefficients aj range in value from 0 to r – 1.
 Arithmetic operation
 Arithmetic operations with numbers in base r follow the same rules as for
decimal numbers.
 Examples of addition, subtraction, and multiplication of two binary numbers are
as follows:

3
Number‐Base Conversions
 The conversion of a number in base r to decimal is done by
expanding the number in a power series and adding all the terms, as
it is done in eq. 1.
 for the reverse operation of converting a decimal number to a
number in base r:
• If the number includes a radix point, separate the number into an
integer part and a fraction part.
• The conversion of a decimal integer to a number in base r is
done by dividing the number and all successive quotients by r
and accumulating the remainders.
• The conversion of a decimal fraction to binary is accomplished
by a method similar to that used for integers. However,
multiplication is used instead of division, and integers instead of
remainders are accumulated.

4
 Example 1: Convert the decimal number 857 in to binary.
Repeated division by 2
Remainder
857 ÷ 2 = 428 1 LSB
428 ÷ 2 = 214 0
214 ÷ 2 = 107 0
107 ÷ 2 = 53 1
53 ÷ 2 = 26 1
26 ÷ 2 = 13 0
13 ÷2 = 6 1
6 ÷2 = 3 0
3 ÷2 = 1 1
1÷2=0 1 MSB

Result is (1101011001)2

5
 Example 2: Convert (0.6875)10 to binary
Repeated multiplication by 2.
Integer Fraction Coefficient
0.6875 x 2 = 1 + 0.3750 a-1 = 1
0.3750 x 2 = 0 + 0.7500 a-2 = 0
0.7500 x 2 = 1 + 0.5000 a-3 = 1
0.5000 x 2 = 1 + 0.0000 a-4 = 1

Therefore, (0.6875)10 = (0. a-1 a-2 a-3 a-4)2 = (0.1011)2.


 The conversion of decimal numbers with both integer and fraction
parts is done by converting the integer and the fraction separately and
then combining the two answers.
Thus,
(857.6875)10 = (1101011001.1011)2

6
Exercise
A) Convert decimal 55 to octal.
B) Convert decimal 0.45 to octal.

7
Octal and Hexadecimal Representations
 In octal representation the digit values range from 0 to 7.
 In hexadecimal representation each digit can have one of 16 values (0 to 9
and A, B, C, D, E & F)
 The A, B, C, D, E, and F corresponds to the decimal values 10, 11,
12, 13, 14, and 15.

8
 The octal and hexadecimal systems is that they serve as a useful shorthand
notation for binary numbers.
 One octal digit represents three bits
o The conversion from binary to octal is easily accomplished by
partitioning the binary number into groups of three digits each,
starting from the binary point and proceeding to the left and to the
right. The corresponding octal digit is then assigned to each group.

For example, 10110001101011.111100000110


is converted as
(10 110 001 101 011.111 100 000 110)2 =(26153.7406)8
2 6 1 5 3 7 4 0 6

which means that (0110001101011.111100000110)2 = (26153.7406)8

o Conversion from octal to binary is just as straightforward; each


octal digit is simply replaced by three bits that denote the same
value.
9
 Similarly, a hexadecimal digit is represented using four bits.
 Conversion from binary to hexadecimal is similar, except that the binary
number is divided into groups of four digits:

(10 1100 0110 1011.1111 0010)2 = (2C6B.F2)16


2 C 6 B F 2

 Conversion from hexadecimal to binary involves straightforward


substitution of each hexadecimal digit by four bits that denote the same
value.

10
 Complements of Numbers
• Complements are used in digital computers to simplify the subtraction
operation and for logical manipulation.
• There are two types of complements for each base‐r system:
• The radix/r’s complement and the diminished radix/(r - 1)’s
complement.
 Diminished Radix Complement
• Given a number N in base r having n digits, the (r - 1)’s complement of N
is defined as (r n - 1) - N.

• For decimal numbers, r = 10 and r - 1 = 9, so the 9’s complement of N is


(10n - 1) - N. In this case, 10n represents a number that consists of a single
1 followed by n 0’s. 10n - 1 is a number represented by n 9’s. It follows that
the 9’s complement of a decimal number is obtained by subtracting each
digit from 9.
• For example:
the 9’s complement of 524700 is 999999 - 546700 = 475299.

11
 For binary numbers, r = 2 and r - 1 = 1, so the 1’s complement of N is (2 n - 1) - N.
o Similar to the decimal case, the 1’s complement of a binary number is
obtained by subtracting each digit from 1.
o However, when subtracting binary digits from 1, we can have either
1 - 0 = 1 or 1 - 1 = 0, the bit toggles.
Example:
The 1’s complement of 1011001 is 0100110.
Radix Complement
 The r’s complement of an n‐digit number N in base r is defined as r n - N for
N ≠ 0 and as 0 for N = 0.
 we note that the r’s complement is obtained by adding 1 to the (r -
1)’s complement, since rn -N = [(r n- 1) - N] + 1.
Example: The 2’s complement of binary 100100 is 011011 + 1 = 011100.
 The 2’s complement can be formed by leaving all least significant 0’s and the
first 1 unchanged and replacing 1’s with 0’s and 0’s with 1’s in all other higher
significant digits.
Example: The 2’s complement of 1101110 is 0010010
 The complement of the complement restores the number to its original
value .
12

You might also like