Split a money amount into shares with no rounding loss
num_allocateSplit a money amount into shares without losing or inventing a cent. Divide evenly into N parts, or by a list of ratios, and the remainder is distributed one minor unit at a time by a named, deterministic rule — largest-remainder, first-wins or last-wins — so the parts always sum exactly to the original. Uses Unicode CLDR minor-unit digits, so zero- and three-decimal currencies work (CLDR differs from ISO 4217 for a few, e.g. IDR, HUF: 0). Price: $0.05 per successful call, paid over x402 (USDC on Base).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rule | No | Remainder rule: largest-remainder (default), first, last or round-robin. Accepted: largest-remainder, first, last, round-robin. | |
| parts | No | Number of equal parts, 1-1000. One of parts or ratios. Accepted: integer 1-1000. | |
| amount | Yes | Decimal amount, absolute value below 1e12. Accepted: a decimal amount with absolute value below 1e12. | |
| ratios | No | Comma-separated non-negative ratios, at most 1000, each with at most 15 integer digits and 15 decimal places. One of parts or ratios. Accepted: comma-separated non-negative numbers, at most 1000. | |
| currency | Yes | ISO 4217 alpha-3 code. Accepted: an ISO 4217 alpha-3 code. |