FA-60049 / Inventory cost layering / Member archive
Dollar-value LIFO layering: exact layer exhaustion · case 04
A layer stripped to exactly zero stays in the layer list as an empty year.
Case contract
Input {layers:[[year, base_dollars, index_bp]] oldest first, year, ending_current_cost, index (bp, 10000 = base year)}. Ending base dollars = round-half-up(current cost*10000/index). An increase over the prior base total adds one layer at the current index; a decrease strips base dollars from the newest layers first, removing layers that reach zero. LIFO value = sum of round-half-up(base*index/10000) per layer. Return {end_base, layers, lifo_value}.
Why this case matters
Inventory valuation and cost-of-goods decisions depend on this rule.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| strip exact layer | {"end_base": 12000, "layers": [[2020, 10000, 10000], [2021, 2000, 10800], [2022, 0, 11000]], "lifo_value": 12160} | {"end_base": 12000, "layers": [[2020, 10000, 10000], [2021, 2000, 10800]], "lifo_value": 12160} | 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 ↗