Skip to content

Main content

Radix Fraction Leading Zero Budget

Count an explicit fractional digit string leading run of a supplied zero symbol without interpreting its radix.

Loading tool…

Description

Remove leading occurrences of a supplied zero digit from a radix-fraction transcription.

Number representation separates exact integer text, finite floating-point values and display spelling. Rational comparison can use exact cross products without decimal conversion, while floor/ceiling outputs still have a finite safe-integer range. Leading zeros and negative zero carry representational information that a numeric conversion or serializer can discard.

Remove leading occurrences of a supplied zero digit from a radix-fraction transcription.

When to use this tool

Use Radix Fraction Leading Zero Budget when you already have fractionDigits, zeroDigit and need to remove leading occurrences of a supplied zero digit from a radix-fraction transcription.

How to use the tool and how it works

  1. Enter fractionDigits, zeroDigit. 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 leadingZeroDigits, remainingDigits. Use the output convention below.

Require zeroDigit to contain one Array.from element; scan fractionDigits by code point and return the prefix count plus the remaining joined text.1

Input fieldMeaning and unitsAccepted input
fractionDigitsFraction DigitsRequired. Text; maximum UTF-16 length 8192.
zeroDigitExactly one Array.from element, compared literally; no radix alphabet is validated.Required. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
leadingZeroDigitsLeading Zero DigitsRequired. Safe integer.
remainingDigitsSource suffix after removing the leading supplied zero symbol; may be empty.Required. Text; maximum UTF-16 length 8192.
json
{
  "input": {
    "fractionDigits": "000AB",
    "zeroDigit": "0"
  },
  "output": {
    "leadingZeroDigits": 3,
    "remainingDigits": "AB"
  }
}

Limitations and assumptions

  • No radix, digit alphabet or numeric value is checked; all-zero input returns empty remainder, and a lone surrogate is not separately excluded.
  • 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

Use exact integer or rational arithmetic when exact large-number comparison is needed. Keep original token spelling for formatting questions, and verify that any transport or serialization step preserves distinctions such as leading zeros and negative zero.

References

  1. Calculation and input contract: number/radix-fraction-leading-zero-budget — tool.io

Similar or alternative tools