Rounding, precision, and signs
Use the fixed-decimal preset for ordinary numeric display. Use Intl.NumberFormat in a Core template when a report needs a specific rounding or sign policy. These options change display, not arithmetic or stored values.
Cash-style increments
Section titled “Cash-style increments”This example rounds the display to the nearest 0.05 major unit. Currency selection alone does not enable cash rounding:
const cash = new Intl.NumberFormat('de-CH', { style: 'currency', currency: 'CHF', minimumFractionDigits: 2, maximumFractionDigits: 2, roundingIncrement: 5, roundingMode: 'halfExpand',});grid.columns = [{ prop: 'amount', name: 'Cash display (CHF)', readonly: true, cellTemplate: (_h, { value }) => value == null ? '' : cash.format(value),}];grid.source = [{ amount: 1.02 }, { amount: 1.03 }];These display with amounts 1.00 and 1.05; currency placement follows the locale. The source still contains 1.02 and 1.03. This illustrates an increment, not a jurisdiction’s payment or accounting rule. Put actual business rounding in your calculation layer.
Check support in the browsers you ship. Some engines silently ignore newer options. For this recipe, cash.resolvedOptions().roundingIncrement === 5 confirms the increment was recognized; do not silently substitute a different rounding policy.
Signs for deltas
Section titled “Signs for deltas”Construct a formatter with { signDisplay: 'exceptZero', minimumFractionDigits: 1, maximumFractionDigits: 1 } and use the same template pattern. In en-US, 5 displays as +5.0, -5 as -5.0, and 0 as 0.0. This is useful for BI period changes. For ratio changes, also set style: 'percent' and store fractions.
Intl option families
Section titled “Intl option families”These are Intl options, not fields on dataGridFormat.value:
| Need | Options and decisions |
|---|---|
| Required leading digits | minimumIntegerDigits; identifiers should usually remain text |
| Fixed or optional decimal places | minimumFractionDigits, maximumFractionDigits |
| Scientific precision | minimumSignificantDigits, maximumSignificantDigits |
| Combining significant and fraction limits | roundingPriority: auto, morePrecision, lessPrecision; choose deliberately |
| Rounding direction/ties | roundingMode: ceil, floor, expand, trunc, halfCeil, halfFloor, halfExpand, halfTrunc, halfEven |
| Rounding to an increment | roundingIncrement; fraction bounds must agree; cannot combine freely with significant-digit rounding |
| Suppress decimals for whole results | trailingZeroDisplay: 'stripIfInteger' |
| Plus/minus policy | signDisplay: auto, never, always, exceptZero, negative; consider negative zero |
| Group separators | useGrouping; available policies depend on runtime and notation |
| Currency representation | currencyDisplay: symbol, narrowSymbol, code, name; currencySign: standard, accounting |
| Magnitude and labels | notation, compactDisplay, style, unit, unitDisplay |
| Locale negotiation and digits | localeMatcher, numberingSystem, or locale Unicode extensions |
Specifying only one fraction bound can interact with a default for the other bound. Inspect resolvedOptions() when precision surprises you. For half-even rounding, set roundingMode: 'halfEven' with the desired precision; do not assume a binary floating-point input exactly represents a decimal tie.
See scientific notation and units for template setup, countries and locales for digits, and the ECMA-402 NumberFormat specification for allowed option combinations and runtime behavior.