FA-57980 / Double-entry ledger accounting / Member archive
Foreign currency period-end revaluation: liability gain sign · case 05
A weakening home currency reports a gain on foreign-currency payables.
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 fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: liability gain sign | {"balances": [["a0", 2], ["a1", 1002], ["a2", 2], ["a3", 1003]], "unrealized_gain": 1} | {"balances": [["a0", 2], ["a1", 1002], ["a2", 2], ["a3", 1003]], "unrealized_gain": -1} | 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 ↗