Description
Return saturating unsigned subtraction and borrow.
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 saturating unsigned subtraction and borrow.
When to use this tool
Use Unsigned Saturating Subtraction Borrow when evaluating the stated shift, arithmetic flag or rounding convention.
How to use the tool and how it works
- Enter first, second, width. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read value, borrow. Inspect borrow before interpreting the associated values.
Return saturating unsigned subtraction and borrow. Require width 1..32 and bounded integer operands; value = max(0,first-second), borrow tests first < second.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| first | First | Required. Safe integer; minimum 0. |
| second | Second | Required. Safe integer; minimum 0. |
| width | Width under the stated bit, interval or geometry convention; apply the field-specific units and bounds. | Required. Safe integer; minimum 1; maximum 32. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| value | Value | Required. Safe integer. |
| borrow | Borrow | Required. Boolean. |
{
"input": {
"first": 3,
"second": 5,
"width": 8
},
"output": {
"value": 0,
"borrow": true
}
} Limitations and assumptions
- This clamps underflow rather than wrapping modulo the word width; it is a logical model, not hardware flag execution.
- 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
Similar or alternative tools
- Bitwise: Unsigned Less Than Borrow Flag
Return unsigned subtraction borrow and wrapped difference.
- Bitwise: Single Bit Carry Propagation Mask
Return the carry-propagation mask from adding one selected bit.