{"abstract":"Converting into a currency with no published rate returns the USD amount relabelled.","category":"Currency rounding and FX conversion","checks":7,"contract":"solve(amount, frm, to, rates): rates maps a currency to units of that currency per 1 USD (decimal strings); USD is implicitly 1 when absent. Convert exactly as amount / rate[frm] * rate[to] with no intermediate rounding, then round half-even to the target exponent (USD/EUR/GBP/CHF/SEK/NOK 2, JPY/KRW 0, KWD 3, CLF 4) and return a plain string. A missing rate returns 'ERR:no-rate:<code>', a zero or negative rate 'ERR:bad-rate:<code>' (source checked first).","evaluation_group":"w2-currency_rounding_and_fx_conversion-usd-pivot-cross","failed_approach":"Rejecting only a missing target rate still converts from an unpriced source at parity.","family":"w2-currency_rounding_and_fx_conversion-usd-pivot-cross-missing-rate","id":"FA-61881","implementations":{"attempt":{"sha256":"23a39b3629ec4172f97e8be582087166fc05fc65bbe5629f405df223dd8a099d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom decimal import Decimal, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_FLOOR, ROUND_CEILING, ROUND_DOWN, ROUND_UP, ROUND_HALF_DOWN\nN = 1\nobservations = []\ndef solve(amount, frm, to, rates):\n    exps = {'USD': 2, 'EUR': 2, 'GBP': 2, 'CHF': 2, 'SEK': 2, 'NOK': 2, 'JPY': 0, 'KRW': 0, 'KWD': 3, 'CLF': 4}\n    def rate(c):\n        if c == 'USD' and c not in rates: return Decimal(1)\n        if c not in rates: return None if c == to else Decimal(1)\n        return Decimal(rates[c])\n    rf, rt = rate(frm), rate(to)\n    for c, r in ((frm, rf), (to, rt)):\n        if r is None: return 'ERR:no-rate:' + c\n        if r <= 0: return 'ERR:bad-rate:' + c\n    usd = Decimal(amount) / rf\n    out = usd * rt\n    return format(out.quantize(Decimal(1).scaleb(-exps[to]), rounding=ROUND_HALF_EVEN), 'f')\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression missing-rate 1',\n   ('10', 'SEK', 'EUR',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK'),\n  ('regression missing-rate 2',\n   ('10', 'EUR', 'SEK',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK'),\n  ('partial repair guard 2',\n   ('7', 'NOK', 'USD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:NOK'),\n  ('control: euro to yen',\n   ('100', 'EUR', 'JPY',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '16453'),\n  ('control: usd to dinar',\n   ('100.00', 'USD', 'KWD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '30.710'),\n  ('control: pound to usd',\n   ('5', 'GBP', 'USD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '6.33'),\n  ('control: missing target',\n   ('1', 'EUR', 'SEK',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK')],\n [('regression missing-rate 1',\n   ('7', 'NOK', 'USD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:NOK'),\n  ('regression missing-rate 2',\n   ('1', 'EUR', 'SEK',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK'),\n  ('partial repair guard 1',\n   ('60486', 'JPY', 'GBP', {'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801', 'USD': '1'}),\n   'ERR:no-rate:JPY'),\n  ('partial repair guard 2',\n   ('86178.804', 'EUR', 'JPY',\n    {'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:EUR'),\n  ('control: won to franc',\n   ('250000', 'KRW', 'CHF',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '162.68'),\n  ('control: yen to unit of account',\n   ('99999', 'JPY', 'CLF',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '16.1920'),\n  ('control: zero rate target', ('10', 'EUR', 'CHF', {'EUR': '0.92', 'CHF': '0'}), 'ERR:bad-rate:CHF'),\n  ('control: explicit usd rate', ('10', 'USD', 'EUR', {'USD': '1', 'EUR': '0.92'}), '9.20')],\n [('regression missing-rate 1',\n   ('133282.75', 'EUR', 'GBP',\n    {'EUR': '0.92', 'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:GBP'),\n  ('regression missing-rate 2',\n   ('60486', 'JPY', 'GBP', {'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801', 'USD': '1'}),\n   'ERR:no-rate:JPY'),\n  ('partial repair guard 1',\n   ('63563', 'EUR', 'JPY',\n    {'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801',\n     'USD': '1'}),\n   'ERR:no-rate:EUR'),\n  ('partial repair guard 2',\n   ('74606.31', 'JPY', 'KWD', {'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:JPY'),\n  ('control: zero rate target', ('10', 'EUR', 'CHF', {'EUR': '0.92', 'CHF': '0'}), 'ERR:bad-rate:CHF'),\n  ('control: explicit usd rate', ('10', 'USD', 'EUR', {'USD': '1', 'EUR': '0.92'}), '9.20'),\n  ('control: usd absent', ('42.42', 'EUR', 'USD', {'EUR': '0.92'}), '46.11'),\n  ('control: euro to yen',\n   ('100', 'EUR', 'JPY',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '16453')],\n [('regression missing-rate 1',\n   ('86178.804', 'EUR', 'JPY',\n    {'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:EUR'),\n  ('regression missing-rate 2',\n   ('63563', 'EUR', 'JPY',\n    {'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801',\n     'USD': '1'}),\n   'ERR:no-rate:EUR'),\n  ('partial repair guard 1',\n   ('37459.62', 'JPY', 'CHF',\n    {'EUR': '0.92', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:JPY'),\n  ('partial repair guard 2',\n   ('193634', 'EUR', 'JPY',\n    {'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:EUR'),\n  ('control: euro to yen',\n   ('100', 'EUR', 'JPY',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '16453'),\n  ('control: usd to dinar',\n   ('100.00', 'USD', 'KWD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '30.710'),\n  ('control: pound to usd',\n   ('5', 'GBP', 'USD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '6.33'),\n  ('control: missing target',\n   ('1', 'EUR', 'SEK',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK')],\n [('regression missing-rate 1',\n   ('70022.25', 'GBP', 'EUR',\n    {'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801',\n     'USD': '1'}),\n   'ERR:no-rate:EUR'),\n  ('regression missing-rate 2',\n   ('74606.31', 'JPY', 'KWD', {'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:JPY'),\n  ('partial repair guard 1',\n   ('96568.41', 'JPY', 'KRW',\n    {'EUR': '0.92', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:JPY'),\n  ('partial repair guard 2',\n   ('127530', 'CHF', 'JPY', {'EUR': '0.92', 'KRW': '1352.5', 'GBP': '0.7893', 'CLF': '0.02451'}), 'ERR:no-rate:CHF'),\n  ('control: missing target',\n   ('1', 'EUR', 'SEK',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK'),\n  ('control: won to franc',\n   ('250000', 'KRW', 'CHF',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '162.68'),\n  ('control: yen to unit of account',\n   ('99999', 'JPY', 'CLF',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '16.1920'),\n  ('control: zero rate target', ('10', 'EUR', 'CHF', {'EUR': '0.92', 'CHF': '0'}), 'ERR:bad-rate:CHF')]]\nfor label, args, expected in cases[N - 1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"3426e9b25f739d6a6a86cabba60a250c085892921abec790a358fbd40b1c6e5a","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom decimal import Decimal, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_FLOOR, ROUND_CEILING, ROUND_DOWN, ROUND_UP, ROUND_HALF_DOWN\nN = 1\nobservations = []\ndef solve(amount, frm, to, rates):\n    exps = {'USD': 2, 'EUR': 2, 'GBP': 2, 'CHF': 2, 'SEK': 2, 'NOK': 2, 'JPY': 0, 'KRW': 0, 'KWD': 3, 'CLF': 4}\n    def rate(c):\n        if c == 'USD' and c not in rates: return Decimal(1)\n        if c not in rates: return Decimal(1)\n        return Decimal(rates[c])\n    rf, rt = rate(frm), rate(to)\n    for c, r in ((frm, rf), (to, rt)):\n        if r is None: return 'ERR:no-rate:' + c\n        if r <= 0: return 'ERR:bad-rate:' + c\n    usd = Decimal(amount) / rf\n    out = usd * rt\n    return format(out.quantize(Decimal(1).scaleb(-exps[to]), rounding=ROUND_HALF_EVEN), 'f')\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression missing-rate 1',\n   ('10', 'SEK', 'EUR',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK'),\n  ('regression missing-rate 2',\n   ('10', 'EUR', 'SEK',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK'),\n  ('partial repair guard 2',\n   ('7', 'NOK', 'USD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:NOK'),\n  ('control: euro to yen',\n   ('100', 'EUR', 'JPY',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '16453'),\n  ('control: usd to dinar',\n   ('100.00', 'USD', 'KWD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '30.710'),\n  ('control: pound to usd',\n   ('5', 'GBP', 'USD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '6.33'),\n  ('control: missing target',\n   ('1', 'EUR', 'SEK',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK')],\n [('regression missing-rate 1',\n   ('7', 'NOK', 'USD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:NOK'),\n  ('regression missing-rate 2',\n   ('1', 'EUR', 'SEK',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK'),\n  ('partial repair guard 1',\n   ('60486', 'JPY', 'GBP', {'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801', 'USD': '1'}),\n   'ERR:no-rate:JPY'),\n  ('partial repair guard 2',\n   ('86178.804', 'EUR', 'JPY',\n    {'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:EUR'),\n  ('control: won to franc',\n   ('250000', 'KRW', 'CHF',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '162.68'),\n  ('control: yen to unit of account',\n   ('99999', 'JPY', 'CLF',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '16.1920'),\n  ('control: zero rate target', ('10', 'EUR', 'CHF', {'EUR': '0.92', 'CHF': '0'}), 'ERR:bad-rate:CHF'),\n  ('control: explicit usd rate', ('10', 'USD', 'EUR', {'USD': '1', 'EUR': '0.92'}), '9.20')],\n [('regression missing-rate 1',\n   ('133282.75', 'EUR', 'GBP',\n    {'EUR': '0.92', 'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:GBP'),\n  ('regression missing-rate 2',\n   ('60486', 'JPY', 'GBP', {'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801', 'USD': '1'}),\n   'ERR:no-rate:JPY'),\n  ('partial repair guard 1',\n   ('63563', 'EUR', 'JPY',\n    {'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801',\n     'USD': '1'}),\n   'ERR:no-rate:EUR'),\n  ('partial repair guard 2',\n   ('74606.31', 'JPY', 'KWD', {'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:JPY'),\n  ('control: zero rate target', ('10', 'EUR', 'CHF', {'EUR': '0.92', 'CHF': '0'}), 'ERR:bad-rate:CHF'),\n  ('control: explicit usd rate', ('10', 'USD', 'EUR', {'USD': '1', 'EUR': '0.92'}), '9.20'),\n  ('control: usd absent', ('42.42', 'EUR', 'USD', {'EUR': '0.92'}), '46.11'),\n  ('control: euro to yen',\n   ('100', 'EUR', 'JPY',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '16453')],\n [('regression missing-rate 1',\n   ('86178.804', 'EUR', 'JPY',\n    {'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:EUR'),\n  ('regression missing-rate 2',\n   ('63563', 'EUR', 'JPY',\n    {'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801',\n     'USD': '1'}),\n   'ERR:no-rate:EUR'),\n  ('partial repair guard 1',\n   ('37459.62', 'JPY', 'CHF',\n    {'EUR': '0.92', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:JPY'),\n  ('partial repair guard 2',\n   ('193634', 'EUR', 'JPY',\n    {'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:EUR'),\n  ('control: euro to yen',\n   ('100', 'EUR', 'JPY',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '16453'),\n  ('control: usd to dinar',\n   ('100.00', 'USD', 'KWD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '30.710'),\n  ('control: pound to usd',\n   ('5', 'GBP', 'USD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '6.33'),\n  ('control: missing target',\n   ('1', 'EUR', 'SEK',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK')],\n [('regression missing-rate 1',\n   ('70022.25', 'GBP', 'EUR',\n    {'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801',\n     'USD': '1'}),\n   'ERR:no-rate:EUR'),\n  ('regression missing-rate 2',\n   ('74606.31', 'JPY', 'KWD', {'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:JPY'),\n  ('partial repair guard 1',\n   ('96568.41', 'JPY', 'KRW',\n    {'EUR': '0.92', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:JPY'),\n  ('partial repair guard 2',\n   ('127530', 'CHF', 'JPY', {'EUR': '0.92', 'KRW': '1352.5', 'GBP': '0.7893', 'CLF': '0.02451'}), 'ERR:no-rate:CHF'),\n  ('control: missing target',\n   ('1', 'EUR', 'SEK',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK'),\n  ('control: won to franc',\n   ('250000', 'KRW', 'CHF',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '162.68'),\n  ('control: yen to unit of account',\n   ('99999', 'JPY', 'CLF',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '16.1920'),\n  ('control: zero rate target', ('10', 'EUR', 'CHF', {'EUR': '0.92', 'CHF': '0'}), 'ERR:bad-rate:CHF')]]\nfor label, args, expected in cases[N - 1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"79c8cbf20dff496c35b5df5ff14729a4f87ca6e20c315100929b4b66a4755850","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nfrom decimal import Decimal, ROUND_HALF_EVEN, ROUND_HALF_UP, ROUND_FLOOR, ROUND_CEILING, ROUND_DOWN, ROUND_UP, ROUND_HALF_DOWN\nN = 1\nobservations = []\ndef solve(amount, frm, to, rates):\n    exps = {'USD': 2, 'EUR': 2, 'GBP': 2, 'CHF': 2, 'SEK': 2, 'NOK': 2, 'JPY': 0, 'KRW': 0, 'KWD': 3, 'CLF': 4}\n    def rate(c):\n        if c == 'USD' and c not in rates: return Decimal(1)\n        if c not in rates: return None\n        return Decimal(rates[c])\n    rf, rt = rate(frm), rate(to)\n    for c, r in ((frm, rf), (to, rt)):\n        if r is None: return 'ERR:no-rate:' + c\n        if r <= 0: return 'ERR:bad-rate:' + c\n    usd = Decimal(amount) / rf\n    out = usd * rt\n    return format(out.quantize(Decimal(1).scaleb(-exps[to]), rounding=ROUND_HALF_EVEN), 'f')\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression missing-rate 1',\n   ('10', 'SEK', 'EUR',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK'),\n  ('regression missing-rate 2',\n   ('10', 'EUR', 'SEK',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK'),\n  ('partial repair guard 2',\n   ('7', 'NOK', 'USD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:NOK'),\n  ('control: euro to yen',\n   ('100', 'EUR', 'JPY',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '16453'),\n  ('control: usd to dinar',\n   ('100.00', 'USD', 'KWD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '30.710'),\n  ('control: pound to usd',\n   ('5', 'GBP', 'USD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '6.33'),\n  ('control: missing target',\n   ('1', 'EUR', 'SEK',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK')],\n [('regression missing-rate 1',\n   ('7', 'NOK', 'USD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:NOK'),\n  ('regression missing-rate 2',\n   ('1', 'EUR', 'SEK',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK'),\n  ('partial repair guard 1',\n   ('60486', 'JPY', 'GBP', {'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801', 'USD': '1'}),\n   'ERR:no-rate:JPY'),\n  ('partial repair guard 2',\n   ('86178.804', 'EUR', 'JPY',\n    {'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:EUR'),\n  ('control: won to franc',\n   ('250000', 'KRW', 'CHF',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '162.68'),\n  ('control: yen to unit of account',\n   ('99999', 'JPY', 'CLF',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '16.1920'),\n  ('control: zero rate target', ('10', 'EUR', 'CHF', {'EUR': '0.92', 'CHF': '0'}), 'ERR:bad-rate:CHF'),\n  ('control: explicit usd rate', ('10', 'USD', 'EUR', {'USD': '1', 'EUR': '0.92'}), '9.20')],\n [('regression missing-rate 1',\n   ('133282.75', 'EUR', 'GBP',\n    {'EUR': '0.92', 'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:GBP'),\n  ('regression missing-rate 2',\n   ('60486', 'JPY', 'GBP', {'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801', 'USD': '1'}),\n   'ERR:no-rate:JPY'),\n  ('partial repair guard 1',\n   ('63563', 'EUR', 'JPY',\n    {'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801',\n     'USD': '1'}),\n   'ERR:no-rate:EUR'),\n  ('partial repair guard 2',\n   ('74606.31', 'JPY', 'KWD', {'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:JPY'),\n  ('control: zero rate target', ('10', 'EUR', 'CHF', {'EUR': '0.92', 'CHF': '0'}), 'ERR:bad-rate:CHF'),\n  ('control: explicit usd rate', ('10', 'USD', 'EUR', {'USD': '1', 'EUR': '0.92'}), '9.20'),\n  ('control: usd absent', ('42.42', 'EUR', 'USD', {'EUR': '0.92'}), '46.11'),\n  ('control: euro to yen',\n   ('100', 'EUR', 'JPY',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '16453')],\n [('regression missing-rate 1',\n   ('86178.804', 'EUR', 'JPY',\n    {'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:EUR'),\n  ('regression missing-rate 2',\n   ('63563', 'EUR', 'JPY',\n    {'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801',\n     'USD': '1'}),\n   'ERR:no-rate:EUR'),\n  ('partial repair guard 1',\n   ('37459.62', 'JPY', 'CHF',\n    {'EUR': '0.92', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:JPY'),\n  ('partial repair guard 2',\n   ('193634', 'EUR', 'JPY',\n    {'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:EUR'),\n  ('control: euro to yen',\n   ('100', 'EUR', 'JPY',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '16453'),\n  ('control: usd to dinar',\n   ('100.00', 'USD', 'KWD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '30.710'),\n  ('control: pound to usd',\n   ('5', 'GBP', 'USD',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '6.33'),\n  ('control: missing target',\n   ('1', 'EUR', 'SEK',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK')],\n [('regression missing-rate 1',\n   ('70022.25', 'GBP', 'EUR',\n    {'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801',\n     'USD': '1'}),\n   'ERR:no-rate:EUR'),\n  ('regression missing-rate 2',\n   ('74606.31', 'JPY', 'KWD', {'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:JPY'),\n  ('partial repair guard 1',\n   ('96568.41', 'JPY', 'KRW',\n    {'EUR': '0.92', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   'ERR:no-rate:JPY'),\n  ('partial repair guard 2',\n   ('127530', 'CHF', 'JPY', {'EUR': '0.92', 'KRW': '1352.5', 'GBP': '0.7893', 'CLF': '0.02451'}), 'ERR:no-rate:CHF'),\n  ('control: missing target',\n   ('1', 'EUR', 'SEK',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   'ERR:no-rate:SEK'),\n  ('control: won to franc',\n   ('250000', 'KRW', 'CHF',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '162.68'),\n  ('control: yen to unit of account',\n   ('99999', 'JPY', 'CLF',\n    {'EUR': '0.92',\n     'JPY': '151.37',\n     'KRW': '1352.5',\n     'KWD': '0.3071',\n     'GBP': '0.7893',\n     'CLF': '0.02451',\n     'CHF': '0.8801'}),\n   '16.1920'),\n  ('control: zero rate target', ('10', 'EUR', 'CHF', {'EUR': '0.92', 'CHF': '0'}), 'ERR:bad-rate:CHF')]]\nfor label, args, expected in cases[N - 1]:\n    check(label, solve(*args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-currency_rounding_and_fx_conversion-usd-pivot-cross-missing-rate","generated_at":"2026-09-29T14:46:59.371798+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Currency amounts must be rounded at the right stage and in the right unit, or ledgers, quotes and settlements drift by minor units.","repair":"Only USD may default to 1; every other absent currency is reported as ERR:no-rate.","root_cause":"rate() returns Decimal(1) for any absent currency instead of None.","sha256":"db9022c6abe73dd13119a3a69e79362f04814c77cb15d81b46490e51e62742e0","title":"A missing cross rate is silently treated as parity · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.653,"exit_code":1,"observations":[{"actual":"9.20","check":"regression missing-rate 1","expected":"ERR:no-rate:SEK","passed":false},{"actual":"ERR:no-rate:SEK","check":"regression missing-rate 2","expected":"ERR:no-rate:SEK","passed":true},{"actual":"7.00","check":"partial repair guard 2","expected":"ERR:no-rate:NOK","passed":false},{"actual":"16453","check":"control: euro to yen","expected":"16453","passed":true},{"actual":"30.710","check":"control: usd to dinar","expected":"30.710","passed":true},{"actual":"6.33","check":"control: pound to usd","expected":"6.33","passed":true},{"actual":"ERR:no-rate:SEK","check":"control: missing target","expected":"ERR:no-rate:SEK","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression missing-rate 1\", \"actual\": \"9.20\", \"expected\": \"ERR:no-rate:SEK\", \"passed\": false}, {\"check\": \"regression missing-rate 2\", \"actual\": \"ERR:no-rate:SEK\", \"expected\": \"ERR:no-rate:SEK\", \"passed\": true}, {\"check\": \"partial repair guard 2\", \"actual\": \"7.00\", \"expected\": \"ERR:no-rate:NOK\", \"passed\": false}, {\"check\": \"control: euro to yen\", \"actual\": \"16453\", \"expected\": \"16453\", \"passed\": true}, {\"check\": \"control: usd to dinar\", \"actual\": \"30.710\", \"expected\": \"30.710\", \"passed\": true}, {\"check\": \"control: pound to usd\", \"actual\": \"6.33\", \"expected\": \"6.33\", \"passed\": true}, {\"check\": \"control: missing target\", \"actual\": \"ERR:no-rate:SEK\", \"expected\": \"ERR:no-rate:SEK\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":44.027,"exit_code":1,"observations":[{"actual":"9.20","check":"regression missing-rate 1","expected":"ERR:no-rate:SEK","passed":false},{"actual":"10.87","check":"regression missing-rate 2","expected":"ERR:no-rate:SEK","passed":false},{"actual":"7.00","check":"partial repair guard 2","expected":"ERR:no-rate:NOK","passed":false},{"actual":"16453","check":"control: euro to yen","expected":"16453","passed":true},{"actual":"30.710","check":"control: usd to dinar","expected":"30.710","passed":true},{"actual":"6.33","check":"control: pound to usd","expected":"6.33","passed":true},{"actual":"1.09","check":"control: missing target","expected":"ERR:no-rate:SEK","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression missing-rate 1\", \"actual\": \"9.20\", \"expected\": \"ERR:no-rate:SEK\", \"passed\": false}, {\"check\": \"regression missing-rate 2\", \"actual\": \"10.87\", \"expected\": \"ERR:no-rate:SEK\", \"passed\": false}, {\"check\": \"partial repair guard 2\", \"actual\": \"7.00\", \"expected\": \"ERR:no-rate:NOK\", \"passed\": false}, {\"check\": \"control: euro to yen\", \"actual\": \"16453\", \"expected\": \"16453\", \"passed\": true}, {\"check\": \"control: usd to dinar\", \"actual\": \"30.710\", \"expected\": \"30.710\", \"passed\": true}, {\"check\": \"control: pound to usd\", \"actual\": \"6.33\", \"expected\": \"6.33\", \"passed\": true}, {\"check\": \"control: missing target\", \"actual\": \"1.09\", \"expected\": \"ERR:no-rate:SEK\", \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.95,"exit_code":0,"observations":[{"actual":"ERR:no-rate:SEK","check":"regression missing-rate 1","expected":"ERR:no-rate:SEK","passed":true},{"actual":"ERR:no-rate:SEK","check":"regression missing-rate 2","expected":"ERR:no-rate:SEK","passed":true},{"actual":"ERR:no-rate:NOK","check":"partial repair guard 2","expected":"ERR:no-rate:NOK","passed":true},{"actual":"16453","check":"control: euro to yen","expected":"16453","passed":true},{"actual":"30.710","check":"control: usd to dinar","expected":"30.710","passed":true},{"actual":"6.33","check":"control: pound to usd","expected":"6.33","passed":true},{"actual":"ERR:no-rate:SEK","check":"control: missing target","expected":"ERR:no-rate:SEK","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression missing-rate 1\", \"actual\": \"ERR:no-rate:SEK\", \"expected\": \"ERR:no-rate:SEK\", \"passed\": true}, {\"check\": \"regression missing-rate 2\", \"actual\": \"ERR:no-rate:SEK\", \"expected\": \"ERR:no-rate:SEK\", \"passed\": true}, {\"check\": \"partial repair guard 2\", \"actual\": \"ERR:no-rate:NOK\", \"expected\": \"ERR:no-rate:NOK\", \"passed\": true}, {\"check\": \"control: euro to yen\", \"actual\": \"16453\", \"expected\": \"16453\", \"passed\": true}, {\"check\": \"control: usd to dinar\", \"actual\": \"30.710\", \"expected\": \"30.710\", \"passed\": true}, {\"check\": \"control: pound to usd\", \"actual\": \"6.33\", \"expected\": \"6.33\", \"passed\": true}, {\"check\": \"control: missing target\", \"actual\": \"ERR:no-rate:SEK\", \"expected\": \"ERR:no-rate:SEK\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}