{"id":"money-allocate","version":"1.0.0","description":"Split a money amount by weights or into equal parts with the largest remainder method; shares sum exactly to the total.","supported_operations":["split 100 dollars three ways","divide amount by weights without losing a cent","allocate 1003 cents 50/50","split bill into equal payments remainder to first","largest remainder method money","distribute payment across invoices by percentage","installments that sum to the total","split cents evenly"],"unsupported_operations":["dividing a number without a currency precision or scale","interest, fees or amortization schedules for installments","tax or VAT splitting","seat apportionment with quotas other than largest remainder"],"semantics":["Give amount, exactly one of currency (active ISO 4217 code with a minor unit) or scale (0..18), and exactly one of weights (1..1000 non-negative decimal strings, not all zero) or parts (integer 1..1000, an equal split). remainder_to is \"first\" (default) or \"last\".","amount must be a multiple of the minor unit by value (\"100\" and \"100.000\" are fine at USD, \"0.005\" is invalid_input with reason excess_precision). Weights carry any precision up to 60 digits and 40 fraction digits.","Algorithm, exact and on absolute minor units: M = |amount| x 10^scale; each share is floor(M x w_i / W) with W the sum of weights; the leftover minor units go one each to the items with the largest fractional remainders. Ties between equal remainders go to the lower index when remainder_to is \"first\" and to the higher index when \"last\". A zero-weight item never receives a leftover.","The sign is applied afterwards to every share, so a negative amount gives the negatives of the shares of its absolute value. Zero is written \"0.00\", never \"-0.00\". The sum of allocations equals total exactly; no rounding mode exists.","Outputs have exactly scale fraction digits in input order. Examples: 100.00 USD in 3 parts gives 33.34, 33.33, 33.33 (remainder_to \"last\": 33.33, 33.33, 33.34); 0.05 by weights 70 and 30 gives 0.04 and 0.01.","More than 1000 weights or a parts value above 1000 is limit_exceeded (checked before the items); a decimal string over 62 characters is limit_exceeded (before syntax). Empty weights, all-zero weights (reason weights_all_zero), negative weights, both or neither of weights and parts, and parts below 1 or non-integer are invalid_input.","Data is the pinned ISO 4217 snapshot named by data_version; no clock, locale or network.","Disclaimer: arithmetic calculation only; not financial, tax, legal, or investment advice."],"limits":{"max_decimal_chars":62,"max_decimal_digits":60,"max_fraction_digits":40,"max_scale":18,"max_weights":1000,"max_parts":1000},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["amount"],"properties":{"amount":{"type":"string","minLength":1,"maxLength":62,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Amount to split, at the currency precision (value-based; 12.500 is fine at scale 2)."},"currency":{"type":"string","minLength":3,"maxLength":3,"pattern":"^[A-Za-z]{3}$","description":"Active ISO 4217 alphabetic code with a minor unit (case-insensitive). Give exactly one of currency or scale."},"scale":{"type":"integer","minimum":0,"maximum":18,"description":"Fraction digits for non-ISO units. Give exactly one of currency or scale."},"weights":{"type":"array","minItems":1,"maxItems":1000,"items":{"type":"string","minLength":1,"maxLength":62,"pattern":"^(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"Non-negative weight; at least one weight must be non-zero."},"description":"Give exactly one of weights or parts."},"parts":{"type":"integer","minimum":1,"maximum":1000,"description":"Equal split into this many parts."},"remainder_to":{"type":"string","enum":["first","last"],"default":"first","description":"Order in which tied remainders receive the leftover minor units."}}},"output_schema":{"type":"object","additionalProperties":false,"required":["allocations","total","currency","scale","data_version"],"properties":{"allocations":{"type":"array","minItems":1,"maxItems":1000,"items":{"type":"string","minLength":1,"maxLength":400,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$"}},"total":{"type":"string","minLength":1,"maxLength":400,"pattern":"^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$","description":"The amount at fixed scale; equals the sum of allocations exactly."},"currency":{"type":["string","null"],"pattern":"^[A-Z]{3}$"},"scale":{"type":"integer","minimum":0,"maximum":18},"data_version":{"type":"string","const":"iso4217-datasets-7cdc784-2026-07-27"}}},"examples":[{"input":{"amount":"100.00","currency":"USD","parts":3},"output":{"allocations":["33.34","33.33","33.33"],"total":"100.00","currency":"USD","scale":2,"data_version":"iso4217-datasets-7cdc784-2026-07-27"}},{"input":{"amount":"0.05","currency":"EUR","weights":["70","30"]},"output":{"allocations":["0.04","0.01"],"total":"0.05","currency":"EUR","scale":2,"data_version":"iso4217-datasets-7cdc784-2026-07-27"}},{"input":{"amount":"10.00","currency":"USD","parts":3,"remainder_to":"last"},"output":{"allocations":["3.33","3.33","3.34"],"total":"10.00","currency":"USD","scale":2,"data_version":"iso4217-datasets-7cdc784-2026-07-27"}}],"execute_url":"/v1/tools/money-allocate/versions/1.0.0/execute"}