Skip to content

Main content

Integer Radix Negative Zero Policy Tool

Format a safe integer in radix 2–36 with an explicit direct-call negative-zero policy.

Loading tool…

Description

Format a safe integer in radix 2–36 with an explicit direct-call negative-zero policy.

A positional representation depends on its radix, digit range, sign convention, and treatment of leading zeros. Ordinary bases use digits from zero through radix minus one, while negative and bijective bases have different conversion rules. A single carry, borrow, or denominator step is distinct from formatting a complete number.

Format a safe integer in radix 2–36 with an explicit direct-call negative-zero policy.

When to use this tool

Use Integer Radix Negative Zero Policy when you need this digit, carry, borrow, sign, width, or denominator component for an explicit radix convention.

How to use the tool and how it works

  1. Enter value, radix, preserveNegativeZero. 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 formatted, negativeZero. Inspect negativeZero before interpreting the associated values.

For a safe integer value and radix in 2..36 detect Object.is(value,-0). Return negativeZero and formatted="-0" only when that flag and preserveNegativeZero are true; otherwise use the integer's radix string.1

Input fieldMeaning and unitsAccepted input
valueSupplied scalar or returned value under the stated operation.Required. Finite number.
radixPositional base within the explicit stated bound.Required. Safe integer; minimum 2; maximum 36.
preserveNegativeZeroPreserve Negative ZeroRequired. Boolean.
Output fieldInterpretationReturned shape
formattedFormattedRequired. Text; maximum UTF-16 length 8192.
negativeZeroWhether the original numeric input satisfies Object.is(value,-0).Required. Boolean.
json
{
  "input": {
    "value": 0,
    "radix": 10,
    "preserveNegativeZero": false
  },
  "output": {
    "formatted": "0",
    "negativeZero": false
  }
}

Limitations and assumptions

  • The special sign requires an actual numeric negative zero. Upstream serialization can normalize it before this tool receives it; output digits are lowercase above nine and no arbitrary-size integer or fractional formatting is supported.
  • 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

Choose the full conversion or formatting workflow for the intended representation. Keep radix, digit alphabet, leading-zero width, signed-zero handling, and terminating/repeating-fraction assumptions explicit.

References

  1. Calculation and input contract: number/integer-radix-negative-zero-policy — tool.io

Similar or alternative tools