FA-62286 / Currency rounding and FX conversion / Open access
The customer is charged the requested amount instead of the dispensed amount · case 01
Requesting 200.00 but receiving 30,000 yen charges 200.00 plus the fee.
ROOT CAUSE
The charge uses home_minor rather than converting back the dispensed foreign amount.
VERIFIED REPAIR
Charge the dispensed foreign amount converted at the rate, rounded up, plus the fee.
Unsuccessful approach: Charging the converted dispensed amount but omitting the fee under-charges every 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 = home_minor + fee_minor
return [foreign, charged]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression charge-basis 1', (20000, '151.37', 1000, 500), [30000, 20319]),
('regression charge-basis 2', (1000, '0.92', 5, 0), [5, 544]),
('partial repair guard 2', (10870, '0.92', 10, 300), [100, 11170]),
('control: below note', (500, '0.92', 5, 250), 'ERR:below-min-note'),
('control: big notes', (100000, '1352.5', 10000, 0), [1350000, 99816]),
('control: sterling tens', (7777, '0.7893', 10, 199), [60, 7801])],
[('regression charge-basis 1', (100000, '1352.5', 10000, 0), [1350000, 99816]),
('regression charge-basis 2', (7777, '0.7893', 10, 199), [60, 7801]),
('partial repair guard 2', (20395, '717.2790', 20, 199), [146280, 20593]),
('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
('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-basis 1', (20395, '717.2790', 20, 199), [146280, 20593]),
('regression charge-basis 2', (97345, '30.034', 10, 0), [29230, 97324]),
('partial repair guard 1', (85223, '170817.58', 5, 500), [145575865, 85723]),
('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])],
[('regression charge-basis 1', (42899, '157086.46', 10000, 500), [67380000, 43394]),
('regression charge-basis 2', (86470, '264.5122', 10000, 500), [220000, 83672]),
('partial repair guard 1', (190855, '53583.55', 5, 500), [102266880, 191355]),
('partial repair guard 2', (13032, '1289.013', 20, 199), [167980, 13231]),
('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-basis 1', (128997, '1606.6071', 1000, 250), [2072000, 129218]),
('regression charge-basis 2', (100634, '12628.590', 10000, 250), [12700000, 100816]),
('partial repair guard 1', (42899, '157086.46', 10000, 500), [67380000, 43394]),
('partial repair guard 2', (8787, '197046.01', 10, 250), [17314430, 9037]),
('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-basis 1 | [30000, 20500] | [30000, 20319] | Failed |
| regression charge-basis 2 | [5, 1000] | [5, 544] | Failed |
| partial repair guard 2 | [100, 11170] | [100, 11170] | Passed |
| control: below note | ERR:below-min-note | ERR:below-min-note | Passed |
| control: big notes | [1350000, 100000] | [1350000, 99816] | Failed |
| control: sterling tens | [60, 7976] | [60, 7801] | Failed |
SHA-256 / 53b16c3cc1620a9ef3ccdde252d725fcf2c23a5b66be0009d529c5913f113ff5
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_CEILING))
return [foreign, charged]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression charge-basis 1', (20000, '151.37', 1000, 500), [30000, 20319]),
('regression charge-basis 2', (1000, '0.92', 5, 0), [5, 544]),
('partial repair guard 2', (10870, '0.92', 10, 300), [100, 11170]),
('control: below note', (500, '0.92', 5, 250), 'ERR:below-min-note'),
('control: big notes', (100000, '1352.5', 10000, 0), [1350000, 99816]),
('control: sterling tens', (7777, '0.7893', 10, 199), [60, 7801])],
[('regression charge-basis 1', (100000, '1352.5', 10000, 0), [1350000, 99816]),
('regression charge-basis 2', (7777, '0.7893', 10, 199), [60, 7801]),
('partial repair guard 2', (20395, '717.2790', 20, 199), [146280, 20593]),
('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
('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-basis 1', (20395, '717.2790', 20, 199), [146280, 20593]),
('regression charge-basis 2', (97345, '30.034', 10, 0), [29230, 97324]),
('partial repair guard 1', (85223, '170817.58', 5, 500), [145575865, 85723]),
('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])],
[('regression charge-basis 1', (42899, '157086.46', 10000, 500), [67380000, 43394]),
('regression charge-basis 2', (86470, '264.5122', 10000, 500), [220000, 83672]),
('partial repair guard 1', (190855, '53583.55', 5, 500), [102266880, 191355]),
('partial repair guard 2', (13032, '1289.013', 20, 199), [167980, 13231]),
('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-basis 1', (128997, '1606.6071', 1000, 250), [2072000, 129218]),
('regression charge-basis 2', (100634, '12628.590', 10000, 250), [12700000, 100816]),
('partial repair guard 1', (42899, '157086.46', 10000, 500), [67380000, 43394]),
('partial repair guard 2', (8787, '197046.01', 10, 250), [17314430, 9037]),
('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-basis 1 | [30000, 19819] | [30000, 20319] | Failed |
| regression charge-basis 2 | [5, 544] | [5, 544] | Passed |
| partial repair guard 2 | [100, 10870] | [100, 11170] | Failed |
| control: below note | ERR:below-min-note | ERR:below-min-note | Passed |
| control: big notes | [1350000, 99816] | [1350000, 99816] | Passed |
| control: sterling tens | [60, 7602] | [60, 7801] | Failed |
SHA-256 / 9ae5842260b99c90d180b6ca387932a36343f96e7cae47317b7b57ae494d5b98
3 / The verified repair
Exit 0"""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_CEILING)) + fee_minor
return [foreign, charged]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression charge-basis 1', (20000, '151.37', 1000, 500), [30000, 20319]),
('regression charge-basis 2', (1000, '0.92', 5, 0), [5, 544]),
('partial repair guard 2', (10870, '0.92', 10, 300), [100, 11170]),
('control: below note', (500, '0.92', 5, 250), 'ERR:below-min-note'),
('control: big notes', (100000, '1352.5', 10000, 0), [1350000, 99816]),
('control: sterling tens', (7777, '0.7893', 10, 199), [60, 7801])],
[('regression charge-basis 1', (100000, '1352.5', 10000, 0), [1350000, 99816]),
('regression charge-basis 2', (7777, '0.7893', 10, 199), [60, 7801]),
('partial repair guard 2', (20395, '717.2790', 20, 199), [146280, 20593]),
('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
('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-basis 1', (20395, '717.2790', 20, 199), [146280, 20593]),
('regression charge-basis 2', (97345, '30.034', 10, 0), [29230, 97324]),
('partial repair guard 1', (85223, '170817.58', 5, 500), [145575865, 85723]),
('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])],
[('regression charge-basis 1', (42899, '157086.46', 10000, 500), [67380000, 43394]),
('regression charge-basis 2', (86470, '264.5122', 10000, 500), [220000, 83672]),
('partial repair guard 1', (190855, '53583.55', 5, 500), [102266880, 191355]),
('partial repair guard 2', (13032, '1289.013', 20, 199), [167980, 13231]),
('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-basis 1', (128997, '1606.6071', 1000, 250), [2072000, 129218]),
('regression charge-basis 2', (100634, '12628.590', 10000, 250), [12700000, 100816]),
('partial repair guard 1', (42899, '157086.46', 10000, 500), [67380000, 43394]),
('partial repair guard 2', (8787, '197046.01', 10, 250), [17314430, 9037]),
('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-basis 1 | [30000, 20319] | [30000, 20319] | Passed |
| regression charge-basis 2 | [5, 544] | [5, 544] | Passed |
| partial repair guard 2 | [100, 11170] | [100, 11170] | Passed |
| control: below note | ERR:below-min-note | ERR:below-min-note | Passed |
| control: big notes | [1350000, 99816] | [1350000, 99816] | Passed |
| control: sterling tens | [60, 7801] | [60, 7801] | Passed |
SHA-256 / dcd1a49615ede4fbbca71a4c5858b31af4d3c8b00f02976a60eba4d9cd96f3c9
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.279687+00:00.
Case digest / 9e74805df6c2b7cbe34f8f381b32719a8e18d30d03fb2bfaaa0f9ebc8d12057a