A little context. A clearer answer.
When this calculator is useful
A fixed-width binary result can lose a leading carry, so read the width and any overflow indication alongside the output bits. Change “Binary operand A” from 01111111 to 11111111 and keep the other inputs from the worked example. The value for “Binary result” goes from 10000000 to 00000000. For a related calculation, try Bitwise calculator: AND, OR, XOR and shifts.
What to enter
| Input | What it means | Example value |
|---|---|---|
| Integer interpretation | Choose full exact signed integers, fixed-width unsigned words, or fixed-width two’s-complement words. | Fixed-width unsigned |
| Word width in bits | Word length from 1 through 128 bits; ignored in exact mode. Fixed-width results wrap modulo 2 raised to this width. | 8 |
| Binary operand A | Operand A in binary. Exact mode permits an optional leading + or -. Word modes require an unsigned bit pattern; short inputs are zero-padded, so negative two’s-complement values need their full-width leading sign bit. | 01111111 |
| Arithmetic operation | Select addition, A minus B, multiplication, or integer quotient A divided by B. Division also shows the exact signed remainder. | Add |
| Binary operand B | Operand B follows the same binary syntax as A. It must be nonzero for division. | 1 |
How the calculation works
- Read the binary inputs as exact BigInt integers, interpreting a full-width leading 1 as negative in two’s-complement mode.
- Compute the exact arithmetic result and division remainder. For word modes, reduce the result modulo 2ʷ and apply the selected signed interpretation.
- Compare the mathematical signed and unsigned results with their respective width ranges; show bit-column carries or borrows, shifted partial products, or magnitude long division.
r = a ◦ b; word = r mod 2ʷ; a = bq + remA worked example
Our example: unsigned 8-bit 01111111 + 1 gives 10000000, decimal 128. Carry-out is 0; signed overflow is 1 because the same bit patterns represent 127 + 1, outside the signed range −128…127.
Example you can load
What to enterThis is a fixed example; changing the form above does not change these numbers.
Assumptions & limits
Exact mode accepts up to 512 binary digits per operand and retains the full result. Word modes accept widths 1–128 and inputs no longer than the width. No floating point, binary fractions, processor-specific flag emulation or bitwise operations. Division truncates toward zero; its remainder has the dividend’s sign. Signed and unsigned overflow reinterpret the same input bit patterns separately.
Frequently asked questions
How is carry different from signed overflow?
For 8 bits, 11111111 + 1 carries out and wraps to zero, while its signed interpretation is −1 + 1 = 0 without overflow. In contrast, 01111111 + 1 has signed overflow but no carry.
How do I enter a negative number?
In exact mode, prefix its magnitude with -. In two’s-complement mode, enter the full word: 11111111 means −1 at width 8. The short word 1 is padded with zeros and means +1.
What happens when division is not exact?
The quotient truncates toward zero and the remainder satisfies A = B × quotient + remainder. For example, −1101 ÷ 11 gives −100 with remainder −1 in decimal.