0% found this document useful (0 votes)
2 views

Ch01_Lecture 4 Arithmetic Operations

The document discusses binary arithmetic operations, including addition, subtraction, and multiplication, highlighting the similarities to decimal operations and the use of two's complement for easier subtraction. It also covers hexadecimal and octal arithmetic, emphasizing the conversion to binary for simplification. Additionally, it explains binary-coded decimal (BCD) representation and its differences from standard binary numbers.

Uploaded by

reve8ls
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Ch01_Lecture 4 Arithmetic Operations

The document discusses binary arithmetic operations, including addition, subtraction, and multiplication, highlighting the similarities to decimal operations and the use of two's complement for easier subtraction. It also covers hexadecimal and octal arithmetic, emphasizing the conversion to binary for simplification. Additionally, it explains binary-coded decimal (BCD) representation and its differences from standard binary numbers.

Uploaded by

reve8ls
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 15

Binary Arithmetic Operations

Dr. Khursheed Aurangzeb


Binary Arithmetic Operations

 Arithmetic operations of binary numbers


follows the same rules as that of decimal
numbers. Example of binary addition
Binary Arithmetic Operations

 Example of binary subtraction


Binary Subtraction
Chapter 1

It is similar to decimal. But sometimes very


4

hectic to do the borrowing operation

 In binary, there is an way that makes it quite


easy.
 The method is based on what is called two’s
complement representation, which allows us
to convert any subtraction into an addition

 So, to subtract in octal or hexadecimal, it is


better to convert to binary first, then do the
subtraction there and convert back to
original base
Binary Subtraction
Binary Subtraction
Chapter 1
6
Binary Arithmetic Operations

 Example of binary multiplication


 The multiplier digits are always 1 or 0.
Therefore, the partial products are equal
either to multiplicand or 0


Hexadecimal Arithmetic Operations

 Example of hexadecimal addition


Addition in octal and Hexadecimal

Convert to binary and do operation then


convert back (much easier)
Example: (20.18) 16+ (D.CAFE) 16
(20.18)16 0010 0000 . 0001 1000
(D.CAFE) 16
+ 1101 . 1100 1010 1111 1110
2D.E2FE 0010 1101 . 1110 0010 1111 1110
Example: (20.18) 8+ (D.CAFE) 16
(20.15)8 010 000 . 001 101
0001 0000 . 0011 0100
(D.CAFE) 16 + 1101 . 1100 1010 1111 1110
(1D.FEFE) 16 0001 1101 . 1111 1110 1111 1110
Or 011 101 . 111 111 101 111 111 = (35.77577)8
Hexadecimal Arithmetic Operations

 The equivalent decimal calculation columns on the


right show the mental reasoning that must be carried
out to produce each digit of the hexadecimal sum.
Instead of
adding F + 6 in hexadecimal, we add the equivalent
decimals, 15 + 6 = 21. We then convert back to
hexadecimal by noting that 21 = 16 + 5. This gives a
sum digit of 5 and a carry of 1 to the next higher-
order column of digits. The other two columns
are added in a similar fashion.


Hexadecimal Arithmetic Operations

 Octal multiplication
Decimal Codes


An n-bit binary code is a group of n bits that
assume up to 2n distinct combinations of 1s and 0s

 A set of four elements can be coded with a 2-bit


binary code, with each element assigned one of
the following bit combinations: 00, 01, 10, 11. A
set of 8 elements
requires a 3-bit code, and a set of 16 elements
requires a 4-bit code

 The bit combinations of an n-bit code can be


determined from the count in binary from 0 to 2n -
1.
Binary-Coded Decimal (BCD)
Decimal Codes

 A BCD number greater than 10 has a


representation different from its equivalent
binary number, even though both contain 1s and
0s.

 Moreover, the binary combinations 1010 through


1111 are not used and have no meaning in the
BCD code

 Consider decimal 185 and its corresponding


value in BCD and binary:
(185)10 = (0001 1000 0101)BCD = (10111001)2
Decimal Codes

 The BCD value has 12 bits, but the equivalent


binary number needs only 8 bits
 Even though the BCD number needs more bits than
its equivalent binary value but it is still important
 Even though BCD numbers are represented in
binary form but still they are decimal numbers
 The difference between a decimal and a BCD
number: Decimals use symbols 0, 1, 2, …, 9, and
BCD numbers use the binary codes 0000, 0001,
0010, …, 1001

You might also like