Description
Parse the decimal integer exactly and return negative, positive, or zero plus its absolute decimal magnitude.
Decimal strings can represent integers exactly beyond the safe range of ordinary floating-point numbers. Parsing their sign and digits preserves integer arithmetic, while converting the result to a floating-point number may lose precision.
Parse the decimal integer exactly and return negative, positive, or zero plus its absolute decimal magnitude.
When to use this tool
Use Integer Canonical Sign Token when you need an exact integer-string operation under the supported lexical grammar.
How to use the tool and how it works
- Enter integerDecimal. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read sign, magnitudeDecimal. Use the output convention below.
Parse the decimal integer exactly and return negative, positive, or zero plus its absolute decimal magnitude.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| integerDecimal | Integer Decimal | Required. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| sign | Sign | Required. Text; maximum UTF-16 length 8192. |
| magnitudeDecimal | Magnitude Decimal | Required. Text; maximum UTF-16 length 8192. |
{
"input": {
"integerDecimal": "-0042"
},
"output": {
"sign": "negative",
"magnitudeDecimal": "42"
}
} Limitations and assumptions
- Negative zero normalizes to zero and magnitude omits leading zeros; the input's original lexical spelling is not preserved.
- 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.
Alternative or Complementary methods
Keep large results as decimal strings and use an arbitrary-precision integer library for further exact arithmetic.
References
Similar or alternative tools
- Integer Parity Last Digit Witness
Parse the signed decimal integer exactly, take its absolute value modulo ten, and classify that last digit as even or odd.
- Currency Negative Accounting Label
Strip a leading minus and use parentheses only for a nonzero negative lexical amount.