decimalToFixed
decimalToFixed(
value,fractionDigits?,roundingMode?):string
Defined in: packages/math-numbers/src/decimal/decimal-to-fixed.ts:23
Fixed-point notation with exactly fractionDigits places, padding with zeros
where the value has fewer — Number.prototype.toFixed for a decimal that is
not limited to binary64.
toFixed caps its argument at 100 because that is all a binary64 can ever
justify. Nothing caps this one: an arbitrary-precision decimal can carry as
many places as it was built with, and refusing to print them would make the
ceiling of the representation the ceiling of the rendering.
Parameters
Section titled “Parameters”Readonly<Decimal>
The decimal to render.
fractionDigits?
Section titled “fractionDigits?”number = 0
Places to show. Defaults to 0.
roundingMode?
Section titled “roundingMode?”RoundingMode = DEFAULT_ROUNDING_MODE
How to break the last digit. Defaults to half-even.
Returns
Section titled “Returns”string
The numeral.
Throws
Section titled “Throws”If fractionDigits is not a non-negative integer.