Skip to content

Main content

Decimal Sign Column Offset Tool

Locate the first digit column in a supplied decimal sign/accounting-prefix convention without rounding or locale formatting.

Loading tool…

Description

Count an explicit sign and add that one-column offset to columnStart for the first digit, including the negative accounting-parenthesis case.

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.

Count an explicit sign and add that one-column offset to columnStart for the first digit, including the negative accounting-parenthesis case.

When to use this tool

Use Decimal Sign Column Offset when you need a supplied field-width or padding calculation.

How to use the tool and how it works

  1. Enter token, columnStart, accountParentheses. 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 signColumns, firstDigitColumn. Use the output convention below.

Require ordinary signed decimal text. Count an explicit sign and add that one-column offset to columnStart for the first digit, including the negative accounting-parenthesis case.1

Input fieldMeaning and unitsAccepted input
tokenTokenRequired. Text; maximum UTF-16 length 8192.
columnStartColumn StartRequired. Safe integer.
accountParenthesesNegative accounting form still reserves one initial column; this flag does not alter the negative offset numerically.Required. Boolean.
Output fieldInterpretationReturned shape
signColumnsSign ColumnsRequired. Safe integer.
firstDigitColumnFirst Digit ColumnRequired. Safe integer.
json
{
  "input": {
    "token": "-12.5",
    "columnStart": 4,
    "accountParentheses": true
  },
  "output": {
    "signColumns": 1,
    "firstDigitColumn": 5
  }
}

Limitations and assumptions

  • The accounting flag does not change the offset for a negative token: both signs and an opening parenthesis occupy one assumed column. No formatted string or actual display width is produced.
  • 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-sign-column-offset — tool.io

Similar or alternative tools