{"abstract":"A basket of 1.02 and 1.02 is charged 2.00 instead of 2.05.","category":"Currency rounding and FX conversion","checks":7,"contract":"solve(lines, tender): lines are CHF decimal strings with up to three decimals (weight- or volume-priced items; refund lines negative). The exact total is their sum. For tender 'cash' (compared after trimming and lower-casing) the total is rounded to the nearest 0.05 with ties away from zero; every other tender ('card', 'twint', 'voucher', ...) pays the total rounded half-up to 0.01. Return [payable as a 2-decimal string, adjustment as a 3-decimal string] where adjustment = payable - exact; zeros are unsigned.","contract_signature":"lines, tender","evaluation_group":"w2-currency_rounding_and_fx_conversion-swiss-cash-rounding","failed_approach":"Quantizing the total with Decimal('0.05') only fixes the exponent and performs no 5-rappen rounding.","family":"w2-currency_rounding_and_fx_conversion-swiss-cash-rounding-rounding-scope","id":"FA-62006","implementations":{"attempt":{"sha256":"30cffacfa32e46e00ad20ba99d4db8cb300e1d25ff63c7b0767b57e2a3c11ad5","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(lines, tender):\n    def cash(v):\n        return (v / Decimal('0.05')).quantize(Decimal(1), rounding=ROUND_HALF_UP) * Decimal('0.05')\n    def z(d, e):\n        d = d.quantize(Decimal(1).scaleb(-e), rounding=ROUND_HALF_UP)\n        return format(abs(d) if d == 0 else d, 'f')\n    exact = sum((Decimal(l) for l in lines), Decimal('0.000'))\n    if tender.strip().lower() == 'cash':\n        r = exact.quantize(Decimal('0.05'), rounding=ROUND_HALF_UP)\n    else:\n        r = exact.quantize(Decimal('0.01'), rounding=ROUND_HALF_UP)\n    return [z(r, 2), z(r - exact, 3)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression rounding-scope 1', (['1.02', '1.02'], 'cash'), ['2.05', '0.010']),\n  ('regression rounding-scope 2', (['0.99', '0.03'], 'cash'), ['1.00', '-0.020']),\n  ('partial repair guard 2', (['1.02', '1.00'], 'cash'), ['2.00', '-0.020']),\n  ('control: refund', (['-1.03', '-0.99'], 'cash'), ['-2.00', '0.020']),\n  ('control: refund to zero', (['-0.02'], 'Cash '), ['0.00', '0.020']),\n  ('control: card exact', (['1.02'], 'card'), ['1.02', '0.000']),\n  ('control: twint exact', (['3.33', '4.44'], 'twint'), ['7.77', '0.000'])],\n [('regression rounding-scope 1', (['-1.03', '-0.99'], 'cash'), ['-2.00', '0.020']),\n  ('regression rounding-scope 2', (['12.40', '-3.12', '0.99'], ' CASH'), ['10.25', '-0.020']),\n  ('partial repair guard 1', (['0.99', '0.03'], 'cash'), ['1.00', '-0.020']),\n  ('control: refund to zero', (['-0.02'], 'Cash '), ['0.00', '0.020']),\n  ('control: card exact', (['1.02'], 'card'), ['1.02', '0.000']),\n  ('control: twint exact', (['3.33', '4.44'], 'twint'), ['7.77', '0.000']),\n  ('control: positive tie', (['3.00', '0.025'], 'cash'), ['3.05', '0.025'])],\n [('regression rounding-scope 1', (['12.71', '-2.68'], 'Cash'), ['10.05', '0.020']),\n  ('regression rounding-scope 2', (['17.98', '8.07', '0.335', '23.38'], 'Cash'), ['49.75', '-0.015']),\n  ('partial repair guard 1', (['-0.02'], 'Cash '), ['0.00', '0.020']),\n  ('partial repair guard 2', (['3.00', '0.025'], 'cash'), ['3.05', '0.025']),\n  ('control: negative tie', (['-2.075'], 'cash'), ['-2.10', '-0.025']),\n  ('control: voucher exact', (['7.07'], 'voucher'), ['7.07', '0.000']),\n  ('control: mixed basket', (['12.40', '-3.12', '0.99'], ' CASH'), ['10.25', '-0.020']),\n  ('control: round down', (['1.02', '1.00'], 'cash'), ['2.00', '-0.020'])],\n [('regression rounding-scope 1', (['7.95', '16.09', '-3.325', '23.21'], 'cash'), ['43.95', '0.025']),\n  ('regression rounding-scope 2', (['12.08', '3.43', '4.44', '-4.37'], ' cash '), ['15.60', '0.020']),\n  ('partial repair guard 1', (['-2.075'], 'cash'), ['-2.10', '-0.025']),\n  ('partial repair guard 2', (['12.40', '-3.12', '0.99'], ' CASH'), ['10.25', '-0.020']),\n  ('control: round down', (['1.02', '1.00'], 'cash'), ['2.00', '-0.020']),\n  ('control: round to franc', (['0.99', '0.03'], 'cash'), ['1.00', '-0.020']),\n  ('control: refund', (['-1.03', '-0.99'], 'cash'), ['-2.00', '0.020']),\n  ('control: refund to zero', (['-0.02'], 'Cash '), ['0.00', '0.020'])],\n [('regression rounding-scope 1', (['22.60', '28.56', '15.17'], ' cash '), ['66.35', '0.020']),\n  ('regression rounding-scope 2', (['1.095', '2.025', '14.13'], 'cash'), ['17.25', '0.000']),\n  ('partial repair guard 1', (['12.71', '-2.68'], 'Cash'), ['10.05', '0.020']),\n  ('partial repair guard 2', (['19.47', '26.34'], 'CASH'), ['45.80', '-0.010']),\n  ('control: refund', (['-1.03', '-0.99'], 'cash'), ['-2.00', '0.020']),\n  ('control: refund to zero', (['-0.02'], 'Cash '), ['0.00', '0.020']),\n  ('control: card exact', (['1.02'], 'card'), ['1.02', '0.000']),\n  ('control: twint exact', (['3.33', '4.44'], 'twint'), ['7.77', '0.000'])]]\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":"f747a20b42583c2237f95debf1d17b0eb221ae055b2dc2a2081921b786587811","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(lines, tender):\n    def cash(v):\n        return (v / Decimal('0.05')).quantize(Decimal(1), rounding=ROUND_HALF_UP) * Decimal('0.05')\n    def z(d, e):\n        d = d.quantize(Decimal(1).scaleb(-e), rounding=ROUND_HALF_UP)\n        return format(abs(d) if d == 0 else d, 'f')\n    exact = sum((Decimal(l) for l in lines), Decimal('0.000'))\n    if tender.strip().lower() == 'cash':\n        r = sum((cash(Decimal(l)) for l in lines), Decimal('0.00'))\n    else:\n        r = exact.quantize(Decimal('0.01'), rounding=ROUND_HALF_UP)\n    return [z(r, 2), z(r - exact, 3)]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncases = [[('regression rounding-scope 1', (['1.02', '1.02'], 'cash'), ['2.05', '0.010']),\n  ('regression rounding-scope 2', (['0.99', '0.03'], 'cash'), ['1.00', '-0.020']),\n  ('partial repair guard 2', (['1.02', '1.00'], 'cash'), ['2.00', '-0.020']),\n  ('control: refund', (['-1.03', '-0.99'], 'cash'), ['-2.00', '0.020']),\n  ('control: refund to zero', (['-0.02'], 'Cash '), ['0.00', '0.020']),\n  ('control: card exact', (['1.02'], 'card'), ['1.02', '0.000']),\n  ('control: twint exact', (['3.33', '4.44'], 'twint'), ['7.77', '0.000'])],\n [('regression rounding-scope 1', (['-1.03', '-0.99'], 'cash'), ['-2.00', '0.020']),\n  ('regression rounding-scope 2', (['12.40', '-3.12', '0.99'], ' CASH'), ['10.25', '-0.020']),\n  ('partial repair guard 1', (['0.99', '0.03'], 'cash'), ['1.00', '-0.020']),\n  ('control: refund to zero', (['-0.02'], 'Cash '), ['0.00', '0.020']),\n  ('control: card exact', (['1.02'], 'card'), ['1.02', '0.000']),\n  ('control: twint exact', (['3.33', '4.44'], 'twint'), ['7.77', '0.000']),\n  ('control: positive tie', (['3.00', '0.025'], 'cash'), ['3.05', '0.025'])],\n [('regression rounding-scope 1', (['12.71', '-2.68'], 'Cash'), ['10.05', '0.020']),\n  ('regression rounding-scope 2', (['17.98', '8.07', '0.335', '23.38'], 'Cash'), ['49.75', '-0.015']),\n  ('partial repair guard 1', (['-0.02'], 'Cash '), ['0.00', '0.020']),\n  ('partial repair guard 2', (['3.00', '0.025'], 'cash'), ['3.05', '0.025']),\n  ('control: negative tie', (['-2.075'], 'cash'), ['-2.10', '-0.025']),\n  ('control: voucher exact', (['7.07'], 'voucher'), ['7.07', '0.000']),\n  ('control: mixed basket', (['12.40', '-3.12', '0.99'], ' CASH'), ['10.25', '-0.020']),\n  ('control: round down', (['1.02', '1.00'], 'cash'), ['2.00', '-0.020'])],\n [('regression rounding-scope 1', (['7.95', '16.09', '-3.325', '23.21'], 'cash'), ['43.95', '0.025']),\n  ('regression rounding-scope 2', (['12.08', '3.43', '4.44', '-4.37'], ' cash '), ['15.60', '0.020']),\n  ('partial repair guard 1', (['-2.075'], 'cash'), ['-2.10', '-0.025']),\n  ('partial repair guard 2', (['12.40', '-3.12', '0.99'], ' CASH'), ['10.25', '-0.020']),\n  ('control: round down', (['1.02', '1.00'], 'cash'), ['2.00', '-0.020']),\n  ('control: round to franc', (['0.99', '0.03'], 'cash'), ['1.00', '-0.020']),\n  ('control: refund', (['-1.03', '-0.99'], 'cash'), ['-2.00', '0.020']),\n  ('control: refund to zero', (['-0.02'], 'Cash '), ['0.00', '0.020'])],\n [('regression rounding-scope 1', (['22.60', '28.56', '15.17'], ' cash '), ['66.35', '0.020']),\n  ('regression rounding-scope 2', (['1.095', '2.025', '14.13'], 'cash'), ['17.25', '0.000']),\n  ('partial repair guard 1', (['12.71', '-2.68'], 'Cash'), ['10.05', '0.020']),\n  ('partial repair guard 2', (['19.47', '26.34'], 'CASH'), ['45.80', '-0.010']),\n  ('control: refund', (['-1.03', '-0.99'], 'cash'), ['-2.00', '0.020']),\n  ('control: refund to zero', (['-0.02'], 'Cash '), ['0.00', '0.020']),\n  ('control: card exact', (['1.02'], 'card'), ['1.02', '0.000']),\n  ('control: twint exact', (['3.33', '4.44'], 'twint'), ['7.77', '0.000'])]]\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-swiss-cash-rounding-rounding-scope","generated_at":"2026-09-29T14:47:00.700005+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":"Each line is rounded to 0.05 and the rounded lines are summed.","sha256":"97da1f3a56c577563fb9b21c3a7b45e240c6d75bd44dfa0bdf45cf246eaca012","title":"Cash rounding is applied to each line instead of the basket total · 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":44.178,"exit_code":1,"observations":[{"actual":["2.04","0.000"],"check":"regression rounding-scope 1","expected":["2.05","0.010"],"passed":false},{"actual":["1.02","0.000"],"check":"regression rounding-scope 2","expected":["1.00","-0.020"],"passed":false},{"actual":["2.02","0.000"],"check":"partial repair guard 2","expected":["2.00","-0.020"],"passed":false},{"actual":["-2.02","0.000"],"check":"control: refund","expected":["-2.00","0.020"],"passed":false},{"actual":["-0.02","0.000"],"check":"control: refund to zero","expected":["0.00","0.020"],"passed":false},{"actual":["1.02","0.000"],"check":"control: card exact","expected":["1.02","0.000"],"passed":true},{"actual":["7.77","0.000"],"check":"control: twint exact","expected":["7.77","0.000"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression rounding-scope 1\", \"actual\": [\"2.04\", \"0.000\"], \"expected\": [\"2.05\", \"0.010\"], \"passed\": false}, {\"check\": \"regression rounding-scope 2\", \"actual\": [\"1.02\", \"0.000\"], \"expected\": [\"1.00\", \"-0.020\"], \"passed\": false}, {\"check\": \"partial repair guard 2\", \"actual\": [\"2.02\", \"0.000\"], \"expected\": [\"2.00\", \"-0.020\"], \"passed\": false}, {\"check\": \"control: refund\", \"actual\": [\"-2.02\", \"0.000\"], \"expected\": [\"-2.00\", \"0.020\"], \"passed\": false}, {\"check\": \"control: refund to zero\", \"actual\": [\"-0.02\", \"0.000\"], \"expected\": [\"0.00\", \"0.020\"], \"passed\": false}, {\"check\": \"control: card exact\", \"actual\": [\"1.02\", \"0.000\"], \"expected\": [\"1.02\", \"0.000\"], \"passed\": true}, {\"check\": \"control: twint exact\", \"actual\": [\"7.77\", \"0.000\"], \"expected\": [\"7.77\", \"0.000\"], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.325,"exit_code":1,"observations":[{"actual":["2.00","-0.040"],"check":"regression rounding-scope 1","expected":["2.05","0.010"],"passed":false},{"actual":["1.05","0.030"],"check":"regression rounding-scope 2","expected":["1.00","-0.020"],"passed":false},{"actual":["2.00","-0.020"],"check":"partial repair guard 2","expected":["2.00","-0.020"],"passed":true},{"actual":["-2.05","-0.030"],"check":"control: refund","expected":["-2.00","0.020"],"passed":false},{"actual":["0.00","0.020"],"check":"control: refund to zero","expected":["0.00","0.020"],"passed":true},{"actual":["1.02","0.000"],"check":"control: card exact","expected":["1.02","0.000"],"passed":true},{"actual":["7.77","0.000"],"check":"control: twint exact","expected":["7.77","0.000"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression rounding-scope 1\", \"actual\": [\"2.00\", \"-0.040\"], \"expected\": [\"2.05\", \"0.010\"], \"passed\": false}, {\"check\": \"regression rounding-scope 2\", \"actual\": [\"1.05\", \"0.030\"], \"expected\": [\"1.00\", \"-0.020\"], \"passed\": false}, {\"check\": \"partial repair guard 2\", \"actual\": [\"2.00\", \"-0.020\"], \"expected\": [\"2.00\", \"-0.020\"], \"passed\": true}, {\"check\": \"control: refund\", \"actual\": [\"-2.05\", \"-0.030\"], \"expected\": [\"-2.00\", \"0.020\"], \"passed\": false}, {\"check\": \"control: refund to zero\", \"actual\": [\"0.00\", \"0.020\"], \"expected\": [\"0.00\", \"0.020\"], \"passed\": true}, {\"check\": \"control: card exact\", \"actual\": [\"1.02\", \"0.000\"], \"expected\": [\"1.02\", \"0.000\"], \"passed\": true}, {\"check\": \"control: twint exact\", \"actual\": [\"7.77\", \"0.000\"], \"expected\": [\"7.77\", \"0.000\"], \"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."}}