FAILURE MAP
← Case archive

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

Foreign currency period-end revaluation: half-up tie rounding · case 03

Converted balances are a cent high on most accounts.

Member previewVariant 3 · 3 implementations · 7 checks per implementation

Case contract

x = {'bid': [num, den], 'ask': [num, den], 'accounts': [[name, 'asset'|'liability', monetary, foreign units, carried home cents]]}. Monetary assets are revalued at the bid rate and monetary liabilities at the ask rate: home = foreign * num / den rounded half-up per account. Non-monetary accounts keep their carried amount. Unrealized gain sums (new - carried) for assets and (carried - new) for liabilities. Return {'balances': [[name, home]], 'unrealized_gain'}.

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: half-up tie rounding{"balances": [["a0", 2], ["a1", 10]], "unrealized_gain": -492}{"balances": [["a0", 1], ["a1", 9]], "unrealized_gain": -494}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 ↗