2. Learning Objectives
In this lecture you will learn about:
Reasons for using binary instead of decimal numbers
Basic arithmetic operations using binary numbers
Addition (+)
Subtraction (-)
Multiplication (*)
Division (/)
3. Binary over Decimal
Information is handled in a computer by electronic/ electrical
components
Electronic components operate in binary mode (can only
indicate two states – ON (1) or OFF (0)
Binary number system has only two digits (0 and 1), and is
suitable for expressing two possible states
In binary system, computer circuits only have to handle two
binary digits rather than ten decimal digits causing:
Simpler internal circuit design
Less expensive
More reliable circuits
Arithmetic rules/processes possible with binary numbers
4. Examples of a Few Devices that
work in Binary Mode Binary
5. Binary Number System
System Digits: 0 and 1
Bit (short for binary digit): A single binary digit
LSB (least significant bit): The rightmost bit
MSB (most significant bit): The leftmost bit
Upper Byte (or nybble): The right-hand byte (or
nybble) of a pair
Lower Byte (or nybble): The left-hand byte (or nybble)
of a pair
The term nibble used for 4 bits being a subset of byte.
8. Binary Arithmetic
Binary arithmetic is simple to learn as binary
number system has only two digits – 0 and 1
Following slides show rules and example for
the four basic arithmetic operations using
binary numbers
9. Binary Addition
Rule for binary addition is as follows:
① 0 + 0 = 0
② 0 + 1 = 1
③ 1 + 0 = 1
④ 1 + 1 = 0 plus a carry of 1 to next higher
column
21. Binary Division
Table for binary division is as follows:
① 0 ÷ 0 = Divide by zero error
② 0 ÷ 1 = 0
③ 1 ÷ 0 = Divide by zero error
④ 1 ÷ 1 = 1
As in the decimal number system (or in any
other number system), division by zero is
meaningless
The computer deals with this problem by raising
an error condition called ‘Divide by zero’ error
22. Rules for Binary Division
① Start from the left of the dividend
② Perform a series of subtractions in which the divisor is
subtracted from the dividend
③ If subtraction is possible, put a 1 in the quotient and
subtract the divisor from the corresponding digits of
dividend
④ If subtraction is not possible (divisor greater than
remainder), record a 0 in the quotient
⑤ Bring down the next digit to add to the remainder
digits. Proceed as before in a manner similar to long
division
30. Complementary Method of
Subtraction
Involves following 3 steps:
Step 1: Find the complement of the number you
are subtracting (subtrahend)
Step 2: Add this to the number from which you are
taking away (minuend)
Step 3: If there is a carry of 1, add it to obtain the
result; if there is no carry, recomplement the sum
and attach a negative sign
Complementary subtraction is an additive
approach of subtraction
35. Addition/Subtraction of Numbers
in 2’s Complement Notation
35
Represent all negative numbers in 2’s complement
form.
Now we have the same procedure for addition and
subtraction.
Subtraction of a number is achieved by adding the 2’s
complement of the number.
This is illustrated in the following example where the
carry, if any, from the most significant bit, during
addition, should be ignored.
The result has to be interpreted appropriately using the
same convention.