Skip to content

Main content

Money Minor Unit Parenthesis Style Tool

Calculate money minor unit parenthesis style from explicit caller-supplied inputs.

Loading tool…

Description

Pad its magnitude, insert a decimal point by digits, prefix symbol, and parenthesize negative amounts.

Monetary presentation depends on the currency's minor-unit scale, sign convention and locale. Supplying those display choices explicitly avoids confusing formatting with currency conversion, fee calculation or payment processing.

Pad its magnitude, insert a decimal point by digits, prefix symbol, and parenthesize negative amounts.

When to use this tool

Use Money Minor Unit Parenthesis Style when you need the specified monetary sign or minor-unit layout.

How to use the tool and how it works

  1. Enter minorUnits, digits, symbol. 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 text. Use the output convention below.

Require digits 0-6 and integer minorUnits. Pad its magnitude, insert a decimal point by digits, prefix symbol, and parenthesize negative amounts.1

Input fieldMeaning and unitsAccepted input
minorUnitsSafe integer in the caller-supplied minor-unit scale.Required. Safe integer.
digitsNumber of decimal places in that monetary scale, not inferred from symbol.Required. Safe integer; minimum 0; maximum 6.
symbolSymbolRequired. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
textLiteral formatted output under the stated grammar and display convention.Required. Text; maximum UTF-16 length 8192.
json
{
  "input": {
    "minorUnits": -12345,
    "digits": 2,
    "symbol": "$"
  },
  "output": {
    "text": "($123.45)"
  }
}

Limitations and assumptions

  • Digits and symbol are supplied rather than derived from a currency registry. No exchange rate, locale grouping, rounding, or real payment is performed.
  • 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

Use the intended currency metadata and locale formatter for production monetary display. Keep arithmetic, rounding, exchange rates and actual transaction authorization separate from text presentation.

References

  1. Calculation and input contract: format/money-minor-unit-parenthesis-style — tool.io

Similar or alternative tools