FAILURE MAP
← Case archive

FA-62296 / Currency rounding and FX conversion / Open access

A request below the smallest note is charged the fee · case 01

The customer pays the ATM fee for a withdrawal that dispensed nothing.

Verified by executionVariant 1 · 6 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The empty-dispense guard is missing, so the fee is still added.

VERIFIED REPAIR

Return ERR:below-min-note when no note can be dispensed.

Unsuccessful approach: Returning a zero charge still reports a completed zero withdrawal instead of an error.

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
    pass
    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 zero-dispense 1', (500, '0.92', 5, 250), 'ERR:below-min-note'),
  ('regression zero-dispense 2', (100, '0.7893', 10, 199), 'ERR:below-min-note'),
  ('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319]),
  ('control: euro fives', (1000, '0.92', 5, 0), [5, 544]),
  ('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
  ('control: big notes', (100000, '1352.5', 10000, 0), [1350000, 99816])],
 [('regression zero-dispense 1', (500, '0.92', 5, 250), 'ERR:below-min-note'),
  ('regression zero-dispense 2', (100, '0.7893', 10, 199), 'ERR:below-min-note'),
  ('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 zero-dispense 1', (500, '0.92', 5, 250), 'ERR:below-min-note'),
  ('regression zero-dispense 2', (100, '0.7893', 10, 199), 'ERR:below-min-note'),
  ('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319]),
  ('control: euro fives', (1000, '0.92', 5, 0), [5, 544]),
  ('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
  ('control: big notes', (100000, '1352.5', 10000, 0), [1350000, 99816])],
 [('regression zero-dispense 1', (500, '0.92', 5, 250), 'ERR:below-min-note'),
  ('regression zero-dispense 2', (100, '0.7893', 10, 199), 'ERR:below-min-note'),
  ('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 zero-dispense 1', (500, '0.92', 5, 250), 'ERR:below-min-note'),
  ('regression zero-dispense 2', (100, '0.7893', 10, 199), 'ERR:below-min-note'),
  ('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319]),
  ('control: euro fives', (1000, '0.92', 5, 0), [5, 544]),
  ('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
  ('control: big notes', (100000, '1352.5', 10000, 0), [1350000, 99816])]]
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 fixtureActualExpectedOutcome
regression zero-dispense 1[0, 250]ERR:below-min-noteFailed
regression zero-dispense 2[0, 199]ERR:below-min-noteFailed
control: yen notes[30000, 20319][30000, 20319]Passed
control: euro fives[5, 544][5, 544]Passed
control: exact multiple[100, 11170][100, 11170]Passed
control: big notes[1350000, 99816][1350000, 99816]Passed

SHA-256 / 50b18bb9aee4ffdc3d1c8cc82dbc46367a868c05aec304d049acc95a070b2204

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 [0, 0]
    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 zero-dispense 1', (500, '0.92', 5, 250), 'ERR:below-min-note'),
  ('regression zero-dispense 2', (100, '0.7893', 10, 199), 'ERR:below-min-note'),
  ('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319]),
  ('control: euro fives', (1000, '0.92', 5, 0), [5, 544]),
  ('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
  ('control: big notes', (100000, '1352.5', 10000, 0), [1350000, 99816])],
 [('regression zero-dispense 1', (500, '0.92', 5, 250), 'ERR:below-min-note'),
  ('regression zero-dispense 2', (100, '0.7893', 10, 199), 'ERR:below-min-note'),
  ('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 zero-dispense 1', (500, '0.92', 5, 250), 'ERR:below-min-note'),
  ('regression zero-dispense 2', (100, '0.7893', 10, 199), 'ERR:below-min-note'),
  ('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319]),
  ('control: euro fives', (1000, '0.92', 5, 0), [5, 544]),
  ('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
  ('control: big notes', (100000, '1352.5', 10000, 0), [1350000, 99816])],
 [('regression zero-dispense 1', (500, '0.92', 5, 250), 'ERR:below-min-note'),
  ('regression zero-dispense 2', (100, '0.7893', 10, 199), 'ERR:below-min-note'),
  ('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 zero-dispense 1', (500, '0.92', 5, 250), 'ERR:below-min-note'),
  ('regression zero-dispense 2', (100, '0.7893', 10, 199), 'ERR:below-min-note'),
  ('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319]),
  ('control: euro fives', (1000, '0.92', 5, 0), [5, 544]),
  ('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
  ('control: big notes', (100000, '1352.5', 10000, 0), [1350000, 99816])]]
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 fixtureActualExpectedOutcome
regression zero-dispense 1[0, 0]ERR:below-min-noteFailed
regression zero-dispense 2[0, 0]ERR:below-min-noteFailed
control: yen notes[30000, 20319][30000, 20319]Passed
control: euro fives[5, 544][5, 544]Passed
control: exact multiple[100, 11170][100, 11170]Passed
control: big notes[1350000, 99816][1350000, 99816]Passed

SHA-256 / ee5bcb82f95a54f677f9d4f666b1370c1baabbc3b1bd9159991cd30e181411e1

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 zero-dispense 1', (500, '0.92', 5, 250), 'ERR:below-min-note'),
  ('regression zero-dispense 2', (100, '0.7893', 10, 199), 'ERR:below-min-note'),
  ('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319]),
  ('control: euro fives', (1000, '0.92', 5, 0), [5, 544]),
  ('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
  ('control: big notes', (100000, '1352.5', 10000, 0), [1350000, 99816])],
 [('regression zero-dispense 1', (500, '0.92', 5, 250), 'ERR:below-min-note'),
  ('regression zero-dispense 2', (100, '0.7893', 10, 199), 'ERR:below-min-note'),
  ('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 zero-dispense 1', (500, '0.92', 5, 250), 'ERR:below-min-note'),
  ('regression zero-dispense 2', (100, '0.7893', 10, 199), 'ERR:below-min-note'),
  ('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319]),
  ('control: euro fives', (1000, '0.92', 5, 0), [5, 544]),
  ('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
  ('control: big notes', (100000, '1352.5', 10000, 0), [1350000, 99816])],
 [('regression zero-dispense 1', (500, '0.92', 5, 250), 'ERR:below-min-note'),
  ('regression zero-dispense 2', (100, '0.7893', 10, 199), 'ERR:below-min-note'),
  ('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 zero-dispense 1', (500, '0.92', 5, 250), 'ERR:below-min-note'),
  ('regression zero-dispense 2', (100, '0.7893', 10, 199), 'ERR:below-min-note'),
  ('control: yen notes', (20000, '151.37', 1000, 500), [30000, 20319]),
  ('control: euro fives', (1000, '0.92', 5, 0), [5, 544]),
  ('control: exact multiple', (10870, '0.92', 10, 300), [100, 11170]),
  ('control: big notes', (100000, '1352.5', 10000, 0), [1350000, 99816])]]
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 fixtureActualExpectedOutcome
regression zero-dispense 1ERR:below-min-noteERR:below-min-notePassed
regression zero-dispense 2ERR:below-min-noteERR:below-min-notePassed
control: yen notes[30000, 20319][30000, 20319]Passed
control: euro fives[5, 544][5, 544]Passed
control: exact multiple[100, 11170][100, 11170]Passed
control: big notes[1350000, 99816][1350000, 99816]Passed

SHA-256 / fdcef0c505d46870faccbd92f06c2a7519845feeb8fc2f5cab977984664cbd2e

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.322514+00:00.

Case digest / 7aa99a85efdbafec2f181929154ba43edfadbfc1c5d760c2db09fb22eb360075