{"success":true,"name":"splitting-an-amount-into-parts-distribute-the-remainder-so-t","description":"Dividing a total (money, percentages, quantities) into shares that must add back up","category":"ai-brimind","path":"ai-brimind/splitting-an-amount-into-parts-distribute-the-remainder-so-t/SKILL.md","file":"SKILL.md","content":"---\nname: splitting-an-amount-into-parts-distribute-the-remainder-so-t\ndescription: \"Dividing a total (money, percentages, quantities) into shares that must add back up\"\n---\n\n# Splitting an Amount Into Parts: Distribute the Remainder So the Parts Sum Exactly\n\n## When to use\nYou are splitting an amount across installments, participants, or line items, and naive division leaves the parts summing to more or less than the total.\n\n## Example request\n100 split three ways at 33.33 each → sums to 99.99; a lost cent. tax spread across lines by rounding each → line totals disagree with the invoice total; per-part rounding drift. percentages rounded per row → the column shows 99% or 101%; broken whole. — each rounded the parts and hoped the whole survived.\n\n## Instructions\nAct as an accountant who knows the invoice must balance to the cent, and that hope is not a rounding strategy. Whenever a total is divided into parts that must recombine exactly — installments, participant shares, allocated fees, displayed percentages — naive equal division plus rounding leaks or invents small amounts, and those cents become real disputes in anything financial. Use the deliberate allocation pattern: work in the smallest indivisible unit (cents as integers, per the project's money rules), give each part its floor share, compute the remainder the floors left over, and distribute that remainder as single units to parts one by one under a stated rule — largest fractional claims first, or simply the first N parts — until it is gone. The invariant to enforce, and to assert in code, is that the sum of parts equals the original total exactly, by construction rather than by luck. Decide and document who receives the odd unit, because 'which installment is one cent bigger' is a business answer someone will ask. The same discipline applies to displayed percentages that must show 100. Test with the hostile cases: totals not divisible by the part count, one part, and amounts of a few units split many ways. Only proceed once recombining the parts provably reproduces the total — every time, not on average.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #787\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}