Binary calculation

Binary calculation

May 31, 2020
math, cs

tags
Math Computer Science Computer Architecture

The b before the code blocks mean binary number, to avoid confusion

Binary Addition #

Possibilities #

AOPB\=
1+110
1+01
0+11
0+00
1+1+111

Carry is involved whenever we have a result larger than bin 1

Binary multiplication #

Possibilities #

AOPB\=
0*00
1*00
1**11

Binary subtraction #

Possibilities #

AOPB\=
0-00
1-01
1-10
0-1(borrow 1 from the next column 10 - 1) = 1)