{"abstract":"Yen amounts gain two fraction digits and dinar amounts lose their third minor digit.","category":"Currency rounding and FX conversion","checks":7,"contract":"solve(amount, ccy): amount is an exact decimal string, ccy an ISO-like code that is trimmed and upper-cased. Minor-unit exponents: USD 2, EUR 2, JPY 0, KRW 0, KWD 3, BHD 3, CLF 4. Round the exact decimal half-even at the currency exponent and return a plain string with exactly that many fraction digits; a zero result is unsigned. Unknown codes return 'ERR:unknown-currency'.","contract_signature":"amount, ccy","evaluation_group":"w2-currency_rounding_and_fx_conversion-minor-unit-quantize","failed_approach":"Capping the exponent at two fixes zero-decimal currencies but still truncates three- and four-decimal currencies.","family":"w2-currency_rounding_and_fx_conversion-minor-unit-quantize-quantum-per-currency","id":"FA-61841","implementations":{"attempt":{"sha256":"ad76bff2ccaa41690a7504c957e4b1289e63c028c138998cf00ddc3510fc3c15","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, ccy):\n    exps = {'USD': 2, 'EUR': 2, 'JPY': 0, 'KRW': 0, 'KWD': 3, 'BHD': 3, 'CLF': 4}\n    code = ccy.strip().upper()\n    if code not in exps: return 'ERR:unknown-currency'\n    e = exps[code]\n    x = Decimal(amount)\n    q = x.quantize(Decimal(1).scaleb(-min(e, 2)), rounding=ROUND_HALF_EVEN)\n    if q == 0: q = abs(q)\n    return format(q, 'f')\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression quantum-per-currency 1', ('1235.5', 'JPY'), '1236'),\n  ('regression quantum-per-currency 2', ('10.0005', 'KWD'), '10.000'),\n  ('partial repair guard 2', ('1.23456', 'CLF'), '1.2346'), ('control: cents tie to even', ('2.665', 'USD'), '2.66'),\n  ('control: lowercase code', ('12.345', ' eur '), '12.34'), ('control: negative small', ('-0.004', 'USD'), '0.00'),\n  ('control: integer input', ('7', 'BHD'), '7.000')],\n [('regression quantum-per-currency 1', ('1.23456', 'CLF'), '1.2346'),\n  ('regression quantum-per-currency 2', ('7', 'BHD'), '7.000'),\n  ('partial repair guard 2', ('37643.905', 'CLF'), '37643.9050'),\n  ('control: lowercase code', ('12.345', ' eur '), '12.34'), ('control: negative small', ('-0.004', 'USD'), '0.00'),\n  ('control: unknown code', ('1.00', 'ABC'), 'ERR:unknown-currency'),\n  ('control: large amount', ('123456789.125', 'USD'), '123456789.12')],\n [('regression quantum-per-currency 1', ('-2.5', 'KRW'), '-2'),\n  ('regression quantum-per-currency 2', ('39257.444', 'KRW'), '39257'),\n  ('partial repair guard 1', ('45179.821', 'CLF'), '45179.8210'),\n  ('partial repair guard 2', ('10645.65286', 'Kwd '), '10645.653'), ('control: integer input', ('7', 'BHD'), '7.000'),\n  ('control: unknown code', ('1.00', 'ABC'), 'ERR:unknown-currency'),\n  ('control: large amount', ('123456789.125', 'USD'), '123456789.12'),\n  ('control: cents tie to even', ('2.665', 'USD'), '2.66')],\n [('regression quantum-per-currency 1', ('47295.38', ' jpy'), '47295'),\n  ('regression quantum-per-currency 2', ('37643.905', 'CLF'), '37643.9050'),\n  ('partial repair guard 1', ('-2451.34', 'KWD'), '-2451.340'),\n  ('partial repair guard 2', ('19100.06047', 'BHD'), '19100.060'), ('control: negative tie', ('-2.5', 'KRW'), '-2'),\n  ('control: cents tie to even', ('2.665', 'USD'), '2.66'), ('control: yen tie', ('1235.5', 'JPY'), '1236'),\n  ('control: dinar three places', ('10.0005', 'KWD'), '10.000')],\n [('regression quantum-per-currency 1', ('45179.821', 'CLF'), '45179.8210'),\n  ('regression quantum-per-currency 2', ('4677.317', 'JPY'), '4677'),\n  ('partial repair guard 1', ('16193.1040', 'Kwd '), '16193.104'),\n  ('partial repair guard 2', ('32233.55636', 'Kwd '), '32233.556'),\n  ('control: dinar three places', ('10.0005', 'KWD'), '10.000'),\n  ('control: unit of account four places', ('1.23456', 'CLF'), '1.2346'),\n  ('control: lowercase code', ('12.345', ' eur '), '12.34'), ('control: negative small', ('-0.004', 'USD'), '0.00')]]\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":"250319d14aa94b108d9e937a17010831386f74dd8d640526b28a021b6363e6c1","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, ccy):\n    exps = {'USD': 2, 'EUR': 2, 'JPY': 0, 'KRW': 0, 'KWD': 3, 'BHD': 3, 'CLF': 4}\n    code = ccy.strip().upper()\n    if code not in exps: return 'ERR:unknown-currency'\n    e = exps[code]\n    x = Decimal(amount)\n    q = x.quantize(Decimal('0.01'), rounding=ROUND_HALF_EVEN)\n    if q == 0: q = abs(q)\n    return format(q, 'f')\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression quantum-per-currency 1', ('1235.5', 'JPY'), '1236'),\n  ('regression quantum-per-currency 2', ('10.0005', 'KWD'), '10.000'),\n  ('partial repair guard 2', ('1.23456', 'CLF'), '1.2346'), ('control: cents tie to even', ('2.665', 'USD'), '2.66'),\n  ('control: lowercase code', ('12.345', ' eur '), '12.34'), ('control: negative small', ('-0.004', 'USD'), '0.00'),\n  ('control: integer input', ('7', 'BHD'), '7.000')],\n [('regression quantum-per-currency 1', ('1.23456', 'CLF'), '1.2346'),\n  ('regression quantum-per-currency 2', ('7', 'BHD'), '7.000'),\n  ('partial repair guard 2', ('37643.905', 'CLF'), '37643.9050'),\n  ('control: lowercase code', ('12.345', ' eur '), '12.34'), ('control: negative small', ('-0.004', 'USD'), '0.00'),\n  ('control: unknown code', ('1.00', 'ABC'), 'ERR:unknown-currency'),\n  ('control: large amount', ('123456789.125', 'USD'), '123456789.12')],\n [('regression quantum-per-currency 1', ('-2.5', 'KRW'), '-2'),\n  ('regression quantum-per-currency 2', ('39257.444', 'KRW'), '39257'),\n  ('partial repair guard 1', ('45179.821', 'CLF'), '45179.8210'),\n  ('partial repair guard 2', ('10645.65286', 'Kwd '), '10645.653'), ('control: integer input', ('7', 'BHD'), '7.000'),\n  ('control: unknown code', ('1.00', 'ABC'), 'ERR:unknown-currency'),\n  ('control: large amount', ('123456789.125', 'USD'), '123456789.12'),\n  ('control: cents tie to even', ('2.665', 'USD'), '2.66')],\n [('regression quantum-per-currency 1', ('47295.38', ' jpy'), '47295'),\n  ('regression quantum-per-currency 2', ('37643.905', 'CLF'), '37643.9050'),\n  ('partial repair guard 1', ('-2451.34', 'KWD'), '-2451.340'),\n  ('partial repair guard 2', ('19100.06047', 'BHD'), '19100.060'), ('control: negative tie', ('-2.5', 'KRW'), '-2'),\n  ('control: cents tie to even', ('2.665', 'USD'), '2.66'), ('control: yen tie', ('1235.5', 'JPY'), '1236'),\n  ('control: dinar three places', ('10.0005', 'KWD'), '10.000')],\n [('regression quantum-per-currency 1', ('45179.821', 'CLF'), '45179.8210'),\n  ('regression quantum-per-currency 2', ('4677.317', 'JPY'), '4677'),\n  ('partial repair guard 1', ('16193.1040', 'Kwd '), '16193.104'),\n  ('partial repair guard 2', ('32233.55636', 'Kwd '), '32233.556'),\n  ('control: dinar three places', ('10.0005', 'KWD'), '10.000'),\n  ('control: unit of account four places', ('1.23456', 'CLF'), '1.2346'),\n  ('control: lowercase code', ('12.345', ' eur '), '12.34'), ('control: negative small', ('-0.004', 'USD'), '0.00')]]\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-minor-unit-quantize-quantum-per-currency","generated_at":"2026-09-29T14:46:59.043817+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 rounding quantum is the literal Decimal('0.01') instead of 10**-exponent for the resolved currency.","sha256":"b93fc3d48bd1ab075e4945205521db8a835befb8e5f21f99d8a9d25cb2add3c1","title":"Every currency is rounded to a hard-coded cent quantum · 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":39.821,"exit_code":1,"observations":[{"actual":"1236","check":"regression quantum-per-currency 1","expected":"1236","passed":true},{"actual":"10.00","check":"regression quantum-per-currency 2","expected":"10.000","passed":false},{"actual":"1.23","check":"partial repair guard 2","expected":"1.2346","passed":false},{"actual":"2.66","check":"control: cents tie to even","expected":"2.66","passed":true},{"actual":"12.34","check":"control: lowercase code","expected":"12.34","passed":true},{"actual":"0.00","check":"control: negative small","expected":"0.00","passed":true},{"actual":"7.00","check":"control: integer input","expected":"7.000","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression quantum-per-currency 1\", \"actual\": \"1236\", \"expected\": \"1236\", \"passed\": true}, {\"check\": \"regression quantum-per-currency 2\", \"actual\": \"10.00\", \"expected\": \"10.000\", \"passed\": false}, {\"check\": \"partial repair guard 2\", \"actual\": \"1.23\", \"expected\": \"1.2346\", \"passed\": false}, {\"check\": \"control: cents tie to even\", \"actual\": \"2.66\", \"expected\": \"2.66\", \"passed\": true}, {\"check\": \"control: lowercase code\", \"actual\": \"12.34\", \"expected\": \"12.34\", \"passed\": true}, {\"check\": \"control: negative small\", \"actual\": \"0.00\", \"expected\": \"0.00\", \"passed\": true}, {\"check\": \"control: integer input\", \"actual\": \"7.00\", \"expected\": \"7.000\", \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.623,"exit_code":1,"observations":[{"actual":"1235.50","check":"regression quantum-per-currency 1","expected":"1236","passed":false},{"actual":"10.00","check":"regression quantum-per-currency 2","expected":"10.000","passed":false},{"actual":"1.23","check":"partial repair guard 2","expected":"1.2346","passed":false},{"actual":"2.66","check":"control: cents tie to even","expected":"2.66","passed":true},{"actual":"12.34","check":"control: lowercase code","expected":"12.34","passed":true},{"actual":"0.00","check":"control: negative small","expected":"0.00","passed":true},{"actual":"7.00","check":"control: integer input","expected":"7.000","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression quantum-per-currency 1\", \"actual\": \"1235.50\", \"expected\": \"1236\", \"passed\": false}, {\"check\": \"regression quantum-per-currency 2\", \"actual\": \"10.00\", \"expected\": \"10.000\", \"passed\": false}, {\"check\": \"partial repair guard 2\", \"actual\": \"1.23\", \"expected\": \"1.2346\", \"passed\": false}, {\"check\": \"control: cents tie to even\", \"actual\": \"2.66\", \"expected\": \"2.66\", \"passed\": true}, {\"check\": \"control: lowercase code\", \"actual\": \"12.34\", \"expected\": \"12.34\", \"passed\": true}, {\"check\": \"control: negative small\", \"actual\": \"0.00\", \"expected\": \"0.00\", \"passed\": true}, {\"check\": \"control: integer input\", \"actual\": \"7.00\", \"expected\": \"7.000\", \"passed\": false}], \"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."}}