# Binary calculation

##### May 31, 2020

The `b`

before the code blocks mean binary number, to avoid confusion

## Binary Addition #

### Possibilities #

A | OP | B | \= |
---|---|---|---|

1 | + | 1 | 10 |

1 | + | 0 | 1 |

0 | + | 1 | 1 |

0 | + | 0 | 0 |

1 | + | 1+1 | 11 |

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

## Binary multiplication #

### Possibilities #

A | OP | B | \= |
---|---|---|---|

0 | * | 0 | 0 |

1 | * | 0 | 0 |

1 | ** | 1 | 1 |

## Binary subtraction #

### Possibilities #

A | OP | B | \= |
---|---|---|---|

0 | - | 0 | 0 |

1 | - | 0 | 1 |

1 | - | 1 | 0 |

0 | - | 1 | (borrow 1 from the next column 10 - 1) = 1) |