Package: effect
Module: BigDecimal
Takes an Iterable of BigDecimals and returns their sum as a single BigDecimal.
When to use
Use when you need to aggregate decimal quantities with decimal precision instead of converting through JavaScript numbers.
Example (Adding multiple decimals)
import { BigDecimal } from "effect"
import * as assert from "node:assert"
assert.deepStrictEqual(
BigDecimal.sumAll([BigDecimal.fromStringUnsafe("2"), BigDecimal.fromStringUnsafe("3"), BigDecimal.fromStringUnsafe("4")]),
BigDecimal.fromStringUnsafe("9")
)
See
sum for adding two BigDecimal valuesSignature
declare const sumAll: (collection: Iterable<BigDecimal>) => BigDecimal
Since v3.16.0