formatDecimalFixedPoint

function formatDecimalFixedPoint(formatter, value): string;

Formats a DecimalFixedPoint using a user-supplied Intl.NumberFormat instance, preserving full precision regardless of the value's magnitude.

Forwards value.raw to formatter.format using ES2023 string scientific notation ("<raw>E-<decimals>"). This preserves precision in fully-compliant runtimes and bypasses the JavaScript number mantissa limit.

Use this when you want locale-aware output, currency formatting, grouping separators, or rounding modes from the rich Intl.NumberFormat API. Prefer decimalFixedPointToString when portability across older runtimes (older Hermes/React Native, etc.) is a concern.

Parameters

ParameterType
formatterNumberFormat
valueDecimalFixedPoint<Signedness, number, number>

Returns

string

Example

const usdc = decimalFixedPoint('unsigned', 64, 6);
const formatter = new Intl.NumberFormat('en-US', {
    currency: 'USD',
    style: 'currency',
});
formatDecimalFixedPoint(formatter, usdc('1234.5')); // "$1,234.50"

See

decimalFixedPointToString

On this page