FAILURE MAP
← Case archive

FA-58159 / Double-entry ledger accounting / Member archive

Cost pool allocation entry: leftover distribution · case 04

All rounding cents pile onto the heaviest cost center.

Member previewVariant 4 · 3 implementations · 7 checks per implementation

Case contract

x = {'amount': signed cents, 'weights': [[center, non-negative weight]] (some positive), 'source': account}. The pool magnitude is split across positive-weight centers by the largest remainder method: floor shares, then one extra cent to the largest remainders, ties to the earlier-listed center. A non-negative amount credits the source and debits centers; a negative amount (reversal) debits the source and credits centers, all amounts positive. Return lines [[source, side, magnitude]] + [[center, side, share]] for nonzero shares in listing order.

Why this case matters

Ledger software must keep debits equal to credits and apply normal-balance, period and cutoff rules exactly; small sign or boundary slips silently misstate financial statements.

One recorded failure

Sample boundary fixture

This sample comes from the broken implementation of a controlled reproducer.

Boundary fixtureActualExpectedOutcome
regression: leftover distribution[["pool", "C", 100], ["it", "D", 41], ["fin", "D", 16], ["mkt", "D", 38], ["hr", "D", 5]][["pool", "C", 100], ["it", "D", 39], ["fin", "D", 17], ["mkt", "D", 39], ["hr", "D", 5]]Failed

MEMBER ARCHIVE

The complete case is available to members.

This record includes three runnable implementations, regression fixtures, execution results, and source hashes.

Member access is invitation-based. Sign in with your invited account to inspect the sources.

Sign in to the archive ↗