allocate
Split a sum into ratio-based parts that add up exactly, using largest-remainder. For commissions, installments, and tax apportionment.
Instructions
Split an amount by integer ratios without losing a minor unit (largest-remainder method). allocate("100.00", [1,1,1]) is ["33.34","33.33","33.33"]: the parts sum to EXACTLY the original. Use this for commission splits, installments, and tax apportionment instead of doing division yourself.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | Yes | Decimal string in USD, e.g. "100.00" | |
| ratios | Yes | Integer weights, e.g. [50, 30, 20] |