sum
Add an array of signed decimal numbers with precision for accounting, then round to any decimal places using Excel-style rounding.
Instructions
Sum an array of signed decimal numbers and round the result to a specified number of decimal places. Uses precise decimal arithmetic suitable for accounting and tax calculations. Rounding uses the 'round half away from zero' strategy (equivalent to Excel ROUND).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| values | Yes | Array of signed decimal numbers to sum (e.g. [1.00, -2.50, 3.89]) | |
| decimalPlaces | Yes | Number of decimal places to round the result to (e.g. 2 for 2 decimal places) |