Returns the sum of two BigDecimal values.
You can also use the + operator on BigDecimal values.
BigDecimal.add(a, b, rounding?)
a
The first summand BigDecimal.
b
The second summand BigDecimal.
rounding optional
If present, the rounding object must contain the following properties:
roundingMode
A string specifying the rounding mode: "floor", "ceiling", "down", "up", "half-even", "half-up".
maximumSignificantDigits optional
The number of significant digits (must be >= 1).
maximumFractionDigits optional
The number of digits after the decimal point (must be >= 0).
Either maximumSignificantDigits or maximumFractionDigits must be present.
A new BigDecimal.
3.5m + 4.8m
8.3
BigDecimal.add(3.5m, 4.8m)
8.3
BigDecimal.add(3.5m, 4.5m, { roundingMode: "half-even", maximumSignificantDigits: 1 })
8