Sei sulla pagina 1di 13

Binary Arithmetic

• Addition
• Subtraction
• Multiplication
BINARY Arithmetic
Addition
Example
0+0=0
0+1=1
1+0=1
1 + 1 = 0 (carry 1 to the next significant digit)
BINARY Arithmetic
Addition
Example #1 without carry equation
1010
+0101
1111

Let’s try to check ……………….


BINARY Arithmetic
Addition of Binary
Conversion from Binary to Decimal
To check: without carry equation

1010 = (1 x 23) + (0 x 22) + ( 1 x 21) + ( 0 x 20) = (8+0+2+0) = 10 (Decimal)


+ 0101 = (0 x 23) + (1 x 22) + ( 0 x 21) + ( 1 x 20) = (0+4+0+1) = + 5 (Decimal)
1111 = (1 x 23) + (1 x 22) + ( 1 x 21) + ( 1 x 20) = (8+4+2+1) = 15 (Decimal)

The sum of
(Binary) 1111 = 15 (Decimal)
BINARY Arithmetic
Addition
Example #2 with carry equation
10
101
+0110
1011

Let’s try to check ……………….


BINARY Arithmetic
Addition of Binary
Conversion from Binary to Decimal
To check: with carry

¹0101 = (0 x 23) + (1 x 22) + ( 0 x 21) + ( 1 x 20) = (0+4+0+1) = 5 (Decimal)


+ 0110 = (0 x 23) + (1 x 22) + ( 1 x 21) + ( 0 x 20) = (0+4+2+0) = + 6 (Decimal)
1011 = (1 x 23) + (0 x 22) + ( 1 x 21) + ( 1 x 20) = (8+0+2+1) = 11 (Decimal)

The sum of
(Binary) 1011 = 11 (Decimal)
BINARY Arithmetic
Subtraction
Example
0-0=0
0-1=1
1-0=1
Exception: 0 - 1 = 1 (0, being the minuend, in this
case borrows 1 from the next significant digit to have a
value of 102 or “two”. Thus, 2 – 1 = 1)
BINARY Arithmetic
Subtraction
Example #1 without borrow equation
1111
-1001
0110

Let’s try to check ……………….


BINARY Arithmetic
Subtraction of Binary
Conversion from Binary to Decimal
To check: (without borrow equation)

1111 = (1 x 23) + (1 x 22) + ( 1 x 21) + ( 1 x 20) = (8+4+2+1) = 15 (Decimal)


- 1001 = (1 x 23) + (0 x 22) + ( 0 x 21) + ( 1 x 20) = (8+0+0+1) = - 9 (Decimal)
0110 = (0 x 23) + (1 x 22) + ( 1 x 21) + ( 0 x 20) = (0+4+2+0) = 6 (Decimal)

The difference of
(Binary) 0110 = 6 (Decimal)
BINARY Arithmetic
Subtraction
Example #1 with borrow equation
1001
-0100
0101

Let’s try to check ……………….


BINARY Arithmetic
Subtraction of Binary
Conversion from Binary to Decimal
To check: (with borrow equation)

0110 01 = (1 x 23) + (0 x 22) + ( 0 x 21) + ( 1 x 20) = (8+0+0+1) = 9 (Decimal)


- 0 1 00 = (0 x 23) + (1 x 22) + ( 0 x 21) + ( 0 x 20) = (0+4+0+0) = - 4 (Decimal)
0 1 01 = (0 x 23) + (1 x 22) + ( 0 x 21) + ( 1 x 20) = (0+4+0+1) = 5 (Decimal)

The difference of
(Binary) 0101 = 5 (Decimal)
BINARY Arithmetic
Multiplication
Example
0x0=0
0x1=0
1x0=0
1x1=1
BINARY Arithmetic
Multiplication
Example #1
0110 = (0 x 23)+(1 x 22)+(1 x 21)+(0 x 20) = (0+4+2+0)= 6 (Decimal)
x 0010 = (0 x 23)+(0 x 22)+(1 x 21)+(0 x 20) = (0+0+2+0)= x 2 (Decimal)
0000 12
0110
0000
0000
0001100 or 1100 = (1 x 23)+(1 x 22)+(0 x 21)+(0 x 20) = (8+4+0+0)
= 12 (Decimal)

Potrebbero piacerti anche