Skip to content

Main content

Decimal Group Separator Budget Tool

Budget fixed-size integer digit grouping separators; irregular locale grouping is outside this contract.

Loading tool…

Description

Return floor((integerDigits-1)/groupSize) separators and their total column budget.

Alignment requires a declared measure of width. ASCII token characters, supplied display-cell widths and actual rendered glyph widths are different, so a column budget is meaningful only under its stated convention.

Return floor((integerDigits-1)/groupSize) separators and their total column budget.

When to use this tool

Use Decimal Group Separator Budget when you need a supplied field-width or padding calculation.

How to use the tool and how it works

  1. Enter integerDigits, groupSize, separatorWidth. 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 separators, separatorColumns. Use the output convention below.

Require positive integer integerDigits and groupSize and nonnegative integer separatorWidth. Return floor((integerDigits-1)/groupSize) separators and their total column budget.1

Input fieldMeaning and unitsAccepted input
integerDigitsInteger DigitsRequired. Safe integer; minimum 1.
groupSizeGroup SizeRequired. Safe integer; minimum 1.
separatorWidthSeparator WidthRequired. Safe integer; minimum 0.
Output fieldInterpretationReturned shape
separatorsSeparatorsRequired. Safe integer.
separatorColumnsSeparator ColumnsRequired. Safe integer.
json
{
  "input": {
    "integerDigits": 8,
    "groupSize": 3,
    "separatorWidth": 1
  },
  "output": {
    "separators": 2,
    "separatorColumns": 2
  }
}

Limitations and assumptions

  • No number or locale is parsed; widths and fixed grouping are supplied. Indian or irregular grouping requires a different model.
  • 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

Measure text in the actual font, terminal or output environment when visual alignment matters. Account for encoding, combining marks, wide characters and locale rather than inferring display width from text length alone.

References

  1. Calculation and input contract: format/decimal-group-separator-budget — tool.io

Similar or alternative tools