{"abstract":"115 cents at 1.1 becomes 127 instead of the half-even 126.","category":"Currency rounding and FX conversion","checks":6,"contract":"solve(amount_minor, from_exp, to_exp, rate): amount_minor is an integer count of source minor units, rate a decimal string giving target major units per source major unit. The target minor amount is amount_minor * rate * 10**(to_exp - from_exp), computed exactly and rounded half-even to an integer.","contract_signature":"amount_minor, from_exp, to_exp, rate","evaluation_group":"w2-currency_rounding_and_fx_conversion-minor-unit-integer-conversion","failed_approach":"Formatting the float product with repr before Decimal still carries the binary error.","family":"w2-currency_rounding_and_fx_conversion-minor-unit-integer-conversion-binary-product","id":"FA-61996","implementations":{"attempt":{"sha256":"687f43d4537bab093930666fb74526df83d0e2ee80c75cb135f8aa3d0a784b93","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_minor, from_exp, to_exp, rate):\n    scale = Decimal(10) ** (to_exp - from_exp)\n    v = Decimal(repr(amount_minor * float(rate))) * scale\n    return int(v.quantize(Decimal(1), rounding=ROUND_HALF_EVEN))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression binary-product 1', (115, 2, 2, '1.1'), 126),\n  ('regression binary-product 2', (238181, 0, 2, '147.6350'), 3516385194),\n  ('control: cents to yen', (1000, 2, 0, '151.37'), 1514), ('control: negative exact', (-250, 2, 2, '0.5'), -125),\n  ('control: yen to dinar', (1, 0, 3, '0.3071'), 307), ('control: negative tie', (-3, 2, 2, '0.5'), -2)],\n [('regression binary-product 1', (115, 2, 2, '1.1'), 126),\n  ('regression binary-product 2', (238181, 0, 2, '147.6350'), 3516385194),\n  ('control: yen to dinar', (1, 0, 3, '0.3071'), 307), ('control: negative tie', (-3, 2, 2, '0.5'), -2),\n  ('control: zero', (0, 2, 0, '151.37'), 0), ('control: precise rate', (123456, 2, 2, '1.08347'), 133761)],\n [('regression binary-product 1', (115, 2, 2, '1.1'), 126),\n  ('regression binary-product 2', (238181, 0, 2, '147.6350'), 3516385194),\n  ('control: precise rate', (123456, 2, 2, '1.08347'), 133761),\n  ('control: large', (987654321, 2, 3, '0.30712'), 3033283951), ('control: cents to yen', (1000, 2, 0, '151.37'), 1514),\n  ('control: negative exact', (-250, 2, 2, '0.5'), -125)],\n [('regression binary-product 1', (115, 2, 2, '1.1'), 126),\n  ('regression binary-product 2', (238181, 0, 2, '147.6350'), 3516385194),\n  ('control: negative exact', (-250, 2, 2, '0.5'), -125), ('control: yen to dinar', (1, 0, 3, '0.3071'), 307),\n  ('control: negative tie', (-3, 2, 2, '0.5'), -2), ('control: zero', (0, 2, 0, '151.37'), 0)],\n [('regression binary-product 1', (115, 2, 2, '1.1'), 126),\n  ('regression binary-product 2', (238181, 0, 2, '147.6350'), 3516385194),\n  ('control: negative tie', (-3, 2, 2, '0.5'), -2), ('control: zero', (0, 2, 0, '151.37'), 0),\n  ('control: precise rate', (123456, 2, 2, '1.08347'), 133761),\n  ('control: large', (987654321, 2, 3, '0.30712'), 3033283951)]]\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":"67b14ae9abc1b52660424b04fc92588347bb7c11e53ba0507bd6fd0691671724","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_minor, from_exp, to_exp, rate):\n    scale = Decimal(10) ** (to_exp - from_exp)\n    v = Decimal(amount_minor * float(rate)) * scale\n    return int(v.quantize(Decimal(1), rounding=ROUND_HALF_EVEN))\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression binary-product 1', (115, 2, 2, '1.1'), 126),\n  ('regression binary-product 2', (238181, 0, 2, '147.6350'), 3516385194),\n  ('control: cents to yen', (1000, 2, 0, '151.37'), 1514), ('control: negative exact', (-250, 2, 2, '0.5'), -125),\n  ('control: yen to dinar', (1, 0, 3, '0.3071'), 307), ('control: negative tie', (-3, 2, 2, '0.5'), -2)],\n [('regression binary-product 1', (115, 2, 2, '1.1'), 126),\n  ('regression binary-product 2', (238181, 0, 2, '147.6350'), 3516385194),\n  ('control: yen to dinar', (1, 0, 3, '0.3071'), 307), ('control: negative tie', (-3, 2, 2, '0.5'), -2),\n  ('control: zero', (0, 2, 0, '151.37'), 0), ('control: precise rate', (123456, 2, 2, '1.08347'), 133761)],\n [('regression binary-product 1', (115, 2, 2, '1.1'), 126),\n  ('regression binary-product 2', (238181, 0, 2, '147.6350'), 3516385194),\n  ('control: precise rate', (123456, 2, 2, '1.08347'), 133761),\n  ('control: large', (987654321, 2, 3, '0.30712'), 3033283951), ('control: cents to yen', (1000, 2, 0, '151.37'), 1514),\n  ('control: negative exact', (-250, 2, 2, '0.5'), -125)],\n [('regression binary-product 1', (115, 2, 2, '1.1'), 126),\n  ('regression binary-product 2', (238181, 0, 2, '147.6350'), 3516385194),\n  ('control: negative exact', (-250, 2, 2, '0.5'), -125), ('control: yen to dinar', (1, 0, 3, '0.3071'), 307),\n  ('control: negative tie', (-3, 2, 2, '0.5'), -2), ('control: zero', (0, 2, 0, '151.37'), 0)],\n [('regression binary-product 1', (115, 2, 2, '1.1'), 126),\n  ('regression binary-product 2', (238181, 0, 2, '147.6350'), 3516385194),\n  ('control: negative tie', (-3, 2, 2, '0.5'), -2), ('control: zero', (0, 2, 0, '151.37'), 0),\n  ('control: precise rate', (123456, 2, 2, '1.08347'), 133761),\n  ('control: large', (987654321, 2, 3, '0.30712'), 3033283951)]]\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-integer-conversion-binary-product","generated_at":"2026-09-29T14:47:00.486753+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":"amount_minor * float(rate) introduces binary error that decides ties.","sha256":"8bf123c2bdf9cca9c1b8fe7356902652f1402e14a04e554fe09883d1d755bfd0","title":"The amount-rate product is formed in binary floating point · 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":41.401,"exit_code":1,"observations":[{"actual":127,"check":"regression binary-product 1","expected":126,"passed":false},{"actual":3516385193,"check":"regression binary-product 2","expected":3516385194,"passed":false},{"actual":1514,"check":"control: cents to yen","expected":1514,"passed":true},{"actual":-125,"check":"control: negative exact","expected":-125,"passed":true},{"actual":307,"check":"control: yen to dinar","expected":307,"passed":true},{"actual":-2,"check":"control: negative tie","expected":-2,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression binary-product 1\", \"actual\": 127, \"expected\": 126, \"passed\": false}, {\"check\": \"regression binary-product 2\", \"actual\": 3516385193, \"expected\": 3516385194, \"passed\": false}, {\"check\": \"control: cents to yen\", \"actual\": 1514, \"expected\": 1514, \"passed\": true}, {\"check\": \"control: negative exact\", \"actual\": -125, \"expected\": -125, \"passed\": true}, {\"check\": \"control: yen to dinar\", \"actual\": 307, \"expected\": 307, \"passed\": true}, {\"check\": \"control: negative tie\", \"actual\": -2, \"expected\": -2, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.39,"exit_code":1,"observations":[{"actual":127,"check":"regression binary-product 1","expected":126,"passed":false},{"actual":3516385193,"check":"regression binary-product 2","expected":3516385194,"passed":false},{"actual":1514,"check":"control: cents to yen","expected":1514,"passed":true},{"actual":-125,"check":"control: negative exact","expected":-125,"passed":true},{"actual":307,"check":"control: yen to dinar","expected":307,"passed":true},{"actual":-2,"check":"control: negative tie","expected":-2,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression binary-product 1\", \"actual\": 127, \"expected\": 126, \"passed\": false}, {\"check\": \"regression binary-product 2\", \"actual\": 3516385193, \"expected\": 3516385194, \"passed\": false}, {\"check\": \"control: cents to yen\", \"actual\": 1514, \"expected\": 1514, \"passed\": true}, {\"check\": \"control: negative exact\", \"actual\": -125, \"expected\": -125, \"passed\": true}, {\"check\": \"control: yen to dinar\", \"actual\": 307, \"expected\": 307, \"passed\": true}, {\"check\": \"control: negative tie\", \"actual\": -2, \"expected\": -2, \"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."}}