Skip to content

Main content

Integer Canonical Sign Token Tool

Normalize the sign and magnitude of an exact signed decimal integer, including signed or padded zero.

Loading tool…

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

  1. Enter integerDecimal. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. 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 fieldMeaning and unitsAccepted input
integerDecimalInteger DecimalRequired. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above.
Output fieldInterpretationReturned shape
signSignRequired. Text; maximum UTF-16 length 8192.
magnitudeDecimalMagnitude DecimalRequired. Text; maximum UTF-16 length 8192.
json
{
  "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

  1. Calculation and input contract: number/integer-canonical-sign-token — tool.io

Similar or alternative tools