rationalFormat
rationalFormat(
value,locales?,options?):string
Defined in: packages/math-numbers/src/rational/rational-format.ts:28
A rational rendered for a human, by Intl.NumberFormat.
Intl has no ratio notation, so this is the decimal expansion rather than
rationalToString’s p/q — which for a non-terminating fraction means a
rounded one, as it must be.
The expansion is taken to as many places as the resolved options can consume,
plus two guard digits, and rationalToDecimalString’s sticky last digit
carries “there is more below” into Intl’s own rounding. That is what stops
the two roundings from disagreeing: without it a truncation landing on a tie
would break the wrong way.
Parameters
Section titled “Parameters”Readonly<Rational>
The rational to render.
locales?
Section titled “locales?”LocalesArgument
Passed straight to Intl.NumberFormat.
options?
Section titled “options?”NumberFormatOptions
Passed straight to Intl.NumberFormat.
Returns
Section titled “Returns”string
The localized rendering.