FAILURE MAP
← Case archive

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

A converted credit that rounds to zero is emitted as minus zero · case 03

A one-cent credit converted at 0.3 shows as '-0.00' on the invoice.

Member previewVariant 3 · 3 implementations · 8 checks per implementation

Case contract

solve(lines, rate, exp): lines are source-currency decimal strings (credits negative), rate a decimal string, exp the target exponent. The converted total is round_half_even(sum(lines)*rate) at exp. Each line is converted and rounded half-even individually; the difference between the converted total and the sum of converted lines is posted in full to the line with the largest absolute source amount (earliest on ties). Return the converted lines as plain strings; zero lines are unsigned. An empty invoice returns [].

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 signed-zero-line 1["-54.22", "21.70", "-0.00"]["-54.22", "21.70", "0.00"]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 ↗