FA-62291 / Currency rounding and FX conversion / Open access
The home-currency charge is rounded to nearest instead of up · case 01
The bank absorbs up to half a cent per withdrawal.
ROOT CAUSE
The back-converted charge is rounded half-even.
THE FAILURE
The back-converted charge is rounded half-even.
Unsuccessful approach: Flooring the charge absorbs almost a full cent per withdrawal.
Case contract
solve(home_minor, rate, note, fee_minor): a request of home_minor home cents at rate foreign major units per home major unit is dispensed as the largest multiple of the smallest note not exceeding the converted amount (floor). If nothing can be dispensed return 'ERR:below-min-note'. The customer is charged the dispensed foreign amount converted back at the same rate, rounded UP to a home cent, plus fee_minor. Return [foreign_dispensed, charged_minor].
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.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from decimal import Decimal, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_FLOOR, ROUND_CEILING, ROUND_DOWN, ROUND_UP, ROUND_HALF_DOWN
N = 1
observations = []
def solve(home_minor, rate, note, fee_minor):
r = Decimal(rate)
home = Decimal(home_minor) / 100
units = (home * r / note).to_integral_value(rounding=ROUND_FLOOR)
foreign = int(units) * note
if foreign == 0: return 'ERR:below-min-note'
charged = int((Decimal(foreign) / r * 100).to_integral_value(rounding=ROUND_HALF_EVEN)) + fee_minor
return [foreign, charged]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression charge-rounding 1', (1000, '0.92', 5, 0), [5, 544]),
('regression charge-rounding 2', (100000, '1352.5', 10000, 0), [1350000, 99816]),
('partial repair guard 1', (20000, '151.37', 1000, 500), [30000, 20319]),
('control: below note', (500, '0.92', 5, 250), 'ERR:below-min-note'),
('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
('control: sterling tens', (7777, '0.7893', 10, 199), [60, 7801])],
[('regression charge-rounding 1', (97345, '30.034', 10, 0), [29230, 97324]),
('regression charge-rounding 2', (128997, '1606.6071', 1000, 250), [2072000, 129218]),
('partial repair guard 1', (10870, '0.92', 10, 300), [100, 11170]),
('partial repair guard 2', (100000, '1352.5', 10000, 0), [1350000, 99816]),
('control: sterling tens', (7777, '0.7893', 10, 199), [60, 7801]),
('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319]),
('control: euro fives', (1000, '0.92', 5, 0), [5, 544]),
('control: below note', (500, '0.92', 5, 250), 'ERR:below-min-note')],
[('regression charge-rounding 1', (100634, '12628.590', 10000, 250), [12700000, 100816]),
('regression charge-rounding 2', (51281, '1711.2188', 1000, 250), [877000, 51501]),
('partial repair guard 1', (7777, '0.7893', 10, 199), [60, 7801]),
('partial repair guard 2', (20395, '717.2790', 20, 199), [146280, 20593]),
('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319]),
('control: euro fives', (1000, '0.92', 5, 0), [5, 544]),
('control: below note', (500, '0.92', 5, 250), 'ERR:below-min-note'),
('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170])],
[('regression charge-rounding 1', (48730, '311.732', 10000, 250), [150000, 48369]),
('regression charge-rounding 2', (197227, '597.2986', 5, 199), [1178030, 197426]),
('partial repair guard 1', (130189, '821.097', 5, 0), [1068975, 130189]),
('partial repair guard 2', (85223, '170817.58', 5, 500), [145575865, 85723]),
('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
('control: big notes', (100000, '1352.5', 10000, 0), [1350000, 99816]),
('control: sterling tens', (7777, '0.7893', 10, 199), [60, 7801]),
('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319])],
[('regression charge-rounding 1', (79885, '2964.227', 50, 199), [2367950, 80084]),
('regression charge-rounding 2', (10316, '108100.20', 1000, 250), [11151000, 10566]),
('partial repair guard 1', (97345, '30.034', 10, 0), [29230, 97324]),
('partial repair guard 2', (127362, '68153.76', 10, 500), [86801990, 127862]),
('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319]),
('control: euro fives', (1000, '0.92', 5, 0), [5, 544]),
('control: below note', (500, '0.92', 5, 250), 'ERR:below-min-note'),
('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170])]]
for label, args, expected in cases[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression charge-rounding 1 | [5, 543] | [5, 544] | Failed |
| regression charge-rounding 2 | [1350000, 99815] | [1350000, 99816] | Failed |
| partial repair guard 1 | [30000, 20319] | [30000, 20319] | Passed |
| control: below note | ERR:below-min-note | ERR:below-min-note | Passed |
| control: exact multiple | [100, 11170] | [100, 11170] | Passed |
| control: sterling tens | [60, 7801] | [60, 7801] | Passed |
SHA-256 / 88e350178f058b91062eedf5e7800e10edd65e012e6e3636deacd3ea54f85286
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from decimal import Decimal, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_FLOOR, ROUND_CEILING, ROUND_DOWN, ROUND_UP, ROUND_HALF_DOWN
N = 1
observations = []
def solve(home_minor, rate, note, fee_minor):
r = Decimal(rate)
home = Decimal(home_minor) / 100
units = (home * r / note).to_integral_value(rounding=ROUND_FLOOR)
foreign = int(units) * note
if foreign == 0: return 'ERR:below-min-note'
charged = int((Decimal(foreign) / r * 100).to_integral_value(rounding=ROUND_FLOOR)) + fee_minor
return [foreign, charged]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression charge-rounding 1', (1000, '0.92', 5, 0), [5, 544]),
('regression charge-rounding 2', (100000, '1352.5', 10000, 0), [1350000, 99816]),
('partial repair guard 1', (20000, '151.37', 1000, 500), [30000, 20319]),
('control: below note', (500, '0.92', 5, 250), 'ERR:below-min-note'),
('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
('control: sterling tens', (7777, '0.7893', 10, 199), [60, 7801])],
[('regression charge-rounding 1', (97345, '30.034', 10, 0), [29230, 97324]),
('regression charge-rounding 2', (128997, '1606.6071', 1000, 250), [2072000, 129218]),
('partial repair guard 1', (10870, '0.92', 10, 300), [100, 11170]),
('partial repair guard 2', (100000, '1352.5', 10000, 0), [1350000, 99816]),
('control: sterling tens', (7777, '0.7893', 10, 199), [60, 7801]),
('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319]),
('control: euro fives', (1000, '0.92', 5, 0), [5, 544]),
('control: below note', (500, '0.92', 5, 250), 'ERR:below-min-note')],
[('regression charge-rounding 1', (100634, '12628.590', 10000, 250), [12700000, 100816]),
('regression charge-rounding 2', (51281, '1711.2188', 1000, 250), [877000, 51501]),
('partial repair guard 1', (7777, '0.7893', 10, 199), [60, 7801]),
('partial repair guard 2', (20395, '717.2790', 20, 199), [146280, 20593]),
('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319]),
('control: euro fives', (1000, '0.92', 5, 0), [5, 544]),
('control: below note', (500, '0.92', 5, 250), 'ERR:below-min-note'),
('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170])],
[('regression charge-rounding 1', (48730, '311.732', 10000, 250), [150000, 48369]),
('regression charge-rounding 2', (197227, '597.2986', 5, 199), [1178030, 197426]),
('partial repair guard 1', (130189, '821.097', 5, 0), [1068975, 130189]),
('partial repair guard 2', (85223, '170817.58', 5, 500), [145575865, 85723]),
('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
('control: big notes', (100000, '1352.5', 10000, 0), [1350000, 99816]),
('control: sterling tens', (7777, '0.7893', 10, 199), [60, 7801]),
('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319])],
[('regression charge-rounding 1', (79885, '2964.227', 50, 199), [2367950, 80084]),
('regression charge-rounding 2', (10316, '108100.20', 1000, 250), [11151000, 10566]),
('partial repair guard 1', (97345, '30.034', 10, 0), [29230, 97324]),
('partial repair guard 2', (127362, '68153.76', 10, 500), [86801990, 127862]),
('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319]),
('control: euro fives', (1000, '0.92', 5, 0), [5, 544]),
('control: below note', (500, '0.92', 5, 250), 'ERR:below-min-note'),
('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170])]]
for label, args, expected in cases[N - 1]:
check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression charge-rounding 1 | [5, 543] | [5, 544] | Failed |
| regression charge-rounding 2 | [1350000, 99815] | [1350000, 99816] | Failed |
| partial repair guard 1 | [30000, 20318] | [30000, 20319] | Failed |
| control: below note | ERR:below-min-note | ERR:below-min-note | Passed |
| control: exact multiple | [100, 11169] | [100, 11170] | Failed |
| control: sterling tens | [60, 7800] | [60, 7801] | Failed |
SHA-256 / 8188e48800d1f33cefd1a87d994c98646876c6cb3aa56fb1d41b5ae0025c1cff
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 6 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
A deterministic, bounded teaching model with a stipulated toy contract; it makes no claim of conformance to any real regulation, standard, or institution's rules. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:47:03.304258+00:00.
Case digest / 40b44be6eb167a0de3617d3364e84bc1e65fff25ccb96fdc1a9ce2849280cb1d