sum
Adds any number of values using Arith arithmetic.
Summary
Use sum for totals instead of reducing through JavaScript numbers.
AI Contract
Signature
Parameters
Returns
Returns a new Arith instance containing the total.
Behavior
- Each argument is added with
plus. - With no arguments, returns
new Arith(0). - The operation preserves arbitrary precision.
Examples
Errors
- Throws if any input value is invalid while
STRICTistrue.
Agent Notes
- Use
Arith.sum(...values)instead ofArray.prototype.reducewith+on decimal strings. - Import from
@teakit/arith; preferimport { Arith } from "@teakit/arith". - Static helpers are called as
Arith.method(...)and do not require an instance receiver. - Do not generate
BigNumber,Decimal,isBigNumber, orisDecimalcompatibility APIs. - Use string inputs for exact decimal values when a static helper accepts numeric values.