Advertisement

Binary addition calculator

Add binary patterns exactly, follow the carry in each column, or recover either missing addend from an exact binary sum.

Calculator

Exact result in binary
10001
Exact decimal result
17
Result stored in selected width
00010001
Stored unsigned decimal
17
Stored signed decimal
17
Exact result exceeds selected range
No
Column steps
PositionA bitB bitCarry inSum bitCarry out
010010
111001
201101
310101
400110
500000
600000
700000

Advertisement

How this calculator works

Add from the rightmost bit. A column total of two writes 0 and carries 1; a total of three writes 1 and carries 1. The exact result can need one more bit than the inputs. Missing-addend modes subtract the known addend from the exact sum. Select unsigned or two's complement interpretation before entering patterns. Short inputs are padded with zeros to the selected width; signed negatives therefore need a leading 1 at that width. Overflow describes the exact mathematical answer, which is never silently discarded.

Formula

Sum = A + B. For a column: bit = (a + b + carry) mod 2; next carry = floor((a + b + carry)/2).

Worked example

1011 + 0110 = 10001, because 11 + 6 = 17. In four bits the stored result is 0001 and unsigned overflow is reported.

Advertisement

Frequently asked questions

What does the selected width change?

It limits each operand and determines the stored result and signed interpretation. The exact answer is also displayed, even when it needs more bits.

How are negative inputs entered?

Choose two's complement and enter the complete negative pattern for the chosen width. For example, 11111111 is -1 in eight bits. A minus sign is only accepted in the exact sum field for missing-addend calculations.

Are long binary strings exact?

Yes. Operands are text strings and calculations use integer arithmetic with no rounding. Presets reach 64 bits and custom widths reach 256 bits.

What do the steps show?

Column carries are listed from the least significant bit upwards. A carry leaving the final column belongs to the exact result.

Sources

Advertisement