Calculator: Two’s complement representation
Enter the labelled inputs to calculate: Result ₂; Result ₁₆; Value ±.
Enter a finite value within the formula’s domain and supported numeric range.
How the calculation works
u=s mod 2ʷ; MSB=1 ⇒ s=u−2ʷ
Use the displayed units and finite inputs. Results follow the stated mathematical model; zero denominators and undefined cases are rejected. Up to ten significant digits are displayed.
Values must satisfy the formula’s domain. Nonzero results too small or too large for reliable representation are rejected.
Frequently asked questions
How is the result calculated?
u=s mod 2ʷ; MSB=1 ⇒ s=u−2ʷ
What assumptions apply?
Use the displayed units and finite inputs. Results follow the stated mathematical model; zero denominators and undefined cases are rejected. Up to ten significant digits are displayed.
How precise are the displayed results?
Numerical results show up to ten significant digits. Rounding does not improve the accuracy of the input measurements or the model. Values must satisfy the formula’s domain. Nonzero results too small or too large for reliable representation are rejected.
How we verified this calculator
The calculator is checked against 3 reference cases computed independently of its code. Last passed: .
| # | Inputs | Expected result |
|---|---|---|
| 1 |
Value = -5
Bit width = 8
|
Result ₂: 11111011
Result ₁₆: fb
Value ±: -5
|
| 2 |
Value = 200
Bit width = 8
|
Result ₂: 11001000
Result ₁₆: c8
Value ±: -56
|
| 3 |
Value = -1
Bit width = 16
|
Result ₂: 1111111111111111
Result ₁₆: ffff
Value ±: -1
|