{"abstract":"A transfer entirely consumed by the fee is accepted and pays out 0.","category":"Currency rounding and FX conversion","checks":6,"contract":"solve(amount, rate, src_exp, dst_exp, fee_bps, min_fee): amount and min_fee are source minor units, fee_bps a non-negative integer. fee = max(min_fee, ceil(amount*fee_bps/10000)) in source minor units, deducted before conversion. A fee greater than or equal to the amount returns 'ERR:amount-below-fee'; a non-positive amount or negative bps returns 'ERR:input'. The net amount is converted exactly (net * rate * 10**(dst_exp - src_exp)) and rounded half-even. Return [fee, converted].","evaluation_group":"w2-currency_rounding_and_fx_conversion-conversion-fee-bps","failed_approach":"Capping the fee at the amount still accepts the transfer with a zero payout.","family":"w2-currency_rounding_and_fx_conversion-conversion-fee-bps-fee-exhausts-amount","id":"FA-62076","implementations":{"attempt":{"sha256":"b065c71b54e939794526cc90f2b8e5f389b70ed0cf6f2cd2895124f1c4ef4194","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, rate, src_exp, dst_exp, fee_bps, min_fee):\n    if fee_bps < 0 or amount <= 0: return 'ERR:input'\n    conv = lambda m: Decimal(m) * Decimal(rate) * Decimal(10) ** (dst_exp - src_exp)\n    rq = lambda d: int(d.quantize(Decimal(1), rounding=ROUND_HALF_EVEN))\n    pct = -(-amount * fee_bps // 10000)\n    fee = max(min_fee, pct)\n    if fee > amount: fee = amount\n    return [fee, rq(conv(amount - fee))]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression fee-exhausts-amount 1', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('control: yen payout', (10000, '151.37', 2, 0, 150, 50), [150, 14910]),\n  ('control: fee rounds up', (1001, '1', 2, 2, 100, 0), [11, 990]),\n  ('control: minimum fee applies', (20000, '0.3071', 2, 3, 25, 100), [100, 61113]),\n  ('control: zero bps', (777, '1.0833', 2, 2, 0, 0), [0, 842])],\n [('regression fee-exhausts-amount 1', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('control: minimum fee applies', (20000, '0.3071', 2, 3, 25, 100), [100, 61113]),\n  ('control: zero bps', (777, '1.0833', 2, 2, 0, 0), [0, 842]),\n  ('control: large percentage fee', (123456, '0.92', 2, 2, 250, 199), [3087, 110739]),\n  ('control: invalid amount', (0, '1.1', 2, 2, 10, 0), 'ERR:input')],\n [('regression fee-exhausts-amount 1', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('control: invalid amount', (0, '1.1', 2, 2, 10, 0), 'ERR:input'),\n  ('control: yen payout', (10000, '151.37', 2, 0, 150, 50), [150, 14910]),\n  ('control: fee rounds up', (1001, '1', 2, 2, 100, 0), [11, 990]),\n  ('control: minimum fee applies', (20000, '0.3071', 2, 3, 25, 100), [100, 61113])],\n [('regression fee-exhausts-amount 1', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('control: fee rounds up', (1001, '1', 2, 2, 100, 0), [11, 990]),\n  ('control: minimum fee applies', (20000, '0.3071', 2, 3, 25, 100), [100, 61113]),\n  ('control: zero bps', (777, '1.0833', 2, 2, 0, 0), [0, 842]),\n  ('control: large percentage fee', (123456, '0.92', 2, 2, 250, 199), [3087, 110739])],\n [('regression fee-exhausts-amount 1', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('control: zero bps', (777, '1.0833', 2, 2, 0, 0), [0, 842]),\n  ('control: large percentage fee', (123456, '0.92', 2, 2, 250, 199), [3087, 110739]),\n  ('control: invalid amount', (0, '1.1', 2, 2, 10, 0), 'ERR:input'),\n  ('control: yen payout', (10000, '151.37', 2, 0, 150, 50), [150, 14910])]]\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":"e8c8b914ebb993d08fd503709de7b3b25930667cf6f34dc388522b65f466e267","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, rate, src_exp, dst_exp, fee_bps, min_fee):\n    if fee_bps < 0 or amount <= 0: return 'ERR:input'\n    conv = lambda m: Decimal(m) * Decimal(rate) * Decimal(10) ** (dst_exp - src_exp)\n    rq = lambda d: int(d.quantize(Decimal(1), rounding=ROUND_HALF_EVEN))\n    pct = -(-amount * fee_bps // 10000)\n    fee = max(min_fee, pct)\n    if fee > amount: return 'ERR:amount-below-fee'\n    return [fee, rq(conv(amount - fee))]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression fee-exhausts-amount 1', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('control: yen payout', (10000, '151.37', 2, 0, 150, 50), [150, 14910]),\n  ('control: fee rounds up', (1001, '1', 2, 2, 100, 0), [11, 990]),\n  ('control: minimum fee applies', (20000, '0.3071', 2, 3, 25, 100), [100, 61113]),\n  ('control: zero bps', (777, '1.0833', 2, 2, 0, 0), [0, 842])],\n [('regression fee-exhausts-amount 1', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('control: minimum fee applies', (20000, '0.3071', 2, 3, 25, 100), [100, 61113]),\n  ('control: zero bps', (777, '1.0833', 2, 2, 0, 0), [0, 842]),\n  ('control: large percentage fee', (123456, '0.92', 2, 2, 250, 199), [3087, 110739]),\n  ('control: invalid amount', (0, '1.1', 2, 2, 10, 0), 'ERR:input')],\n [('regression fee-exhausts-amount 1', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('control: invalid amount', (0, '1.1', 2, 2, 10, 0), 'ERR:input'),\n  ('control: yen payout', (10000, '151.37', 2, 0, 150, 50), [150, 14910]),\n  ('control: fee rounds up', (1001, '1', 2, 2, 100, 0), [11, 990]),\n  ('control: minimum fee applies', (20000, '0.3071', 2, 3, 25, 100), [100, 61113])],\n [('regression fee-exhausts-amount 1', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('control: fee rounds up', (1001, '1', 2, 2, 100, 0), [11, 990]),\n  ('control: minimum fee applies', (20000, '0.3071', 2, 3, 25, 100), [100, 61113]),\n  ('control: zero bps', (777, '1.0833', 2, 2, 0, 0), [0, 842]),\n  ('control: large percentage fee', (123456, '0.92', 2, 2, 250, 199), [3087, 110739])],\n [('regression fee-exhausts-amount 1', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('control: zero bps', (777, '1.0833', 2, 2, 0, 0), [0, 842]),\n  ('control: large percentage fee', (123456, '0.92', 2, 2, 250, 199), [3087, 110739]),\n  ('control: invalid amount', (0, '1.1', 2, 2, 10, 0), 'ERR:input'),\n  ('control: yen payout', (10000, '151.37', 2, 0, 150, 50), [150, 14910])]]\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":"a3846581ac836a9d9bd235a738934395d84d67776ce1f3cba5c633746fa8a50a","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, rate, src_exp, dst_exp, fee_bps, min_fee):\n    if fee_bps < 0 or amount <= 0: return 'ERR:input'\n    conv = lambda m: Decimal(m) * Decimal(rate) * Decimal(10) ** (dst_exp - src_exp)\n    rq = lambda d: int(d.quantize(Decimal(1), rounding=ROUND_HALF_EVEN))\n    pct = -(-amount * fee_bps // 10000)\n    fee = max(min_fee, pct)\n    if fee >= amount: return 'ERR:amount-below-fee'\n    return [fee, rq(conv(amount - fee))]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression fee-exhausts-amount 1', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('control: yen payout', (10000, '151.37', 2, 0, 150, 50), [150, 14910]),\n  ('control: fee rounds up', (1001, '1', 2, 2, 100, 0), [11, 990]),\n  ('control: minimum fee applies', (20000, '0.3071', 2, 3, 25, 100), [100, 61113]),\n  ('control: zero bps', (777, '1.0833', 2, 2, 0, 0), [0, 842])],\n [('regression fee-exhausts-amount 1', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('control: minimum fee applies', (20000, '0.3071', 2, 3, 25, 100), [100, 61113]),\n  ('control: zero bps', (777, '1.0833', 2, 2, 0, 0), [0, 842]),\n  ('control: large percentage fee', (123456, '0.92', 2, 2, 250, 199), [3087, 110739]),\n  ('control: invalid amount', (0, '1.1', 2, 2, 10, 0), 'ERR:input')],\n [('regression fee-exhausts-amount 1', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('control: invalid amount', (0, '1.1', 2, 2, 10, 0), 'ERR:input'),\n  ('control: yen payout', (10000, '151.37', 2, 0, 150, 50), [150, 14910]),\n  ('control: fee rounds up', (1001, '1', 2, 2, 100, 0), [11, 990]),\n  ('control: minimum fee applies', (20000, '0.3071', 2, 3, 25, 100), [100, 61113])],\n [('regression fee-exhausts-amount 1', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('control: fee rounds up', (1001, '1', 2, 2, 100, 0), [11, 990]),\n  ('control: minimum fee applies', (20000, '0.3071', 2, 3, 25, 100), [100, 61113]),\n  ('control: zero bps', (777, '1.0833', 2, 2, 0, 0), [0, 842]),\n  ('control: large percentage fee', (123456, '0.92', 2, 2, 250, 199), [3087, 110739])],\n [('regression fee-exhausts-amount 1', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('control: zero bps', (777, '1.0833', 2, 2, 0, 0), [0, 842]),\n  ('control: large percentage fee', (123456, '0.92', 2, 2, 250, 199), [3087, 110739]),\n  ('control: invalid amount', (0, '1.1', 2, 2, 10, 0), 'ERR:input'),\n  ('control: yen payout', (10000, '151.37', 2, 0, 150, 50), [150, 14910])]]\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-conversion-fee-bps-fee-exhausts-amount","generated_at":"2026-09-29T14:47:01.338123+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":"Reject when the fee is greater than or equal to the amount.","root_cause":"The guard rejects only fee > amount.","sha256":"40845d0450b70793b10e15ada3caee0b2472737fbae4bceccd2fa6103a120cfa","title":"A fee equal to the transfer amount yields a zero payout · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.682,"exit_code":1,"observations":[{"actual":[500,0],"check":"regression fee-exhausts-amount 1","expected":"ERR:amount-below-fee","passed":false},{"actual":[99,0],"check":"partial repair guard 2","expected":"ERR:amount-below-fee","passed":false},{"actual":[150,14910],"check":"control: yen payout","expected":[150,14910],"passed":true},{"actual":[11,990],"check":"control: fee rounds up","expected":[11,990],"passed":true},{"actual":[100,61113],"check":"control: minimum fee applies","expected":[100,61113],"passed":true},{"actual":[0,842],"check":"control: zero bps","expected":[0,842],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression fee-exhausts-amount 1\", \"actual\": [500, 0], \"expected\": \"ERR:amount-below-fee\", \"passed\": false}, {\"check\": \"partial repair guard 2\", \"actual\": [99, 0], \"expected\": \"ERR:amount-below-fee\", \"passed\": false}, {\"check\": \"control: yen payout\", \"actual\": [150, 14910], \"expected\": [150, 14910], \"passed\": true}, {\"check\": \"control: fee rounds up\", \"actual\": [11, 990], \"expected\": [11, 990], \"passed\": true}, {\"check\": \"control: minimum fee applies\", \"actual\": [100, 61113], \"expected\": [100, 61113], \"passed\": true}, {\"check\": \"control: zero bps\", \"actual\": [0, 842], \"expected\": [0, 842], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.825,"exit_code":1,"observations":[{"actual":[500,0],"check":"regression fee-exhausts-amount 1","expected":"ERR:amount-below-fee","passed":false},{"actual":"ERR:amount-below-fee","check":"partial repair guard 2","expected":"ERR:amount-below-fee","passed":true},{"actual":[150,14910],"check":"control: yen payout","expected":[150,14910],"passed":true},{"actual":[11,990],"check":"control: fee rounds up","expected":[11,990],"passed":true},{"actual":[100,61113],"check":"control: minimum fee applies","expected":[100,61113],"passed":true},{"actual":[0,842],"check":"control: zero bps","expected":[0,842],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression fee-exhausts-amount 1\", \"actual\": [500, 0], \"expected\": \"ERR:amount-below-fee\", \"passed\": false}, {\"check\": \"partial repair guard 2\", \"actual\": \"ERR:amount-below-fee\", \"expected\": \"ERR:amount-below-fee\", \"passed\": true}, {\"check\": \"control: yen payout\", \"actual\": [150, 14910], \"expected\": [150, 14910], \"passed\": true}, {\"check\": \"control: fee rounds up\", \"actual\": [11, 990], \"expected\": [11, 990], \"passed\": true}, {\"check\": \"control: minimum fee applies\", \"actual\": [100, 61113], \"expected\": [100, 61113], \"passed\": true}, {\"check\": \"control: zero bps\", \"actual\": [0, 842], \"expected\": [0, 842], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.62,"exit_code":0,"observations":[{"actual":"ERR:amount-below-fee","check":"regression fee-exhausts-amount 1","expected":"ERR:amount-below-fee","passed":true},{"actual":"ERR:amount-below-fee","check":"partial repair guard 2","expected":"ERR:amount-below-fee","passed":true},{"actual":[150,14910],"check":"control: yen payout","expected":[150,14910],"passed":true},{"actual":[11,990],"check":"control: fee rounds up","expected":[11,990],"passed":true},{"actual":[100,61113],"check":"control: minimum fee applies","expected":[100,61113],"passed":true},{"actual":[0,842],"check":"control: zero bps","expected":[0,842],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression fee-exhausts-amount 1\", \"actual\": \"ERR:amount-below-fee\", \"expected\": \"ERR:amount-below-fee\", \"passed\": true}, {\"check\": \"partial repair guard 2\", \"actual\": \"ERR:amount-below-fee\", \"expected\": \"ERR:amount-below-fee\", \"passed\": true}, {\"check\": \"control: yen payout\", \"actual\": [150, 14910], \"expected\": [150, 14910], \"passed\": true}, {\"check\": \"control: fee rounds up\", \"actual\": [11, 990], \"expected\": [11, 990], \"passed\": true}, {\"check\": \"control: minimum fee applies\", \"actual\": [100, 61113], \"expected\": [100, 61113], \"passed\": true}, {\"check\": \"control: zero bps\", \"actual\": [0, 842], \"expected\": [0, 842], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}