## About the calculator

This calculator can be used to add 2 binary numbers. The binary numbers may be negative, but must have the same sign.

## Adding binary numbers

2 Binary numbers can be added in a similar way to decimal numbers. If the two binary numbers have no fractional digits, they are written below each other so that the last digits of both numbers are below each other. Either above or below the two numbers, a row is left blank for the carry.

1 | 1 | 1 | 1 | 0 | ||

+ | 1 | 1 | 0 | 0 | ||

Then, starting from the rightmost column, the digits of a column are added together. It is important that the sum of the digits in a column is calculated as a binary number. If a column contains 2 ones, then the sum of the column is 10_{2} and if a column contains 3 ones, then the sum of the column is 11_{2}.

If the sum of a column is 0 or 1, then this is written to the result.

1 | 1 | 1 | 1 | 0 | ||

+ | 1 | 1 | 0 | 0 | ||

1 | 0 |

If the sum of a column is greater than 1, the last digit is written into the result and the digit before it is written into the row for the carries one column to the left.

1 | 1 | 1 | 1 | 0 | ||

+ | 1 | 1 | 0 | 0 | ||

1 | ||||||

0 | 1 | 0 |

In the next step, the carry is included in the sum.

1 | 1 | 1 | 1 | 0 | ||

+ | 1 | 1 | 0 | 0 | ||

1 | 1 | |||||

1 | 0 | 1 | 0 |

1 | 1 | 1 | 1 | 0 | ||

+ | 1 | 1 | 0 | 0 | ||

1 | 1 | 1 | ||||

0 | 1 | 0 | 1 | 0 |

1 | 1 | 1 | 1 | 0 | ||

+ | 1 | 1 | 0 | 0 | ||

1 | 1 | 1 | ||||

1 | 0 | 1 | 0 | 1 | 0 |

### Binary numbers with fractional digits:

If the two binary numbers have fractional digits, then they are written one below the other so that the binary points of both binary numbers are one below the other and then they are added as described above. If the numbers have different numbers of digits before or after the binary point, then the number with fewer digits can be filled with zeros, but you do not have to do this.

1 | 1 | 1 | 1 | 0 | . | 1 | 1 | 1 | 0 | 0 | 1 | ||

+ | 1 | 1 | 0 | 0 | . | 1 | 0 | 1 | |||||

1 | 1 | 1 | 1 | 1 | 1 | ||||||||

1 | 0 | 1 | 0 | 1 | 1 | . | 1 | 0 | 0 | 0 | 0 | 1 |

## Addition with negative binary numbers

### both binary numbers are negative:

If both summands of the addition are negative, then the addition is first performed with the absolute values of the binary numbers and a minus sign is written in front of the result.

The following addition is to be performed as an example:

−1010_{2} + (−100_{2})

First, the addition is performed with the absolute values of the two numbers:

1 | 0 | 1 | 0 | |

+ | 1 | 0 | 0 | |

1 | 1 | 1 | 0 |

The result is negative:

−1010_{2} + (−100_{2}) | = | −(1010_{2} + 100_{2}) |

= | −1110_{2} |

### one of the two summands is negative:

If one of the two summands is positive and the other negative, simply subtract the absolute value of the negative binary number from the positive binary number (subtract binary numbers).

The following addition is to be performed as an example:

−1010_{2} + 10000_{2}

So you perform the subtraction with 10000_{2} as the minuend and 1010_{2} as the subtrahend:

1 | 0 | 0 | 0 | 0 | |

− | 1 | 0 | 1 | 0 | |

1 | 1 | 1 | |||

0 | 0 | 1 | 1 | 0 |

The following therefore applies:

−1010_{2} + 10000_{2} | = | 10000_{2} + (−1010_{2}) |

= | 10000_{2} − 1010_{2} | |

= | 110_{2} |