{"abstract":"'2.675' USD rounds to 2.67 because the binary value is slightly below the tie.","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":"Round-tripping through repr(float(...)) repairs short literals but still loses digits beyond double precision.","family":"w2-currency_rounding_and_fx_conversion-minor-unit-quantize-exact-decimal-input","id":"FA-61861","implementations":{"attempt":{"sha256":"1ab4a12800be7a91bb5ae92649cbf5780c38d402eceb08f01082ff5be30442b3","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(repr(float(amount)))\n    q = x.quantize(Decimal(1).scaleb(-e), 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 exact-decimal-input 1', ('2.675', 'USD'), '2.68'),\n  ('regression exact-decimal-input 2', ('0.12500000000000000001', 'USD'), '0.13'),\n  ('partial repair guard 2', ('1.0005000000000000000001', 'KWD'), '1.001'),\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  ('control: unit of account four places', ('1.23456', 'CLF'), '1.2346')],\n [('regression exact-decimal-input 1', ('1.0005000000000000000001', 'KWD'), '1.001'),\n  ('regression exact-decimal-input 2', ('2.665', 'USD'), '2.66'),\n  ('partial repair guard 1', ('0.12500000000000000001', 'USD'), '0.13'),\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'),\n  ('control: integer input', ('7', 'BHD'), '7.000')],\n [('regression exact-decimal-input 1', ('10.0005', 'KWD'), '10.000'),\n  ('regression exact-decimal-input 2', ('12.345', ' eur '), '12.34'),\n  ('partial repair guard 1', ('0.12500000000000000001', 'USD'), '0.13'),\n  ('partial repair guard 2', ('1.0005000000000000000001', 'KWD'), '1.001'),\n  ('control: integer input', ('7', 'BHD'), '7.000'), ('control: unknown code', ('1.00', 'ABC'), 'ERR:unknown-currency'),\n  ('control: large amount', ('123456789.125', 'USD'), '123456789.12'),\n  ('control: negative tie', ('-2.5', 'KRW'), '-2')],\n [('regression exact-decimal-input 1', ('48525.1705', 'Kwd '), '48525.170'),\n  ('regression exact-decimal-input 2', ('38174.12705', 'CLF'), '38174.1270'),\n  ('partial repair guard 1', ('0.12500000000000000001', 'USD'), '0.13'),\n  ('partial repair guard 2', ('1.0005000000000000000001', 'KWD'), '1.001'),\n  ('control: negative tie', ('-2.5', 'KRW'), '-2'), ('control: cents tie to even', ('2.665', 'USD'), '2.66'),\n  ('control: yen tie', ('1235.5', 'JPY'), '1236'), ('control: dinar three places', ('10.0005', 'KWD'), '10.000')],\n [('regression exact-decimal-input 1', ('41458.105', 'EUR'), '41458.10'),\n  ('regression exact-decimal-input 2', ('24714.6255', 'KWD'), '24714.626'),\n  ('partial repair guard 1', ('0.12500000000000000001', 'USD'), '0.13'),\n  ('partial repair guard 2', ('1.0005000000000000000001', 'KWD'), '1.001'),\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":"e7e556c51a24c199f8cb2247ff6b971c58f4e15c081eaf4ebcc4113b39f9aa44","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(float(amount))\n    q = x.quantize(Decimal(1).scaleb(-e), 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 exact-decimal-input 1', ('2.675', 'USD'), '2.68'),\n  ('regression exact-decimal-input 2', ('0.12500000000000000001', 'USD'), '0.13'),\n  ('partial repair guard 2', ('1.0005000000000000000001', 'KWD'), '1.001'),\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  ('control: unit of account four places', ('1.23456', 'CLF'), '1.2346')],\n [('regression exact-decimal-input 1', ('1.0005000000000000000001', 'KWD'), '1.001'),\n  ('regression exact-decimal-input 2', ('2.665', 'USD'), '2.66'),\n  ('partial repair guard 1', ('0.12500000000000000001', 'USD'), '0.13'),\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'),\n  ('control: integer input', ('7', 'BHD'), '7.000')],\n [('regression exact-decimal-input 1', ('10.0005', 'KWD'), '10.000'),\n  ('regression exact-decimal-input 2', ('12.345', ' eur '), '12.34'),\n  ('partial repair guard 1', ('0.12500000000000000001', 'USD'), '0.13'),\n  ('partial repair guard 2', ('1.0005000000000000000001', 'KWD'), '1.001'),\n  ('control: integer input', ('7', 'BHD'), '7.000'), ('control: unknown code', ('1.00', 'ABC'), 'ERR:unknown-currency'),\n  ('control: large amount', ('123456789.125', 'USD'), '123456789.12'),\n  ('control: negative tie', ('-2.5', 'KRW'), '-2')],\n [('regression exact-decimal-input 1', ('48525.1705', 'Kwd '), '48525.170'),\n  ('regression exact-decimal-input 2', ('38174.12705', 'CLF'), '38174.1270'),\n  ('partial repair guard 1', ('0.12500000000000000001', 'USD'), '0.13'),\n  ('partial repair guard 2', ('1.0005000000000000000001', 'KWD'), '1.001'),\n  ('control: negative tie', ('-2.5', 'KRW'), '-2'), ('control: cents tie to even', ('2.665', 'USD'), '2.66'),\n  ('control: yen tie', ('1235.5', 'JPY'), '1236'), ('control: dinar three places', ('10.0005', 'KWD'), '10.000')],\n [('regression exact-decimal-input 1', ('41458.105', 'EUR'), '41458.10'),\n  ('regression exact-decimal-input 2', ('24714.6255', 'KWD'), '24714.626'),\n  ('partial repair guard 1', ('0.12500000000000000001', 'USD'), '0.13'),\n  ('partial repair guard 2', ('1.0005000000000000000001', 'KWD'), '1.001'),\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-exact-decimal-input","generated_at":"2026-09-29T14:46:59.214743+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 string is converted with Decimal(float(amount)), importing the binary approximation error into the tie decision.","sha256":"d365d1ed74cea0265599a53ee7998a7b6d38c11d095fa500d23f69670681bfb3","title":"The amount passes through binary floating point before minor-unit rounding · 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":40.133,"exit_code":1,"observations":[{"actual":"2.68","check":"regression exact-decimal-input 1","expected":"2.68","passed":true},{"actual":"0.12","check":"regression exact-decimal-input 2","expected":"0.13","passed":false},{"actual":"1.000","check":"partial repair guard 2","expected":"1.001","passed":false},{"actual":"2.66","check":"control: cents tie to even","expected":"2.66","passed":true},{"actual":"1236","check":"control: yen tie","expected":"1236","passed":true},{"actual":"10.000","check":"control: dinar three places","expected":"10.000","passed":true},{"actual":"1.2346","check":"control: unit of account four places","expected":"1.2346","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression exact-decimal-input 1\", \"actual\": \"2.68\", \"expected\": \"2.68\", \"passed\": true}, {\"check\": \"regression exact-decimal-input 2\", \"actual\": \"0.12\", \"expected\": \"0.13\", \"passed\": false}, {\"check\": \"partial repair guard 2\", \"actual\": \"1.000\", \"expected\": \"1.001\", \"passed\": false}, {\"check\": \"control: cents tie to even\", \"actual\": \"2.66\", \"expected\": \"2.66\", \"passed\": true}, {\"check\": \"control: yen tie\", \"actual\": \"1236\", \"expected\": \"1236\", \"passed\": true}, {\"check\": \"control: dinar three places\", \"actual\": \"10.000\", \"expected\": \"10.000\", \"passed\": true}, {\"check\": \"control: unit of account four places\", \"actual\": \"1.2346\", \"expected\": \"1.2346\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.796,"exit_code":1,"observations":[{"actual":"2.67","check":"regression exact-decimal-input 1","expected":"2.68","passed":false},{"actual":"0.12","check":"regression exact-decimal-input 2","expected":"0.13","passed":false},{"actual":"1.000","check":"partial repair guard 2","expected":"1.001","passed":false},{"actual":"2.67","check":"control: cents tie to even","expected":"2.66","passed":false},{"actual":"1236","check":"control: yen tie","expected":"1236","passed":true},{"actual":"10.001","check":"control: dinar three places","expected":"10.000","passed":false},{"actual":"1.2346","check":"control: unit of account four places","expected":"1.2346","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression exact-decimal-input 1\", \"actual\": \"2.67\", \"expected\": \"2.68\", \"passed\": false}, {\"check\": \"regression exact-decimal-input 2\", \"actual\": \"0.12\", \"expected\": \"0.13\", \"passed\": false}, {\"check\": \"partial repair guard 2\", \"actual\": \"1.000\", \"expected\": \"1.001\", \"passed\": false}, {\"check\": \"control: cents tie to even\", \"actual\": \"2.67\", \"expected\": \"2.66\", \"passed\": false}, {\"check\": \"control: yen tie\", \"actual\": \"1236\", \"expected\": \"1236\", \"passed\": true}, {\"check\": \"control: dinar three places\", \"actual\": \"10.001\", \"expected\": \"10.000\", \"passed\": false}, {\"check\": \"control: unit of account four places\", \"actual\": \"1.2346\", \"expected\": \"1.2346\", \"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."}}