Description
For zeroSign equal to -1,0,or 1 return sign=zeroSign when integer==0, otherwise Math.sign(integer).
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.
For zeroSign equal to -1,0,or 1 return sign=zeroSign when integer==0, otherwise Math.sign(integer).
When to use this tool
Use Integer Signum Zero Policy 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, zeroSign. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read sign. Use the output convention below.
For zeroSign equal to -1,0,or 1 return sign=zeroSign when integer==0, otherwise Math.sign(integer).1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| integer | Safe integer number or exact signed decimal-integer text as declared below. | Required. Safe integer. |
| zeroSign | Explicit zero sign output chosen from -1,0,1. | Required. Safe integer; minimum -1; maximum 1. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| sign | Sign | Required. Safe integer. |
{
"input": {
"integer": 0,
"zeroSign": -1
},
"output": {
"sign": -1
}
} Limitations and assumptions
- Zero's assigned sign is a caller-selected convention rather than mathematical evidence of a positive or negative value. No parsing or sign-magnitude encoding is performed.
- 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
- Integer Radix Negative Zero Policy
Format a safe integer in radix 2–36 with an explicit direct-call negative-zero policy.
- Integer Perfect Power Parity Witness
For positive integer exponent return negative=(base<0 and exponent odd) and evenPower=(exponent even).