0% found this document useful (0 votes)
8 views22 pages

Lecture 2

The document discusses binary arithmetic, which is essential for understanding data representation in digital circuits like computers. It covers the basic operations of binary addition, subtraction, multiplication, and division, along with the representation of unsigned and signed binary numbers. Additionally, it explains the concepts of sign-magnitude and complements for representing negative numbers in binary form.

Uploaded by

cindrella23401
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views22 pages

Lecture 2

The document discusses binary arithmetic, which is essential for understanding data representation in digital circuits like computers. It covers the basic operations of binary addition, subtraction, multiplication, and division, along with the representation of unsigned and signed binary numbers. Additionally, it explains the concepts of sign-magnitude and complements for representing negative numbers in binary form.

Uploaded by

cindrella23401
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Binary Arithmetic

Lecture 2
Binary Arithmetic
• Binary arithmetic is a system of mathematics used in digital circuits,
like computers, which operate on binary digits, commonly known as
bits.
• Information in computers is stored in binary form. Knowledge of
binary arithmetic is essential for understanding how data is
represented, manipulated, and processed in computers.
Binary Arithmetic
• The basic operations in binary arithmetic include
1. Addition
2. Subtraction
3. Multiplication
4. Division
Binary Addition
Rules for Addition
0+0=0
0+1=1
1+0=1
1 + 1 = 10 ( we will write 0 and carry 1 to the next column)
1 + 1 +1 = 11 (we will write 1 and carry 1 to the next column)
Binary Addition (Examples)
Binary Subtraction
• The four basic rules for subtracting bits are as follows:
0-0=0
1-1=0
1-0=1
10 - 1 = 1
When subtracting numbers, you sometimes have to borrow from the next column
to the left. A borrow is required in binary only when you try to subtract a 1 from
a 0. In this case, when a 1 is borrowed from the next column to the left, a 10 is
created in the column being subtracted, and the last of the four basic rules just
listed must be applied.
Binary Subtraction (Example)
Binary Multiplication
• The four basic rules for multiplying bits are as follows:
0×0=0
0×1=0
1×0=0
1×1=1
Multiplication is performed with binary numbers in the same manner
as with decimal numbers. It involves forming partial products, shifting
each successive partial product left one place, and then adding all the
partial products.
Binary Multiplication Examples
Binary Division
• Division in binary follows the same procedure as division in decimal
system.
Binary Number Representation
Binary number
Representation
Only for +ve numbers For +ve and -ve numbers

Unsigned Representation Signed Representation

Signed Magnitude Form Complements


Unsigned bit Representation
• As the name suggests unsigned numbers don’t have any sign
• These can contain only magnitude of the number. So, representation
of unsigned binary numbers are all positive numbers only
• For example, representation of positive decimal numbers are positive
by default. We always assume that there is a positive sign symbol in
front of every number.
Range of Unsigned bit Representation
• The range of unsigned binary number for N bit is from 0 to 2𝑁 -1.

Example: Find range of 5 bit unsigned binary numbers. Also, find


minimum and maximum value in this range.
Since, range of unsigned binary number is from 0 to (2𝑁 -1). Therefore,
range of 5 bit unsigned binary number is from 0 to (25 -1) which is
equal from minimum value 0 (i.e., 00000) to maximum value 31 (i.e.,
11111).
Range of Signed Bit Representation
The signed bit representation is used for both the positive and negative
numbers
The range of signed bit representation is for N bits is (-2N-1 to +2N-1-1)
Example: Find range of 8 bit signed binary numbers. Also, find
minimum and maximum value in this range.
As we know it’s a signed binary number so out of 8 bits, one bit is
reserved for sign and rest seven will represent a number and range is
(-2N-1 to +2N-1-1). Therefore, range of 8 bit signed binary number is
from (-28-1 to +28-1-1) which is equal from minimum value -128 to
maximum value +128.
Signed bit Representation
• As we know, unsigned representation can be used only for positive
integers.
• How about negative numbers?
Everything must be represented in binary numbers as computers
cannot use – or + signs
Signed bit Representation cont.
• Contain sign flag
• Contains both sign bit and magnitude of a number. This
representation distinguish positive and negative numbers
Sign bit Magnitude of a number

• For negative numbers the sign bit is always 1, and for positive
number it is always 0
Representation of Signed Numbers
• There are two ways of representing negative binary numbers:
1. Sign Magnitude Form
2. Complement Method
Sign-Magnitude Form
• For n bit binary number, 1 bit is reserved for sign symbol.
• The leftmost bit (MSB) is the sign bit (o is for + and 1 is for -) and the
remaining bits hold the absolute magnitude of the number.
• Example: For the 8 bit
• -47 = 1 0 1 0 1 1 1 1
• +47 = 0 0 1 0 1 1 1 1
Complements
• Complements are used in digital computers to simplify the
subtraction operation and for logical manipulation. Simplifying
operations leads to simpler, less expensive circuits to implement the
operations.
• For example instead of having separate circuit for addition and
subtraction, only addition circuits are required
Complements
• Given a number in r base system then, there are two types of
complements in each base system
1. r’s complements ( Radix complement)
2. (r-1)’ complements ( Diminished Radix complement)

When the value of the base r is substituted in the name, the two types
are referred to as the 2’s complement and 1’s complement for binary
numbers and the 10’s complement and 9’s complement for
decimal numbers.
Diminished Radix Complement (for decimal
System)
• Diminished radix complement, is defined as (𝑟 𝑛 - 1) - N. For decimal
numbers, r = 10
• and r - 1 = 9, so the 9’s complement of N is (10𝑛 - 1) - N. where n is
the number of bits in the N number
• The 9’s complement of 546700 is (106 - 1) – 546700= 999999 -
546700 = 453299.
• The 9’s complement of 012398 is 999999 - 012398 = 987601
Short method: The 9's complement of a number is calculated by
subtracting each digit of the number by 9.
Radix Complement (for decimal System)
• The r’s complement of an n‐digit number N in base r is defined as
𝑟 𝑛 - N for N≠ 0 and as 0 for N = 0.
For Example the 10’s complement of 40 is rn – N = 102 – 40 = 100 – 40
= 60
• Short method 1: Subtract first non-zero from 10, and all others from
9
• Short method 2: Simply, by adding 1 to its 9's complement we can
get its 10's complement value.

You might also like