Description
Report exact decimal-string positive and negative addition margins around a safe integer, including margins larger than the safe-integer range.
Exact integer arithmetic and finite numeric arithmetic have different range limits. A safe integer number is bounded by +/-9007199254740991, while supported decimal-integer text can represent larger values. Division and remainder also need a signed convention: truncating quotients and Euclidean nonnegative remainders can give different results.
Report exact decimal-string positive and negative addition margins around a safe integer, including margins larger than the safe-integer range.
When to use this tool
Use Integer Safe Addition Margin when you need this exact stated integer sign, bound, division, comparison, or factor component.
How to use the tool and how it works
- Enter integer. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read positiveMargin, negativeMargin. Use the output convention below.
For the supplied safe integer return positiveMargin=9007199254740991-integer and negativeMargin=integer+9007199254740991 using exact integers, exported as decimal text.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| integer | Safe integer number or exact signed decimal-integer text as declared below. | Required. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| positiveMargin | Exact safe-upper-bound distance as decimal text. | Required. Text; maximum UTF-16 length 8192. |
| negativeMargin | Exact safe-lower-bound distance as decimal text. | Required. Text; maximum UTF-16 length 8192. |
{
"input": {
"integer": 42
},
"output": {
"positiveMargin": "9007199254740949",
"negativeMargin": "9007199254741033"
}
} Limitations and assumptions
- The margins are allowable nonnegative movement toward the two safe-integer endpoints, and can themselves exceed the safe numeric range. This does not perform an addition or guarantee exactness of arbitrary floating-point arithmetic.
- 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 exact decimal-integer tools when the range exceeds safe numeric integers. State the division, remainder, midpoint, and zero convention before combining results from different operations.
References
Similar or alternative tools
- Lcm Overflow Safe Factor Order
Compute their gcd by exact Euclidean division, then lcm=0 if gcd=0 or (first/gcd)*second otherwise.
- Number: Unsigned Word Maximum Decimal Digits
Determine exact maximum unsigned word value and required decimal display digits for a supplied bit width.