Description
Return an exact signed left shift and a wrapping witness.
Fixed-width arithmetic can wrap, saturate, shift in sign bits or expose discarded bits. Carry, borrow and signed overflow describe different conditions; a local rounding decision or guard/sticky triplet is one part of an arithmetic operation rather than a complete floating-point result.
Return an exact signed left shift and a wrapping witness.
When to use this tool
Use Signed Shift Overflow Witness when evaluating the stated shift, arithmetic flag or rounding convention.
How to use the tool and how it works
- Enter value, width, shift. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read exactDecimal, wraps, wrapped. Inspect wraps before interpreting the associated values.
Return an exact signed left shift and a wrapping witness. Require width 1..53, shift 0..8192 and value inside the signed width range; exactDecimal is the BigInt shift, wraps tests range, wrapped uses signed width truncation.1
Fixed-width signed conversion first reduces modulo two to the word width, then interprets values in the upper half as negative.2
| Input field | Meaning and units | Accepted input |
|---|---|---|
| value | Value | Required. Safe integer. |
| width | Width under the stated bit, interval or geometry convention; apply the field-specific units and bounds. | Required. Safe integer; minimum 1; maximum 53. |
| shift | Shift | Required. Safe integer; minimum 0; maximum 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| exactDecimal | Exact decimal integer text before fixed-width wrapping; retain text for full precision. | Required. Text; maximum UTF-16 length 8192. |
| wraps | Wraps | Required. Boolean. |
| wrapped | Wrapped | Required. Safe integer. |
{
"input": {
"value": 60,
"width": 8,
"shift": 2
},
"output": {
"exactDecimal": "240",
"wraps": true,
"wrapped": -16
}
} Limitations and assumptions
- Exact text can exceed machine-word range; wrapped is a numeric two's-complement result and no language/hardware overflow behavior is executed.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Use a complete arithmetic operation with explicit width, signedness, overflow and rounding policy; keep exact integer text when values exceed ordinary numeric precision.
References
-
Calculation and input contract: bitwise/signed-shift-overflow-witness — tool.io
-
BigInt fixed-width signed and unsigned conversion — Ecma International, TC39
Similar or alternative tools
- Signed Shift Overflow Margin
Return exact shifted integer and signed-range margin.
- Word Funnel Shift Single Lane
Return a low-width lane from a two-word funnel shift.