FA-62231 / Currency rounding and FX conversion / Open access
Only upward rate moves are checked against the tolerance · case 01
A collapsed rate far below the reference is accepted.
ROOT CAUSE
The deviation is signed (n - r)/r, so every drop passes.
VERIFIED REPAIR
Use the absolute deviation.
Unsuccessful approach: Checking only (r - n)/r catches drops but now accepts every rise.
Case contract
solve(new, ref, tol_bps, inverted): accept a newly published rate if |n - ref| / ref * 10000 <= tol_bps using exact decimals, where n = new, or 1/new when the new quote arrives inverted. A non-positive new or ref returns 'ERR:rate'. Return 'accept' or 'reject'.
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(new, ref, tol_bps, inverted):
n, r = Decimal(new), Decimal(ref)
if r <= 0 or n <= 0: return 'ERR:rate'
if inverted: n = 1 / n
dev = (n - r) / r
return 'accept' if dev * 10000 <= tol_bps else 'reject'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression two-sided-band 1', ('0.8', '1.0', 1000, False), 'reject'),
('regression two-sided-band 2', ('0.91604868', '1.0968', 25, True), 'reject'),
('partial repair guard 1', ('1.2', '1.0', 1000, False), 'reject'),
('partial repair guard 2', ('0.9', '1.0', 50, True), 'reject'),
('control: upper boundary', ('1.1', '1.0', 1000, False), 'accept'),
('control: lower boundary', ('0.9', '1.0', 1000, False), 'accept'),
('control: inverted exact', ('0.5', '2.0', 0, True), 'accept'),
('control: bad ref', ('1.2', '0', 5, False), 'ERR:rate')],
[('regression two-sided-band 1', ('0.74336731', '1.4947', 1000, True), 'reject'),
('regression two-sided-band 2', ('0.87740214', '1.3928', 1000, True), 'reject'),
('partial repair guard 1', ('0.59568663', '0.5929', 25, False), 'reject'),
('partial repair guard 2', ('0.95162298', '0.8547', 1000, False), 'reject'),
('control: inverted exact', ('0.5', '2.0', 0, True), 'accept'),
('control: bad ref', ('1.2', '0', 5, False), 'ERR:rate'),
('control: small move', ('1.08351', '1.0835', 1, False), 'accept'),
('control: rise too far', ('1.2', '1.0', 1000, False), 'reject')],
[('regression two-sided-band 1', ('0.85059956', '0.8572', 50, False), 'reject'),
('regression two-sided-band 2', ('1.03353628', '1.0354', 10, False), 'reject'),
('partial repair guard 1', ('0.57265770', '0.5718', 10, False), 'reject'),
('partial repair guard 2', ('0.96278577', '1.0229', 100, True), 'reject'),
('control: rise too far', ('1.2', '1.0', 1000, False), 'reject'),
('control: inverted far', ('0.9', '1.0', 50, True), 'reject'),
('control: upper boundary', ('1.1', '1.0', 1000, False), 'accept'),
('control: lower boundary', ('0.9', '1.0', 1000, False), 'accept')],
[('regression two-sided-band 1', ('1.6275668', '1.6574', 100, False), 'reject'),
('regression two-sided-band 2', ('1.60129822', '1.6066', 25, False), 'reject'),
('partial repair guard 1', ('0.96185726', '0.9529', 50, False), 'reject'),
('partial repair guard 2', ('1.35897716', '1.3564', 10, False), 'reject'),
('control: lower boundary', ('0.9', '1.0', 1000, False), 'accept'),
('control: drop too far', ('0.8', '1.0', 1000, False), 'reject'),
('control: inverted exact', ('0.5', '2.0', 0, True), 'accept'),
('control: bad ref', ('1.2', '0', 5, False), 'ERR:rate')],
[('regression two-sided-band 1', ('1.66306861', '1.6649', 10, False), 'reject'),
('regression two-sided-band 2', ('0.55485514', '0.5558', 10, False), 'reject'),
('partial repair guard 1', ('1.41436370', '0.6093', 1000, True), 'reject'),
('partial repair guard 2', ('0.61344857', '1.6285', 10, True), 'reject'),
('control: bad ref', ('1.2', '0', 5, False), 'ERR:rate'),
('control: small move', ('1.08351', '1.0835', 1, False), 'accept'),
('control: rise too far', ('1.2', '1.0', 1000, False), 'reject'),
('control: inverted far', ('0.9', '1.0', 50, True), 'reject')]]
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 two-sided-band 1 | accept | reject | Failed |
| regression two-sided-band 2 | accept | reject | Failed |
| partial repair guard 1 | reject | reject | Passed |
| partial repair guard 2 | reject | reject | Passed |
| control: upper boundary | accept | accept | Passed |
| control: lower boundary | accept | accept | Passed |
| control: inverted exact | accept | accept | Passed |
| control: bad ref | ERR:rate | ERR:rate | Passed |
SHA-256 / af27464419061f9b8f70f016e1f458a36557b9d895d4d16f7451b99c15b15ee2
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(new, ref, tol_bps, inverted):
n, r = Decimal(new), Decimal(ref)
if r <= 0 or n <= 0: return 'ERR:rate'
if inverted: n = 1 / n
dev = (r - n) / r
return 'accept' if dev * 10000 <= tol_bps else 'reject'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression two-sided-band 1', ('0.8', '1.0', 1000, False), 'reject'),
('regression two-sided-band 2', ('0.91604868', '1.0968', 25, True), 'reject'),
('partial repair guard 1', ('1.2', '1.0', 1000, False), 'reject'),
('partial repair guard 2', ('0.9', '1.0', 50, True), 'reject'),
('control: upper boundary', ('1.1', '1.0', 1000, False), 'accept'),
('control: lower boundary', ('0.9', '1.0', 1000, False), 'accept'),
('control: inverted exact', ('0.5', '2.0', 0, True), 'accept'),
('control: bad ref', ('1.2', '0', 5, False), 'ERR:rate')],
[('regression two-sided-band 1', ('0.74336731', '1.4947', 1000, True), 'reject'),
('regression two-sided-band 2', ('0.87740214', '1.3928', 1000, True), 'reject'),
('partial repair guard 1', ('0.59568663', '0.5929', 25, False), 'reject'),
('partial repair guard 2', ('0.95162298', '0.8547', 1000, False), 'reject'),
('control: inverted exact', ('0.5', '2.0', 0, True), 'accept'),
('control: bad ref', ('1.2', '0', 5, False), 'ERR:rate'),
('control: small move', ('1.08351', '1.0835', 1, False), 'accept'),
('control: rise too far', ('1.2', '1.0', 1000, False), 'reject')],
[('regression two-sided-band 1', ('0.85059956', '0.8572', 50, False), 'reject'),
('regression two-sided-band 2', ('1.03353628', '1.0354', 10, False), 'reject'),
('partial repair guard 1', ('0.57265770', '0.5718', 10, False), 'reject'),
('partial repair guard 2', ('0.96278577', '1.0229', 100, True), 'reject'),
('control: rise too far', ('1.2', '1.0', 1000, False), 'reject'),
('control: inverted far', ('0.9', '1.0', 50, True), 'reject'),
('control: upper boundary', ('1.1', '1.0', 1000, False), 'accept'),
('control: lower boundary', ('0.9', '1.0', 1000, False), 'accept')],
[('regression two-sided-band 1', ('1.6275668', '1.6574', 100, False), 'reject'),
('regression two-sided-band 2', ('1.60129822', '1.6066', 25, False), 'reject'),
('partial repair guard 1', ('0.96185726', '0.9529', 50, False), 'reject'),
('partial repair guard 2', ('1.35897716', '1.3564', 10, False), 'reject'),
('control: lower boundary', ('0.9', '1.0', 1000, False), 'accept'),
('control: drop too far', ('0.8', '1.0', 1000, False), 'reject'),
('control: inverted exact', ('0.5', '2.0', 0, True), 'accept'),
('control: bad ref', ('1.2', '0', 5, False), 'ERR:rate')],
[('regression two-sided-band 1', ('1.66306861', '1.6649', 10, False), 'reject'),
('regression two-sided-band 2', ('0.55485514', '0.5558', 10, False), 'reject'),
('partial repair guard 1', ('1.41436370', '0.6093', 1000, True), 'reject'),
('partial repair guard 2', ('0.61344857', '1.6285', 10, True), 'reject'),
('control: bad ref', ('1.2', '0', 5, False), 'ERR:rate'),
('control: small move', ('1.08351', '1.0835', 1, False), 'accept'),
('control: rise too far', ('1.2', '1.0', 1000, False), 'reject'),
('control: inverted far', ('0.9', '1.0', 50, True), 'reject')]]
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 two-sided-band 1 | reject | reject | Passed |
| regression two-sided-band 2 | reject | reject | Passed |
| partial repair guard 1 | accept | reject | Failed |
| partial repair guard 2 | accept | reject | Failed |
| control: upper boundary | accept | accept | Passed |
| control: lower boundary | accept | accept | Passed |
| control: inverted exact | accept | accept | Passed |
| control: bad ref | ERR:rate | ERR:rate | Passed |
SHA-256 / c336a4395978a60f9d6b3e1f37403850914b7a962af437446d63a74476d36a4d
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(new, ref, tol_bps, inverted):
n, r = Decimal(new), Decimal(ref)
if r <= 0 or n <= 0: return 'ERR:rate'
if inverted: n = 1 / n
dev = abs(n - r) / r
return 'accept' if dev * 10000 <= tol_bps else 'reject'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression two-sided-band 1', ('0.8', '1.0', 1000, False), 'reject'),
('regression two-sided-band 2', ('0.91604868', '1.0968', 25, True), 'reject'),
('partial repair guard 1', ('1.2', '1.0', 1000, False), 'reject'),
('partial repair guard 2', ('0.9', '1.0', 50, True), 'reject'),
('control: upper boundary', ('1.1', '1.0', 1000, False), 'accept'),
('control: lower boundary', ('0.9', '1.0', 1000, False), 'accept'),
('control: inverted exact', ('0.5', '2.0', 0, True), 'accept'),
('control: bad ref', ('1.2', '0', 5, False), 'ERR:rate')],
[('regression two-sided-band 1', ('0.74336731', '1.4947', 1000, True), 'reject'),
('regression two-sided-band 2', ('0.87740214', '1.3928', 1000, True), 'reject'),
('partial repair guard 1', ('0.59568663', '0.5929', 25, False), 'reject'),
('partial repair guard 2', ('0.95162298', '0.8547', 1000, False), 'reject'),
('control: inverted exact', ('0.5', '2.0', 0, True), 'accept'),
('control: bad ref', ('1.2', '0', 5, False), 'ERR:rate'),
('control: small move', ('1.08351', '1.0835', 1, False), 'accept'),
('control: rise too far', ('1.2', '1.0', 1000, False), 'reject')],
[('regression two-sided-band 1', ('0.85059956', '0.8572', 50, False), 'reject'),
('regression two-sided-band 2', ('1.03353628', '1.0354', 10, False), 'reject'),
('partial repair guard 1', ('0.57265770', '0.5718', 10, False), 'reject'),
('partial repair guard 2', ('0.96278577', '1.0229', 100, True), 'reject'),
('control: rise too far', ('1.2', '1.0', 1000, False), 'reject'),
('control: inverted far', ('0.9', '1.0', 50, True), 'reject'),
('control: upper boundary', ('1.1', '1.0', 1000, False), 'accept'),
('control: lower boundary', ('0.9', '1.0', 1000, False), 'accept')],
[('regression two-sided-band 1', ('1.6275668', '1.6574', 100, False), 'reject'),
('regression two-sided-band 2', ('1.60129822', '1.6066', 25, False), 'reject'),
('partial repair guard 1', ('0.96185726', '0.9529', 50, False), 'reject'),
('partial repair guard 2', ('1.35897716', '1.3564', 10, False), 'reject'),
('control: lower boundary', ('0.9', '1.0', 1000, False), 'accept'),
('control: drop too far', ('0.8', '1.0', 1000, False), 'reject'),
('control: inverted exact', ('0.5', '2.0', 0, True), 'accept'),
('control: bad ref', ('1.2', '0', 5, False), 'ERR:rate')],
[('regression two-sided-band 1', ('1.66306861', '1.6649', 10, False), 'reject'),
('regression two-sided-band 2', ('0.55485514', '0.5558', 10, False), 'reject'),
('partial repair guard 1', ('1.41436370', '0.6093', 1000, True), 'reject'),
('partial repair guard 2', ('0.61344857', '1.6285', 10, True), 'reject'),
('control: bad ref', ('1.2', '0', 5, False), 'ERR:rate'),
('control: small move', ('1.08351', '1.0835', 1, False), 'accept'),
('control: rise too far', ('1.2', '1.0', 1000, False), 'reject'),
('control: inverted far', ('0.9', '1.0', 50, True), 'reject')]]
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 two-sided-band 1 | reject | reject | Passed |
| regression two-sided-band 2 | reject | reject | Passed |
| partial repair guard 1 | reject | reject | Passed |
| partial repair guard 2 | reject | reject | Passed |
| control: upper boundary | accept | accept | Passed |
| control: lower boundary | accept | accept | Passed |
| control: inverted exact | accept | accept | Passed |
| control: bad ref | ERR:rate | ERR:rate | Passed |
SHA-256 / 31cb9a96168543d15b2b70ba1000a59b9d8b1f89f208e56cc7d339bcdd9d6b3c
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:02.686325+00:00.
Case digest / 4dcc596f6f4d2d04c26e0bde6ba55d79a6591649cc91f826e583e454c7eebf6e