How this calculator works
For nonnegative inputs, subtract the smaller magnitude from the larger, borrowing 1 from the next column whenever needed. A borrow contributes two to the current column. The exact result takes the sign of A - B. The borrow table follows those magnitudes. For signed inputs with opposite signs, the table is omitted because subtraction requires addition of magnitudes. 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
Difference = A - B. A negative result stores as (A - B) mod 2^n in n bits.
Worked example
1000 - 0011 = 0101, or 8 - 3 = 5. Reversing the operands gives -101, stored as 1011 in four bits.
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?
The table follows the magnitude calculation described above. Read the exact result for its final sign; stored results wrap to the selected width.