Professional Documents
Culture Documents
Lecture 9 Numbering Systems 4
Lecture 9 Numbering Systems 4
Lecture 9 Numbering Systems 4
a) +710 = 0 0 0 0 0 1 1 12
(–710 = 100001112)
b) –1010 = 1 0 0 0 1 0 1 02
(+1010 = 000010102)
What is the problem with this notation ?
Sign‐and‐Magnitude – Example
2
Example (–2) + (+4) = 1000102 + 0001002 If | +ve Number | > | –ve Number |
Set the sign bit of the –ve number to 0 (+ve), so
= 0001002 – 0000102 that both numbers become +ve.
= 0000102 = 210 Subtract the number of smaller magnitude from
the number with a bigger magnitude
One’s Complement
Positive numbers are same as in sign‐and‐magnitude
Example: +510 = 000001012 (8 bit)
as in sign‐and‐magnitude representation
Solution: Solution:
(+7) = 000001112
(+10)10 = 0 0 0 0 1 0 1 02
So,
(-10)10 = 1 1 1 1 0 1 0 12
One’s Compliment‐ Example 2
For example, in 8‐bit one’s complement,
3 is: 00000011
‐3 is: 11111100
Negative values are indicated by a 1 in the high
order bit (MSB).
What is the problem with this
notation ? 31
One’s Complement
In one’s complement, perform the addition operation on the one’s
complement representation of the numbers
A situation called Overflow might occur when addition is
performed.
Overflow => the addition result exceeds the number of bits that was
fixed
When Overflow occurs. This value
(called “End-Around Carry” or EAC)
needs to be added to the rightmost bit.
Overflow occurred
One’s Compliment‐ Example “End‐Around Carry” or
EAC
3
Example: Using one’s complement
binary arithmetic, find the sum of 48
and ‐ 19
(00011101)2 = (29)10
33
3‐ Two’s Complement
To express a value in two’s complement:
Example:
o In 8‐bit one’s complement, 3 is: 00000011
– Example: Using
two’s complement
binary arithmetic,
find the sum of 48
and - 19.
38
Two’s complement Addition
(Subtraction)
1-37
What is the largest integer we
can store?
Word size + signed or unsigned
4‐bits word unsigned:
oMax is number 15 = 24 ‐ 1
4‐bits word signed magnitude:
‐8 / +7 =- 24‐1 / 24‐1 ‐ 1
What is the largest integer we
can store?
Word size + signed or unsigned
n‐bits word unsigned:
oMax number = 2n ‐ 1
n‐bits word signed magnitude:
oMax/min number (2n‐1‐1) / -2n‐1
32‐bits word unsigned / signed: 4294967295, 2147483647/8