decimalRoundToPlace
decimalRoundToPlace(
value,fractionDigits,roundingMode?):Decimal
Defined in: packages/math-numbers/src/decimal/decimal-round-to-place.ts:24
Rounds to fractionDigits decimal places, where decimalRoundToContext
rounds to significant digits. 1234.5678 to two places is 1234.57; to
two significant digits it is 1200.
A value already coarser than the target is returned unchanged rather than
padded — a Decimal carries no trailing zeros by invariant, so the padding
belongs to rendering.
Parameters
Section titled “Parameters”Readonly<Decimal>
The decimal to round.
fractionDigits
Section titled “fractionDigits”number
Places to keep. Negative rounds above the point.
roundingMode?
Section titled “roundingMode?”RoundingMode = DEFAULT_ROUNDING_MODE
How to break the last digit. Defaults to half-even.
Returns
Section titled “Returns”The rounded decimal.
Throws
Section titled “Throws”If fractionDigits is not an integer, or if
roundingMode is "unnecessary" and rounding was needed.