0% found this document useful (0 votes)
122 views14 pages

Arithmetic in Binary: Addition, Subtraction, Multiplication, Division. 2's Complement

1) Arithmetic operations like addition, subtraction, multiplication, and division work the same in binary as in decimal, following the same rules. 2) The binary addition, subtraction, multiplication, and division tables are presented, showing how to perform these operations using binary numbers. 3) Positive integers are represented by having the first bit be 0, with the remaining bits being the standard binary representation of the number. Negative integers use 2's complement representation, with the first bit being 1.

Uploaded by

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

Arithmetic in Binary: Addition, Subtraction, Multiplication, Division. 2's Complement

1) Arithmetic operations like addition, subtraction, multiplication, and division work the same in binary as in decimal, following the same rules. 2) The binary addition, subtraction, multiplication, and division tables are presented, showing how to perform these operations using binary numbers. 3) Positive integers are represented by having the first bit be 0, with the remaining bits being the standard binary representation of the number. Negative integers use 2's complement representation, with the first bit being 1.

Uploaded by

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

Arithmetic in Binary

Addition, subtraction, multiplication, division.


2s complement
Arithmetic in binary
The rules for adding, subtracting, multiplying and dividing
numbers in bases different than 10 are the same as the
rules you learnt in primary.

But

The tables are easier!
Arithmetic in binary
Addition


+ 0 1
0 0 1
1 1 10
Arithmetic in binary
Addition




1 1 0 1 1
2

1 1 1 0
2
+
1 0 0 0 1 1
1 1 1
2
Arithmetic in binary
Subtraction




1 1 0 1 1
2

1 1 1 0
2
-
0 1 0 1 1
0
1
2
2 7
1 4
-
1 3
0
Arithmetic in binary
Multiplication


X 0 1
0 0 0
1 0 1
Arithmetic in binary
Multiplication




1 1 0 1 0
2

1 0 1 1
2
X
1 0 1 1 0
2
1 0 1 1 0
2
0 0 0 0 0
2
1 0 1 1 0
2
1 0 0 0 1 1 1 1 0
2

Arithmetic in binary
Division




1
0 1 1
2
0 1 1
2
0
0
0
0
2
1
1 1 1 0 1
2
1 0 1
2
)
0 1 1
2
0
2
1
-
-
Representing Integers
Signed Positive Integers

The first bit is 0 which means is positive

The remaining 15 bits are the binary representation of the
number as seen before



0 0 0 0 0 0 0 1 0 1 0 1 0 1 1 1
sign
+343
Representing Integers
Signed Negative Integers

The first bit is 1 which means is negative

The remaining 15 bits are the binary representation of the
non negative integer plus 32768.

That is called 2s complement


Why using 2s complement?

http://i308.wikispaces.com/Representing+integers+and+real+numbers
Representing Integers
Signed Negative Integers

Getting the 2s complement

Steps: 1- Flip all the bits
2- Add 1




-6772
10
- 0 0 1 1 0 1 0 0 1 1 1 0 1 0 0
2
Step 1
1 1 0 0 1 0 1 1 0 0 0 1 0 1 1
Step 2
1
+
1 1 0 0 1 0 1 1 0 0 0 1
1 1
1 0 0
Representing Integers
Signed Negative Integers

2s complement

The idea:

32 15 = 32 + ( 15)

18 12 = 18 + (12)

The subtraction is transformed into an addition

Representing Integers
2s complement
We can subtract now!!
e.g. using 8 bits

27
10
0 0 0 1 1 0 1 1
2



-12
10
-0 0 0 0 1 1 0 0
2



0 0 0 1 1 0 1 1
1
+
1 0 0 0 0 1 1 1 1
2
2 7
1 2
-
1 5
10
1 1 1 1 0 0 1 1
1 1 1 1 0 1 0 0
1 1 1 1 0 1 0 0
+
2s C
Operations in Binary

You might also like