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
- Enter token, columnStart, accountParentheses. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- 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 field | Meaning and units | Accepted input |
|---|---|---|
| token | Token | Required. Text; maximum UTF-16 length 8192. |
| columnStart | Column Start | Required. Safe integer. |
| accountParentheses | Negative accounting form still reserves one initial column; this flag does not alter the negative offset numerically. | Required. Boolean. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| signColumns | Sign Columns | Required. Safe integer. |
| firstDigitColumn | First Digit Column | Required. Safe integer. |
{
"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
Similar or alternative tools
- Mantissa Sign Field Width
Accept auto, always, never or except-zero policy.
- Formatting: Signed Zero Parenthesis Label
Remove a leading plus, retain a negative minus or replace it with parentheses, and flag a negative all-zero value.