FA-58318 / Double-entry ledger accounting / Member archive
Straight-line depreciation journal: mid-month half steps · case 03
Mid-month assets take twice the useful life to depreciate.
Case contract
x = {'cost', 'salvage', 'life_months', 'start_month', 'convention': 'full_month'|'mid_month'|'next_month', 'through': last month to post}. Depreciable base = cost - salvage. The first charge month is start_month (start_month + 1 for next_month). Charges use cumulative rounding: target accumulated after the j-th charge month is round(base*j/life) or, for mid_month, round(base*(2j-1)/(2*life)), half-up and capped at base; each month posts target - accumulated. Posting stops after 'through' or once accumulated reaches base. Return {'schedule': [[month, amount]], 'accumulated', 'book_value': cost - accumulated}.
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 fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: mid-month half steps | {"accumulated": 63333, "book_value": 56667, "schedule": [[3, 1667], [4, 1666], [5, 1667], [6, 1667], [7, 1666], [8, 1667], [9, 1667], [10, 1666], [11, 1667], [12, 1667], [13, 1666], [14, 1667], [15, 1667], [16, 1666], [17, 1667], [18, 1667], [19, 1666], [20, 1667], [21, 1667], [22, 1666], [23, 1667], [24, 1667], [25, 1666], [26, 1667], [27, 1667], [28, 1666], [29, 1667], [30, 1667], [31, 1666], [32, 1667], [33, 1667], [34, 1666], [35, 1667], [36, 1667], [37, 1666], [38, 1667], [39, 1667], [40, 1666]]} | {"accumulated": 120000, "book_value": 0, "schedule": [[3, 1667], [4, 3333], [5, 3333], [6, 3334], [7, 3333], [8, 3333], [9, 3334], [10, 3333], [11, 3333], [12, 3334], [13, 3333], [14, 3333], [15, 3334], [16, 3333], [17, 3333], [18, 3334], [19, 3333], [20, 3333], [21, 3334], [22, 3333], [23, 3333], [24, 3334], [25, 3333], [26, 3333], [27, 3334], [28, 3333], [29, 3333], [30, 3334], [31, 3333], [32, 3333], [33, 3334], [34, 3333], [35, 3333], [36, 3334], [37, 3333], [38, 3333], [39, 1667]]} | 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 ↗