Unit-1 Number System Complement
Unit-1 Number System Complement
• Generally speaking, single bits are used only for storing Boolean values (true
or false).
• In most programming languages, true equates to one, while false equates
to zero.
• The smallest unit of data that can be addressed in computer memory is the byte.
• The definition of the byte has varied over the years but it is now generally
considered to be a group of eight bits, and can be used to represent alpha-
numeric and non-printing characters, unsigned integer (whole number) values
from 0 to 255, or signed integer values from -127 to +127.
Bits and Bytes
6
Bits and Bytes
1 Byte 8 Bits
– Here there is no carry, answer is - (1's complement of the sum obtained 11000)
– So answer is -00111
Binary subtraction using 1’s complement
• 1011.001 – 110.10
• Solution:
• 1’s complement of 0110.100 is 1001.011 Hence
• Minued - 1011.001
0100.101
• 10110.01 – 11010.10
• Solution:
• 1’s complement of 11010.10 is 00101.01
• 10110.01
00101.01
11011.10
110110 - 10110
Solution:
• The numbers of bits in the subtrahend is 5 while that of minuend is 6. We make
the number of bits in the subtrahend equal to that of minuend by taking a `0’ in
the sixth place of the subtrahend.
• Now, 2’s complement of 010110 is (101001 + 1) i.e.101010. Adding this with
the minuend.
•
1 1 0 1 1 0 Minuend
• After dropping the carry over we get the result of subtraction to be 100000.
Binary subtraction using 2’s complement
• 10110 – 11010
• Solution:
• 2’s complement of 11010 is (00101 + 1) i.e. 00110. Hence
• Minued - 10110
• 1010.11 – 1001.01
• Solution:
• 2’s complement of 1001.01 is 0110.11. Hence
• Minued - 1010.11
• After dropping the carry over we get the result of subtraction as 1.10.
Binary subtraction using 2’s complement
• 10100.01 – 11011.10
• Solution:
• 2’s complement of 11011.10 is 00100.10. Hence
• Minued - 10100.01
p. 50
Fractions
• Decimal to binary .25
x 2
45.25 0.5
x 2
1.0
101101.01
p. 50
Fractions
• Decimal to binary
15.6 = (1111.1001)
p. 50