{"abstract":"Won or yen targets drift by one unit because an intermediate cent rounding is scaled by a large rate.","category":"Currency rounding and FX conversion","checks":8,"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).","contract_signature":"amount, frm, to, rates","evaluation_group":"w2-currency_rounding_and_fx_conversion-usd-pivot-cross","failed_approach":"Rounding the pivot to four decimals shrinks the error but still flips results near a target half-unit.","family":"w2-currency_rounding_and_fx_conversion-usd-pivot-cross-pivot-leg-rounding","id":"FA-61871","implementations":{"attempt":{"sha256":"a32126045d03cc981127223a096f829844c49b70f01d9adc2028981af827c832","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.quantize(Decimal('0.0001'), rounding=ROUND_HALF_EVEN) * 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 pivot-leg-rounding 1',\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 pivot-leg-rounding 2',\n   ('16420.708', 'CLF', 'CLF', {'EUR': '0.92', 'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '16420.7080'),\n  ('partial repair guard 1',\n   ('109305.18', 'GBP', 'CLF', {'EUR': '0.92', 'KRW': '1352.5', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '3394.2354'),\n  ('partial repair guard 2',\n   ('61971.445', 'CHF', '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     'USD': '1'}),\n   '61971.44'),\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  ('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 [('regression pivot-leg-rounding 1',\n   ('113222', 'EUR', 'CLF',\n    {'EUR': '0.92', 'JPY': '151.37', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '3016.3818'),\n  ('regression pivot-leg-rounding 2',\n   ('132236.08', 'CLF', 'KRW', {'EUR': '0.92', 'JPY': '151.37', 'KRW': '1352.5', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '7296992991'),\n  ('partial repair guard 1',\n   ('124444.50', 'JPY', 'JPY',\n    {'EUR': '0.92', 'JPY': '151.37', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'USD': '1'}),\n   '124444'),\n  ('partial repair guard 2',\n   ('109305.18', 'GBP', 'CLF', {'EUR': '0.92', 'KRW': '1352.5', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '3394.2354'),\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')],\n [('regression pivot-leg-rounding 1',\n   ('24340', 'KRW', '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   '5.527'),\n  ('regression pivot-leg-rounding 2',\n   ('23223.04', 'CLF', 'KWD',\n    {'EUR': '0.92', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '290974.932'),\n  ('partial repair guard 1',\n   ('61971.445', 'CHF', '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     'USD': '1'}),\n   '61971.44'),\n  ('partial repair guard 2',\n   ('124444.50', 'JPY', 'JPY',\n    {'EUR': '0.92', 'JPY': '151.37', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'USD': '1'}),\n   '124444'),\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 pivot-leg-rounding 1',\n   ('41394.40', 'KWD', '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     'USD': '1'}),\n   '3303.7341'),\n  ('regression pivot-leg-rounding 2',\n   ('62580.312', 'CHF', 'KRW',\n    {'EUR': '0.92', 'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CHF': '0.8801'}),\n   '96170744'),\n  ('partial repair guard 1',\n   ('109305.18', 'GBP', 'CLF', {'EUR': '0.92', 'KRW': '1352.5', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '3394.2354'),\n  ('partial repair guard 2',\n   ('61971.445', 'CHF', '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     'USD': '1'}),\n   '61971.44'),\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 pivot-leg-rounding 1',\n   ('86444.328', 'KWD', 'KRW',\n    {'EUR': '0.92', 'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451'}),\n   '380709715'),\n  ('regression pivot-leg-rounding 2',\n   ('74016', 'JPY', 'EUR',\n    {'EUR': '0.92', 'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'USD': '1'}),\n   '449.86'),\n  ('partial repair guard 1',\n   ('124444.50', 'JPY', 'JPY',\n    {'EUR': '0.92', 'JPY': '151.37', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'USD': '1'}),\n   '124444'),\n  ('partial repair guard 2',\n   ('109305.18', 'GBP', 'CLF', {'EUR': '0.92', 'KRW': '1352.5', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '3394.2354'),\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":"b08120fc3e367193d79358d72308375285de628fadf253c8de3e62f2ef117761","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.quantize(Decimal('0.01'), rounding=ROUND_HALF_EVEN) * 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 pivot-leg-rounding 1',\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 pivot-leg-rounding 2',\n   ('16420.708', 'CLF', 'CLF', {'EUR': '0.92', 'KRW': '1352.5', 'KWD': '0.3071', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '16420.7080'),\n  ('partial repair guard 1',\n   ('109305.18', 'GBP', 'CLF', {'EUR': '0.92', 'KRW': '1352.5', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '3394.2354'),\n  ('partial repair guard 2',\n   ('61971.445', 'CHF', '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     'USD': '1'}),\n   '61971.44'),\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  ('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 [('regression pivot-leg-rounding 1',\n   ('113222', 'EUR', 'CLF',\n    {'EUR': '0.92', 'JPY': '151.37', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '3016.3818'),\n  ('regression pivot-leg-rounding 2',\n   ('132236.08', 'CLF', 'KRW', {'EUR': '0.92', 'JPY': '151.37', 'KRW': '1352.5', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '7296992991'),\n  ('partial repair guard 1',\n   ('124444.50', 'JPY', 'JPY',\n    {'EUR': '0.92', 'JPY': '151.37', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'USD': '1'}),\n   '124444'),\n  ('partial repair guard 2',\n   ('109305.18', 'GBP', 'CLF', {'EUR': '0.92', 'KRW': '1352.5', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '3394.2354'),\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')],\n [('regression pivot-leg-rounding 1',\n   ('24340', 'KRW', '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   '5.527'),\n  ('regression pivot-leg-rounding 2',\n   ('23223.04', 'CLF', 'KWD',\n    {'EUR': '0.92', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '290974.932'),\n  ('partial repair guard 1',\n   ('61971.445', 'CHF', '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     'USD': '1'}),\n   '61971.44'),\n  ('partial repair guard 2',\n   ('124444.50', 'JPY', 'JPY',\n    {'EUR': '0.92', 'JPY': '151.37', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'USD': '1'}),\n   '124444'),\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 pivot-leg-rounding 1',\n   ('41394.40', 'KWD', '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     'USD': '1'}),\n   '3303.7341'),\n  ('regression pivot-leg-rounding 2',\n   ('62580.312', 'CHF', 'KRW',\n    {'EUR': '0.92', 'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CHF': '0.8801'}),\n   '96170744'),\n  ('partial repair guard 1',\n   ('109305.18', 'GBP', 'CLF', {'EUR': '0.92', 'KRW': '1352.5', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '3394.2354'),\n  ('partial repair guard 2',\n   ('61971.445', 'CHF', '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     'USD': '1'}),\n   '61971.44'),\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 pivot-leg-rounding 1',\n   ('86444.328', 'KWD', 'KRW',\n    {'EUR': '0.92', 'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451'}),\n   '380709715'),\n  ('regression pivot-leg-rounding 2',\n   ('74016', 'JPY', 'EUR',\n    {'EUR': '0.92', 'JPY': '151.37', 'KRW': '1352.5', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'USD': '1'}),\n   '449.86'),\n  ('partial repair guard 1',\n   ('124444.50', 'JPY', 'JPY',\n    {'EUR': '0.92', 'JPY': '151.37', 'KWD': '0.3071', 'GBP': '0.7893', 'CLF': '0.02451', 'USD': '1'}),\n   '124444'),\n  ('partial repair guard 2',\n   ('109305.18', 'GBP', 'CLF', {'EUR': '0.92', 'KRW': '1352.5', 'GBP': '0.7893', 'CLF': '0.02451', 'CHF': '0.8801'}),\n   '3394.2354'),\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-pivot-leg-rounding","generated_at":"2026-09-29T14:46:59.350891+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.","root_cause":"The intermediate USD value is quantized to 0.01 before multiplication by the target rate.","sha256":"cce7f60816311080dd8bcced517a847edd678e0be108ed468d1fbefac18a5c3f","title":"The USD pivot amount is rounded to cents before the second leg · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":42.45,"exit_code":1,"observations":[{"actual":"16453","check":"regression pivot-leg-rounding 1","expected":"16453","passed":true},{"actual":"16420.7080","check":"regression pivot-leg-rounding 2","expected":"16420.7080","passed":true},{"actual":"3394.2353","check":"partial repair guard 1","expected":"3394.2354","passed":false},{"actual":"61971.45","check":"partial repair guard 2","expected":"61971.44","passed":false},{"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},{"actual":"162.68","check":"control: won to franc","expected":"162.68","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression pivot-leg-rounding 1\", \"actual\": \"16453\", \"expected\": \"16453\", \"passed\": true}, {\"check\": \"regression pivot-leg-rounding 2\", \"actual\": \"16420.7080\", \"expected\": \"16420.7080\", \"passed\": true}, {\"check\": \"partial repair guard 1\", \"actual\": \"3394.2353\", \"expected\": \"3394.2354\", \"passed\": false}, {\"check\": \"partial repair guard 2\", \"actual\": \"61971.45\", \"expected\": \"61971.44\", \"passed\": false}, {\"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}, {\"check\": \"control: won to franc\", \"actual\": \"162.68\", \"expected\": \"162.68\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.041,"exit_code":1,"observations":[{"actual":"16454","check":"regression pivot-leg-rounding 1","expected":"16453","passed":false},{"actual":"16420.7081","check":"regression pivot-leg-rounding 2","expected":"16420.7080","passed":false},{"actual":"3394.2352","check":"partial repair guard 1","expected":"3394.2354","passed":false},{"actual":"61971.44","check":"partial repair guard 2","expected":"61971.44","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},{"actual":"162.68","check":"control: won to franc","expected":"162.68","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression pivot-leg-rounding 1\", \"actual\": \"16454\", \"expected\": \"16453\", \"passed\": false}, {\"check\": \"regression pivot-leg-rounding 2\", \"actual\": \"16420.7081\", \"expected\": \"16420.7080\", \"passed\": false}, {\"check\": \"partial repair guard 1\", \"actual\": \"3394.2352\", \"expected\": \"3394.2354\", \"passed\": false}, {\"check\": \"partial repair guard 2\", \"actual\": \"61971.44\", \"expected\": \"61971.44\", \"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}, {\"check\": \"control: won to franc\", \"actual\": \"162.68\", \"expected\": \"162.68\", \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}