{"abstract":"Large transfers are charged at most the minimum fee.","category":"Currency rounding and FX conversion","checks":7,"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].","contract_signature":"amount, rate, src_exp, dst_exp, fee_bps, min_fee","evaluation_group":"w2-currency_rounding_and_fx_conversion-conversion-fee-bps","failed_approach":"Using the minimum only when the percentage fee is zero under-charges small non-zero fees.","family":"w2-currency_rounding_and_fx_conversion-conversion-fee-bps-minimum-fee","id":"FA-62071","implementations":{"attempt":{"sha256":"6718119407eb40f0f15743031cad768adc2f1d6f8abc1e0ebfaf676528271d2d","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 = pct or min_fee\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 minimum-fee 1', (20000, '0.3071', 2, 3, 25, 100), [100, 61113]),\n  ('regression minimum-fee 2', (10000, '151.37', 2, 0, 150, 50), [150, 14910]),\n  ('partial repair guard 2', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('control: fee rounds up', (1001, '1', 2, 2, 100, 0), [11, 990]),\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 minimum-fee 1', (1001, '1', 2, 2, 100, 0), [11, 990]),\n  ('regression minimum-fee 2', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 1', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (314862, '122.2171', 2, 2, 5, 1000), [1000, 38359303]),\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 minimum-fee 1', (123456, '0.92', 2, 2, 250, 199), [3087, 110739]),\n  ('regression minimum-fee 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('partial repair guard 1', (6382, '2724.83', 3, 0, 333, 1000), [1000, 14665]),\n  ('partial repair guard 2', (209552, '10.19418', 2, 3, 5, 250), [250, 21336623]),\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: fee equals amount', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee')],\n [('regression minimum-fee 1', (197637, '16116.34', 0, 2, 333, 100), [6582, 307910733870]),\n  ('regression minimum-fee 2', (22226, '179.9447', 0, 2, 150, 100), [334, 393934937]),\n  ('partial repair guard 1', (196707, '199.6780', 0, 3, 25, 1000), [1000, 39078382346]),\n  ('partial repair guard 2', (8653, '7.1259', 3, 3, 99, 250), [250, 59879]),\n  ('control: fee rounds up', (1001, '1', 2, 2, 100, 0), [11, 990]),\n  ('control: fee equals amount', (500, '0.9', 2, 2, 10, 500), '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 [('regression minimum-fee 1', (50411, '12342.04', 3, 3, 333, 1), [1679, 601452293]),\n  ('regression minimum-fee 2', (268603, '16.66106', 2, 0, 150, 50), [4030, 44081]),\n  ('partial repair guard 1', (280407, '11.52605', 3, 0, 25, 1000), [1000, 3220]),\n  ('partial repair guard 2', (453829, '90.1289', 3, 3, 5, 250), [250, 40880576]),\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: minimum exceeds amount', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee')]]\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":"9a42fee69f5250a82eea246b1e0f18e215a4ae5d56bfa71456f282fa54b4b651","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 = min(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 minimum-fee 1', (20000, '0.3071', 2, 3, 25, 100), [100, 61113]),\n  ('regression minimum-fee 2', (10000, '151.37', 2, 0, 150, 50), [150, 14910]),\n  ('partial repair guard 2', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('control: fee rounds up', (1001, '1', 2, 2, 100, 0), [11, 990]),\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 minimum-fee 1', (1001, '1', 2, 2, 100, 0), [11, 990]),\n  ('regression minimum-fee 2', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee'),\n  ('partial repair guard 1', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('partial repair guard 2', (314862, '122.2171', 2, 2, 5, 1000), [1000, 38359303]),\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 minimum-fee 1', (123456, '0.92', 2, 2, 250, 199), [3087, 110739]),\n  ('regression minimum-fee 2', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee'),\n  ('partial repair guard 1', (6382, '2724.83', 3, 0, 333, 1000), [1000, 14665]),\n  ('partial repair guard 2', (209552, '10.19418', 2, 3, 5, 250), [250, 21336623]),\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: fee equals amount', (500, '0.9', 2, 2, 10, 500), 'ERR:amount-below-fee')],\n [('regression minimum-fee 1', (197637, '16116.34', 0, 2, 333, 100), [6582, 307910733870]),\n  ('regression minimum-fee 2', (22226, '179.9447', 0, 2, 150, 100), [334, 393934937]),\n  ('partial repair guard 1', (196707, '199.6780', 0, 3, 25, 1000), [1000, 39078382346]),\n  ('partial repair guard 2', (8653, '7.1259', 3, 3, 99, 250), [250, 59879]),\n  ('control: fee rounds up', (1001, '1', 2, 2, 100, 0), [11, 990]),\n  ('control: fee equals amount', (500, '0.9', 2, 2, 10, 500), '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 [('regression minimum-fee 1', (50411, '12342.04', 3, 3, 333, 1), [1679, 601452293]),\n  ('regression minimum-fee 2', (268603, '16.66106', 2, 0, 150, 50), [4030, 44081]),\n  ('partial repair guard 1', (280407, '11.52605', 3, 0, 25, 1000), [1000, 3220]),\n  ('partial repair guard 2', (453829, '90.1289', 3, 3, 5, 250), [250, 40880576]),\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: minimum exceeds amount', (99, '1.2', 2, 2, 5, 150), 'ERR:amount-below-fee')]]\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-minimum-fee","generated_at":"2026-09-29T14:47:01.164155+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":"fee = min(min_fee, pct) caps the percentage fee instead of flooring it.","sha256":"952eff3cc2fd11c4e15eac233037be68927b030102d4106562e63d42168bfc2f","title":"The minimum fee acts as a maximum · 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.785,"exit_code":1,"observations":[{"actual":[50,61266],"check":"regression minimum-fee 1","expected":[100,61113],"passed":false},{"actual":[150,14910],"check":"regression minimum-fee 2","expected":[150,14910],"passed":true},{"actual":[1,449],"check":"partial repair guard 2","expected":"ERR:amount-below-fee","passed":false},{"actual":[11,990],"check":"control: fee rounds up","expected":[11,990],"passed":true},{"actual":[0,842],"check":"control: zero bps","expected":[0,842],"passed":true},{"actual":[3087,110739],"check":"control: large percentage fee","expected":[3087,110739],"passed":true},{"actual":"ERR:input","check":"control: invalid amount","expected":"ERR:input","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression minimum-fee 1\", \"actual\": [50, 61266], \"expected\": [100, 61113], \"passed\": false}, {\"check\": \"regression minimum-fee 2\", \"actual\": [150, 14910], \"expected\": [150, 14910], \"passed\": true}, {\"check\": \"partial repair guard 2\", \"actual\": [1, 449], \"expected\": \"ERR:amount-below-fee\", \"passed\": false}, {\"check\": \"control: fee rounds up\", \"actual\": [11, 990], \"expected\": [11, 990], \"passed\": true}, {\"check\": \"control: zero bps\", \"actual\": [0, 842], \"expected\": [0, 842], \"passed\": true}, {\"check\": \"control: large percentage fee\", \"actual\": [3087, 110739], \"expected\": [3087, 110739], \"passed\": true}, {\"check\": \"control: invalid amount\", \"actual\": \"ERR:input\", \"expected\": \"ERR:input\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.883,"exit_code":1,"observations":[{"actual":[50,61266],"check":"regression minimum-fee 1","expected":[100,61113],"passed":false},{"actual":[50,15061],"check":"regression minimum-fee 2","expected":[150,14910],"passed":false},{"actual":[1,449],"check":"partial repair guard 2","expected":"ERR:amount-below-fee","passed":false},{"actual":[0,1001],"check":"control: fee rounds up","expected":[11,990],"passed":false},{"actual":[0,842],"check":"control: zero bps","expected":[0,842],"passed":true},{"actual":[199,113396],"check":"control: large percentage fee","expected":[3087,110739],"passed":false},{"actual":"ERR:input","check":"control: invalid amount","expected":"ERR:input","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression minimum-fee 1\", \"actual\": [50, 61266], \"expected\": [100, 61113], \"passed\": false}, {\"check\": \"regression minimum-fee 2\", \"actual\": [50, 15061], \"expected\": [150, 14910], \"passed\": false}, {\"check\": \"partial repair guard 2\", \"actual\": [1, 449], \"expected\": \"ERR:amount-below-fee\", \"passed\": false}, {\"check\": \"control: fee rounds up\", \"actual\": [0, 1001], \"expected\": [11, 990], \"passed\": false}, {\"check\": \"control: zero bps\", \"actual\": [0, 842], \"expected\": [0, 842], \"passed\": true}, {\"check\": \"control: large percentage fee\", \"actual\": [199, 113396], \"expected\": [3087, 110739], \"passed\": false}, {\"check\": \"control: invalid amount\", \"actual\": \"ERR:input\", \"expected\": \"ERR:input\", \"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."}}