Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
8 views

Chapter_02 Number Systems Part1

Uploaded by

Radhika Kapoor
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Chapter_02 Number Systems Part1

Uploaded by

Radhika Kapoor
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 71

Number Systems

Lecture Outlines
• Decimal Number System
• Binary Number System
• Binary-to-Decimal Conversion
• Decimal-to-Binary Conversion
• Binary Arithmetic
Decimal Number System
Decimal Number System
Decimal Number System
Decimal Number System
Binary Number System
The binary number system has a base of 2.

The value of a bit is determined by


its position in the number.

The weight or value of a bit increases


from right to left in a binary number.

The right-most bit is the LSB (least significant bit)


in a binary whole number and has a weight of 2^0 = 1.
The weights increase from right to left by a power of two
for each bit.

The left-most bit is the MSB (most significant bit); its


weight depends on the size of the binary number.
Binary Number System
Binary Number System
Binary-to-Decimal Conversion
Binary Number System
Binary Number System
Binary Number System
Decimal Number System
Convert each of the following binary numbers to decimal numbers: 2
4
a. 10 7
11
b. 100 12
18
c. 111 21
31
d. 1011 205
113
e. 1100
f. 10010
g. 10101
h. 11111
i. 11001101
j. 1110001
Decimal-to-Binary Conversion
To convert a decimal number to its binary equivalent, we must perform a series of divisions by 2.
Figure 5.5 illustrates the conversion of the decimal number 47 to binary. We start by dividing the
decimal number by 2.

If there is a remainder, it is placed in the


LSB of the binary number. If there is no
remainder, a 0 is placed in the LSB. The
result of the division is brought down
and the process is repeated until the
result of successive divisions has been
reduced to 0.
Repeated Division-by-2 Method
Converting Decimal Fractions to Binary Repeated Multiplication by 2

For example, to convert the decimal fraction 0.3125


to binary, begin by multiplying 0.3125 by 2.

Then multiplying each resulting fractional part of the


product by 2 until the fractional product is zero or
until the desired number of decimal places is
reached.
Convert each of the following decimal numbers to binary numbers:

a)7 a)0111
b)19 b)10011
c) 28 c) 11100
d)46 d)101110
e)57 e)111001
f) 86 f) 1010110
g)94 g)1011110
h)112 h)1110000
i) 148 i) 10010100
j) 230 j) 11100110
Binary Arithmetic- Binary Addition
Mathematical operations include addition, subtraction, multiplication, and division. Binary addition
follows rules similar to decimal addition. When adding with binary numbers, there are only four
conditions that can occur:

The first three conditions are easy because they are like adding decimals, but the last condition is
slightly different. In decimal, 1 + 1 = 2. In binary, a 2 is written 10. Therefore, in binary, 1 + 1 = 0,
with a carry of 1 to the next most significant place value. When adding larger binary numbers,
the resulting 1s are carried into higher-order columns, as shown in the following examples.
Binary Subtraction
In arithmetic functions, the initial numeric quantities
that are to be combined by subtraction are the minuend
and subtrahend. The result of the subtraction process is
called the difference, represented as:

To subtract from larger binary numbers, subtract column


by column, borrowing from the adjacent column when
necessary.
Remember that when borrowing from the adjacent
column, there are now two digits, i.e., 0 borrow 1 gives
10.
Binary numbers can also be negative. The procedure
for this calculation is identical to that of decimal
numbers because the smaller value is subtracted
from the larger value and a negative sign is placed in
front of the result.
Perform the following Binary Subtraction
1. 1000 – 0111
2. 11111 – 01000
3. 1011000 – 111000
4. 1110001 – 110010
5. 1011000 - 1000100
6. 1100100 – 110010
Binary Multiplication
Complements of Binary Numbers
The 1’s complement and the 2’s complement of a binary number are important
because they permit the representation of negative numbers. The method of 2’s
complement arithmetic is commonly used in computers to handle negative
numbers.
Signed Numbers
• Digital systems, such as the computer, must be able to handle both positive and negative numbers.

• A signed binary number consists of both sign and magnitude information. The sign indicates whether a
number is positive or negative, and the magnitude is the value of the number.

• There are three forms in which signed integer (whole) numbers can be represented in binary:
sign-magnitude, 1’s complement, and 2’s complement.

• Of these, the 2’s complement is the most important and the sign-magnitude is the least used.

• Noninteger and very large or small numbers can be expressed in floating-point format.
The Decimal Value of Signed Numbers

Decimal values of positive and


negative numbers in the sign-
magnitude form are determined
by summing the weights in all
the magnitude bit positions
where there are 1s and ignoring
those positions where there are
zeros. The sign is determined by
examination of the sign bit.
Decimal values of positive numbers in the 1’s complement form are determined by summing the weights in all bit positions
where there are 1s and ignoring those positions where there are zeros. Decimal values of negative numbers are determined
by assigning a negative value to the weight of the sign bit, summing all the weights where there are 1s, and adding 1 to the
result.
Arithmetic Operations with Signed Numbers

Addition

The two numbers in an addition are the addend and the augend. The result is the sum.
• Addition of two positive numbers yields a positive number.
• Addition of a positive number and a smaller negative number yields a positive
number.
• Addition of a positive number and a larger negative number or two negative numbers
yields a negative number in 2’s complement.

There are four cases that can occur when two signed binary numbers are added.
1. Both numbers positive
2. Positive number with magnitude larger than negative number
3. Negative number with magnitude larger than positive number
4. Both numbers negative
Overflow Condition
An overflow can occur only when both
numbers are positive or both
numbers are negative.
Subtraction Subtraction is addition with the sign of the subtrahend changed.

Subtraction is a special case of addition. For example, subtracting +6 (the subtrahend)from


+9 (the minuend) is equivalent to adding 6 to +9.
The subtraction operation changes the sign of the subtrahend and adds it to the minuend.
The result of a subtraction is called the difference.
The sign of a positive or negative binary number is changed by taking its 2’s complement.
For example, when you take the 2’s complement of the positive number 00000100 (+4), you
get 11111100, which is 24 as the following sum-of-weights evaluation shows:
-128 + 64 + 32 + 16 + 8 + 4 = -4
As another example, when you take the 2’s complement of the negative number 11101101
(219), you get 00010011, which is +19 as the following sum-of-weights evaluation shows:
16 + 2 + 1 = 19
Since subtraction is simply an addition with the sign of the subtrahend changed, the process
is stated as follows:
To subtract two signed numbers, take the 2’s complement of the subtrahend and add.
Discard any final carry bit.
Multiplication Direct method

The numbers in a multiplication are the multiplicand, the multiplier, and the product. These
are illustrated in the following decimal multiplication:

The multiplication operation in most computers is accomplished using addition.

Direct addition and partial products are two basic methods for performing multiplication
using addition. In the direct addition method, you add the multiplicand a number of times
equal to the multiplier.

In the previous decimal example (8 * 3), three multiplicands are added: 8 + 8 + 8 = 24. The
disadvantage of this approach is that it becomes very lengthy if the multiplier is a large
number.
For example, to multiply 350 * 75, you must add 350 to itself 75 times. Incidentally, this is
why the term times is used to mean multiply.
Partial Products
In partial products method, the multiplicand is multiplied by each multiplier
digit beginning with the least significant digit.
The result of the multiplication of the multiplicand by a multiplier digit is called
a partial product.
Each successive partial product is moved (shifted) one place to the left and
when all the partial products have been produced, they are added to get the
final product.
If the signs are the same, the product is positive.
If the signs are different, the product is negative.
Steps for signed numbers Division
Hexadecimal-to-Binary Conversion
To convert from a hexadecimal number to a binary number, reverse the process and replace
each hexadecimal symbol with the appropriate four bits.
Hexadecimal is a convenient way to represent binary numbers.
Hexadecimal-to-Decimal Conversion
One way to find the decimal equivalent of a hexadecimal number is to first convert the
hexadecimal number to binary and then convert from binary to decimal.
Another way to convert a hexadecimal number to its decimal equivalent is to
multiply the decimal value of each hexadecimal digit by its weight and then take
the sum of these products. The weights of a hexadecimal number are increasing
powers of 16 (from right to left).
For a 4-digit hexadecimal number, the weights are
Decimal-to-Hexadecimal Conversion
Hexadecimal Addition
Addition can be done directly with hexadecimal numbers by remembering that the
Hexadecimal digits 0 through 9 are equivalent to decimal digits 0 through 9 and that
hexadecimal digits A through F are equivalent to decimal numbers 10 through 15.
When adding two hexadecimal numbers, use the following rules. (Decimal numbers
are indicated by a subscript 10.)
Hexadecimal Subtraction

You might also like