FAILURE MAP
← Case archive

FA-62207 / Currency rounding and FX conversion / Member archive

The cumulative total is truncated toward zero · case 02

A day that starts with reversals posts converted amounts that do not sum to the floor of the total.

Member previewVariant 2 · 3 implementations · 8 checks per implementation

Case contract

solve(items, rate): items are [day, amount] with integer source minor units (reversals negative) in posting order; rate is target minor units per source minor unit. Within a day, each posting's converted amount is floor(cumulative_exact) - floor(previous cumulative_exact), so daily converted postings sum to floor of the day's exact converted total. The carry (cumulative total and previous floor) resets whenever the day changes. Return the list of integer converted postings.

Why this case matters

Currency amounts must be rounded at the right stage and in the right unit, or ledgers, quotes and settlements drift by minor units.

One recorded failure

Sample boundary fixture

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

Boundary fixtureActualExpectedOutcome
regression negative-floor 1[-143, 22, -17, 315, 724][-144, 22, -17, 315, 724]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 ↗