{"abstract":"Surcharge amounts are off by a cent in the insured's favour.","category":"Insurance premium rating","checks":10,"contract":"Input premium, deductible and table [[deductible, credit per mille]] ascending (credits may be negative surcharges). Deductibles at or below the first row take its credit, at or above the last row take the last credit (no extrapolation), otherwise interpolate linearly. Credit cents = floor(prem*c/1000+1/2). Negative deductible or empty table -> 'invalid'. Return [credit, premium-credit].","evaluation_group":"w2-insurance_premium_rating-deductible-credit","failed_approach":"Banker's rounding still differs on exact half-cent surcharges.","family":"w2-insurance_premium_rating-deductible-credit-surcharge-rounding","id":"FA-62911","implementations":{"attempt":{"sha256":"d56b96fa65f128d13bcbd0c3eeb67c7edef2a9a313ca0d44669c90e53eef2594","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    tab=x['table']; d=x['deductible']; prem=x['premium']\n    if d<0 or not tab: return 'invalid'\n    if d<=tab[0][0]: c=Fraction(tab[0][1])\n    elif d>=tab[-1][0]: c=Fraction(tab[-1][1])\n    else:\n        i=0\n        while tab[i+1][0]<d: i+=1\n        d0,c0=tab[i]; d1,c1=tab[i+1]\n        c=c0+Fraction(c1-c0)*(d-d0)/(d1-d0)\n    credit=round(prem*c/1000)\n    return [credit, prem-credit]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['base deductible', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 50000, 'premium': 261724}, [0, 261724]], ['interpolated low segment', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 78500, 'premium': 331983}, [11543, 320440]], ['interpolated upper segment', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 481000, 'premium': 116345}, [23939, 92406]], ['beyond largest tabulated deductible', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 751000, 'premium': 322204}, [67985, 254219]], ['exact largest deductible', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 500000, 'premium': 393848}, [83102, 310746]], ['zero deductible uses lowest row', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 0, 'premium': 210458}, [-631, 211089]], ['deductible below table surcharged', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 10000, 'premium': 199242}, [-598, 199840]], ['negative deductible rejected', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': -100, 'premium': 226782}, 'invalid'], ['surcharge tie rounds toward positive', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 25000, 'premium': 22500}, [-67, 22567]], ['interior knot', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 250000, 'premium': 94197}, [13376, 80821]]], [['base deductible', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 50000, 'premium': 199101}, [0, 199101]], ['interpolated low segment', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 86000, 'premium': 159529}, [7121, 152408]], ['interpolated upper segment', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 369000, 'premium': 114198}, [20141, 94057]], ['beyond largest tabulated deductible', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 752000, 'premium': 110216}, [23366, 86850]], ['exact largest deductible', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 500000, 'premium': 313269}, [66413, 246856]], ['zero deductible uses lowest row', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 0, 'premium': 174100}, [-870, 174970]], ['deductible below table surcharged', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 10000, 'premium': 243190}, [-1216, 244406]], ['negative deductible rejected', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': -100, 'premium': 214814}, 'invalid'], ['surcharge tie rounds toward positive', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 25000, 'premium': 23500}, [-117, 23617]], ['interior knot', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 250000, 'premium': 349563}, [50337, 299226]]], [['base deductible', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 50000, 'premium': 263025}, [0, 263025]], ['interpolated low segment', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 55000, 'premium': 117616}, [741, 116875]], ['interpolated upper segment', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 315000, 'premium': 209271}, [34199, 175072]], ['beyond largest tabulated deductible', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 753000, 'premium': 115225}, [24543, 90682]], ['exact largest deductible', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 500000, 'premium': 322765}, [68749, 254016]], ['zero deductible uses lowest row', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 0, 'premium': 297017}, [-2079, 299096]], ['deductible below table surcharged', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 10000, 'premium': 263626}, [-1845, 265471]], ['negative deductible rejected', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': -100, 'premium': 120680}, 'invalid'], ['surcharge tie rounds toward positive', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 25000, 'premium': 24500}, [-171, 24671]], ['interior knot', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 250000, 'premium': 301911}, [44079, 257832]]], [['base deductible', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 50000, 'premium': 340242}, [0, 340242]], ['interpolated low segment', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 96500, 'premium': 240169}, [14295, 225874]], ['interpolated upper segment', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 339000, 'premium': 148801}, [25519, 123282]], ['beyond largest tabulated deductible', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 754000, 'premium': 216687}, [46371, 170316]], ['exact largest deductible', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 500000, 'premium': 388433}, [83125, 305308]], ['zero deductible uses lowest row', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 0, 'premium': 394112}, [-3547, 397659]], ['deductible below table surcharged', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 10000, 'premium': 145337}, [-1308, 146645]], ['negative deductible rejected', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': -100, 'premium': 335212}, 'invalid'], ['surcharge tie rounds toward positive', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 25000, 'premium': 25500}, [-229, 25729]], ['interior knot', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 250000, 'premium': 128496}, [19017, 109479]]], [['base deductible', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 50000, 'premium': 113213}, [0, 113213]], ['interpolated low segment', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 56500, 'premium': 364381}, [3079, 361302]], ['interpolated upper segment', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 374000, 'premium': 322937}, [58852, 264085]], ['beyond largest tabulated deductible', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 755000, 'premium': 161418}, [34705, 126713]], ['exact largest deductible', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 500000, 'premium': 386131}, [83018, 303113]], ['zero deductible uses lowest row', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 0, 'premium': 264667}, [-2911, 267578]], ['deductible below table surcharged', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 10000, 'premium': 141161}, [-1553, 142714]], ['negative deductible rejected', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': -100, 'premium': 190310}, 'invalid'], ['surcharge tie rounds toward positive', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 25000, 'premium': 26500}, [-291, 26791]], ['interior knot', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 250000, 'premium': 86734}, [13010, 73724]]]]\nfor label, args, expected in fixtures[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":"e7d3f044be64d28dec348272a8cde8a8e1fd5f6e7bf790e90a64fb208fe9fe5d","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    tab=x['table']; d=x['deductible']; prem=x['premium']\n    if d<0 or not tab: return 'invalid'\n    if d<=tab[0][0]: c=Fraction(tab[0][1])\n    elif d>=tab[-1][0]: c=Fraction(tab[-1][1])\n    else:\n        i=0\n        while tab[i+1][0]<d: i+=1\n        d0,c0=tab[i]; d1,c1=tab[i+1]\n        c=c0+Fraction(c1-c0)*(d-d0)/(d1-d0)\n    credit=int(prem*c/1000+Fraction(1,2))\n    return [credit, prem-credit]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['base deductible', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 50000, 'premium': 261724}, [0, 261724]], ['interpolated low segment', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 78500, 'premium': 331983}, [11543, 320440]], ['interpolated upper segment', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 481000, 'premium': 116345}, [23939, 92406]], ['beyond largest tabulated deductible', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 751000, 'premium': 322204}, [67985, 254219]], ['exact largest deductible', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 500000, 'premium': 393848}, [83102, 310746]], ['zero deductible uses lowest row', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 0, 'premium': 210458}, [-631, 211089]], ['deductible below table surcharged', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 10000, 'premium': 199242}, [-598, 199840]], ['negative deductible rejected', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': -100, 'premium': 226782}, 'invalid'], ['surcharge tie rounds toward positive', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 25000, 'premium': 22500}, [-67, 22567]], ['interior knot', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 250000, 'premium': 94197}, [13376, 80821]]], [['base deductible', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 50000, 'premium': 199101}, [0, 199101]], ['interpolated low segment', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 86000, 'premium': 159529}, [7121, 152408]], ['interpolated upper segment', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 369000, 'premium': 114198}, [20141, 94057]], ['beyond largest tabulated deductible', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 752000, 'premium': 110216}, [23366, 86850]], ['exact largest deductible', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 500000, 'premium': 313269}, [66413, 246856]], ['zero deductible uses lowest row', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 0, 'premium': 174100}, [-870, 174970]], ['deductible below table surcharged', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 10000, 'premium': 243190}, [-1216, 244406]], ['negative deductible rejected', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': -100, 'premium': 214814}, 'invalid'], ['surcharge tie rounds toward positive', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 25000, 'premium': 23500}, [-117, 23617]], ['interior knot', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 250000, 'premium': 349563}, [50337, 299226]]], [['base deductible', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 50000, 'premium': 263025}, [0, 263025]], ['interpolated low segment', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 55000, 'premium': 117616}, [741, 116875]], ['interpolated upper segment', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 315000, 'premium': 209271}, [34199, 175072]], ['beyond largest tabulated deductible', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 753000, 'premium': 115225}, [24543, 90682]], ['exact largest deductible', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 500000, 'premium': 322765}, [68749, 254016]], ['zero deductible uses lowest row', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 0, 'premium': 297017}, [-2079, 299096]], ['deductible below table surcharged', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 10000, 'premium': 263626}, [-1845, 265471]], ['negative deductible rejected', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': -100, 'premium': 120680}, 'invalid'], ['surcharge tie rounds toward positive', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 25000, 'premium': 24500}, [-171, 24671]], ['interior knot', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 250000, 'premium': 301911}, [44079, 257832]]], [['base deductible', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 50000, 'premium': 340242}, [0, 340242]], ['interpolated low segment', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 96500, 'premium': 240169}, [14295, 225874]], ['interpolated upper segment', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 339000, 'premium': 148801}, [25519, 123282]], ['beyond largest tabulated deductible', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 754000, 'premium': 216687}, [46371, 170316]], ['exact largest deductible', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 500000, 'premium': 388433}, [83125, 305308]], ['zero deductible uses lowest row', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 0, 'premium': 394112}, [-3547, 397659]], ['deductible below table surcharged', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 10000, 'premium': 145337}, [-1308, 146645]], ['negative deductible rejected', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': -100, 'premium': 335212}, 'invalid'], ['surcharge tie rounds toward positive', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 25000, 'premium': 25500}, [-229, 25729]], ['interior knot', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 250000, 'premium': 128496}, [19017, 109479]]], [['base deductible', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 50000, 'premium': 113213}, [0, 113213]], ['interpolated low segment', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 56500, 'premium': 364381}, [3079, 361302]], ['interpolated upper segment', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 374000, 'premium': 322937}, [58852, 264085]], ['beyond largest tabulated deductible', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 755000, 'premium': 161418}, [34705, 126713]], ['exact largest deductible', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 500000, 'premium': 386131}, [83018, 303113]], ['zero deductible uses lowest row', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 0, 'premium': 264667}, [-2911, 267578]], ['deductible below table surcharged', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 10000, 'premium': 141161}, [-1553, 142714]], ['negative deductible rejected', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': -100, 'premium': 190310}, 'invalid'], ['surcharge tie rounds toward positive', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 25000, 'premium': 26500}, [-291, 26791]], ['interior knot', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 250000, 'premium': 86734}, [13010, 73724]]]]\nfor label, args, expected in fixtures[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":"d8143b057c5f753e8c81b5267b7a28222a7c5667173b46f4a298c6600336effb","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nfrom fractions import Fraction\nN = 1\nobservations = []\ndef solve(x):\n    tab=x['table']; d=x['deductible']; prem=x['premium']\n    if d<0 or not tab: return 'invalid'\n    if d<=tab[0][0]: c=Fraction(tab[0][1])\n    elif d>=tab[-1][0]: c=Fraction(tab[-1][1])\n    else:\n        i=0\n        while tab[i+1][0]<d: i+=1\n        d0,c0=tab[i]; d1,c1=tab[i+1]\n        c=c0+Fraction(c1-c0)*(d-d0)/(d1-d0)\n    credit=math.floor(prem*c/1000+Fraction(1,2))\n    return [credit, prem-credit]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['base deductible', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 50000, 'premium': 261724}, [0, 261724]], ['interpolated low segment', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 78500, 'premium': 331983}, [11543, 320440]], ['interpolated upper segment', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 481000, 'premium': 116345}, [23939, 92406]], ['beyond largest tabulated deductible', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 751000, 'premium': 322204}, [67985, 254219]], ['exact largest deductible', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 500000, 'premium': 393848}, [83102, 310746]], ['zero deductible uses lowest row', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 0, 'premium': 210458}, [-631, 211089]], ['deductible below table surcharged', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 10000, 'premium': 199242}, [-598, 199840]], ['negative deductible rejected', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': -100, 'premium': 226782}, 'invalid'], ['surcharge tie rounds toward positive', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 25000, 'premium': 22500}, [-67, 22567]], ['interior knot', {'table': [[25000, -3], [50000, 0], [100000, 61], [250000, 142], [500000, 211]], 'deductible': 250000, 'premium': 94197}, [13376, 80821]]], [['base deductible', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 50000, 'premium': 199101}, [0, 199101]], ['interpolated low segment', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 86000, 'premium': 159529}, [7121, 152408]], ['interpolated upper segment', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 369000, 'premium': 114198}, [20141, 94057]], ['beyond largest tabulated deductible', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 752000, 'premium': 110216}, [23366, 86850]], ['exact largest deductible', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 500000, 'premium': 313269}, [66413, 246856]], ['zero deductible uses lowest row', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 0, 'premium': 174100}, [-870, 174970]], ['deductible below table surcharged', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 10000, 'premium': 243190}, [-1216, 244406]], ['negative deductible rejected', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': -100, 'premium': 214814}, 'invalid'], ['surcharge tie rounds toward positive', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 25000, 'premium': 23500}, [-117, 23617]], ['interior knot', {'table': [[25000, -5], [50000, 0], [100000, 62], [250000, 144], [500000, 212]], 'deductible': 250000, 'premium': 349563}, [50337, 299226]]], [['base deductible', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 50000, 'premium': 263025}, [0, 263025]], ['interpolated low segment', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 55000, 'premium': 117616}, [741, 116875]], ['interpolated upper segment', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 315000, 'premium': 209271}, [34199, 175072]], ['beyond largest tabulated deductible', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 753000, 'premium': 115225}, [24543, 90682]], ['exact largest deductible', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 500000, 'premium': 322765}, [68749, 254016]], ['zero deductible uses lowest row', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 0, 'premium': 297017}, [-2079, 299096]], ['deductible below table surcharged', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 10000, 'premium': 263626}, [-1845, 265471]], ['negative deductible rejected', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': -100, 'premium': 120680}, 'invalid'], ['surcharge tie rounds toward positive', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 25000, 'premium': 24500}, [-171, 24671]], ['interior knot', {'table': [[25000, -7], [50000, 0], [100000, 63], [250000, 146], [500000, 213]], 'deductible': 250000, 'premium': 301911}, [44079, 257832]]], [['base deductible', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 50000, 'premium': 340242}, [0, 340242]], ['interpolated low segment', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 96500, 'premium': 240169}, [14295, 225874]], ['interpolated upper segment', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 339000, 'premium': 148801}, [25519, 123282]], ['beyond largest tabulated deductible', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 754000, 'premium': 216687}, [46371, 170316]], ['exact largest deductible', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 500000, 'premium': 388433}, [83125, 305308]], ['zero deductible uses lowest row', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 0, 'premium': 394112}, [-3547, 397659]], ['deductible below table surcharged', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 10000, 'premium': 145337}, [-1308, 146645]], ['negative deductible rejected', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': -100, 'premium': 335212}, 'invalid'], ['surcharge tie rounds toward positive', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 25000, 'premium': 25500}, [-229, 25729]], ['interior knot', {'table': [[25000, -9], [50000, 0], [100000, 64], [250000, 148], [500000, 214]], 'deductible': 250000, 'premium': 128496}, [19017, 109479]]], [['base deductible', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 50000, 'premium': 113213}, [0, 113213]], ['interpolated low segment', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 56500, 'premium': 364381}, [3079, 361302]], ['interpolated upper segment', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 374000, 'premium': 322937}, [58852, 264085]], ['beyond largest tabulated deductible', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 755000, 'premium': 161418}, [34705, 126713]], ['exact largest deductible', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 500000, 'premium': 386131}, [83018, 303113]], ['zero deductible uses lowest row', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 0, 'premium': 264667}, [-2911, 267578]], ['deductible below table surcharged', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 10000, 'premium': 141161}, [-1553, 142714]], ['negative deductible rejected', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': -100, 'premium': 190310}, 'invalid'], ['surcharge tie rounds toward positive', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 25000, 'premium': 26500}, [-291, 26791]], ['interior knot', {'table': [[25000, -11], [50000, 0], [100000, 65], [250000, 150], [500000, 215]], 'deductible': 250000, 'premium': 86734}, [13010, 73724]]]]\nfor label, args, expected in fixtures[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 of a stipulated toy rating contract. Amounts are integer cents and factors exact rationals; it makes no claim of conformance with any filed rating plan, bureau manual or jurisdiction. 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-insurance_premium_rating-deductible-credit-surcharge-rounding","generated_at":"2026-09-29T14:47:09.318142+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Premium rating engines apply ordered tabular rules where one misplaced boundary or step silently misprices policies.","repair":"Use floor(v+1/2) for both signs.","root_cause":"int() truncates toward zero, so half-up on negative credits moves the wrong way.","sha256":"e7b774e0c7f585d5ee4204f813d84f470359c7cc47b335ed2732c11bff22cda6","title":"Deductible credit interpolation: Negative credits round toward zero · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":46.045,"exit_code":1,"observations":[{"actual":[0,261724],"check":"base deductible","expected":[0,261724],"passed":true},{"actual":[11543,320440],"check":"interpolated low segment","expected":[11543,320440],"passed":true},{"actual":[23939,92406],"check":"interpolated upper segment","expected":[23939,92406],"passed":true},{"actual":[67985,254219],"check":"beyond largest tabulated deductible","expected":[67985,254219],"passed":true},{"actual":[83102,310746],"check":"exact largest deductible","expected":[83102,310746],"passed":true},{"actual":[-631,211089],"check":"zero deductible uses lowest row","expected":[-631,211089],"passed":true},{"actual":[-598,199840],"check":"deductible below table surcharged","expected":[-598,199840],"passed":true},{"actual":"invalid","check":"negative deductible rejected","expected":"invalid","passed":true},{"actual":[-68,22568],"check":"surcharge tie rounds toward positive","expected":[-67,22567],"passed":false},{"actual":[13376,80821],"check":"interior knot","expected":[13376,80821],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"base deductible\", \"actual\": [0, 261724], \"expected\": [0, 261724], \"passed\": true}, {\"check\": \"interpolated low segment\", \"actual\": [11543, 320440], \"expected\": [11543, 320440], \"passed\": true}, {\"check\": \"interpolated upper segment\", \"actual\": [23939, 92406], \"expected\": [23939, 92406], \"passed\": true}, {\"check\": \"beyond largest tabulated deductible\", \"actual\": [67985, 254219], \"expected\": [67985, 254219], \"passed\": true}, {\"check\": \"exact largest deductible\", \"actual\": [83102, 310746], \"expected\": [83102, 310746], \"passed\": true}, {\"check\": \"zero deductible uses lowest row\", \"actual\": [-631, 211089], \"expected\": [-631, 211089], \"passed\": true}, {\"check\": \"deductible below table surcharged\", \"actual\": [-598, 199840], \"expected\": [-598, 199840], \"passed\": true}, {\"check\": \"negative deductible rejected\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"surcharge tie rounds toward positive\", \"actual\": [-68, 22568], \"expected\": [-67, 22567], \"passed\": false}, {\"check\": \"interior knot\", \"actual\": [13376, 80821], \"expected\": [13376, 80821], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":46.773,"exit_code":1,"observations":[{"actual":[0,261724],"check":"base deductible","expected":[0,261724],"passed":true},{"actual":[11543,320440],"check":"interpolated low segment","expected":[11543,320440],"passed":true},{"actual":[23939,92406],"check":"interpolated upper segment","expected":[23939,92406],"passed":true},{"actual":[67985,254219],"check":"beyond largest tabulated deductible","expected":[67985,254219],"passed":true},{"actual":[83102,310746],"check":"exact largest deductible","expected":[83102,310746],"passed":true},{"actual":[-630,211088],"check":"zero deductible uses lowest row","expected":[-631,211089],"passed":false},{"actual":[-597,199839],"check":"deductible below table surcharged","expected":[-598,199840],"passed":false},{"actual":"invalid","check":"negative deductible rejected","expected":"invalid","passed":true},{"actual":[-67,22567],"check":"surcharge tie rounds toward positive","expected":[-67,22567],"passed":true},{"actual":[13376,80821],"check":"interior knot","expected":[13376,80821],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"base deductible\", \"actual\": [0, 261724], \"expected\": [0, 261724], \"passed\": true}, {\"check\": \"interpolated low segment\", \"actual\": [11543, 320440], \"expected\": [11543, 320440], \"passed\": true}, {\"check\": \"interpolated upper segment\", \"actual\": [23939, 92406], \"expected\": [23939, 92406], \"passed\": true}, {\"check\": \"beyond largest tabulated deductible\", \"actual\": [67985, 254219], \"expected\": [67985, 254219], \"passed\": true}, {\"check\": \"exact largest deductible\", \"actual\": [83102, 310746], \"expected\": [83102, 310746], \"passed\": true}, {\"check\": \"zero deductible uses lowest row\", \"actual\": [-630, 211088], \"expected\": [-631, 211089], \"passed\": false}, {\"check\": \"deductible below table surcharged\", \"actual\": [-597, 199839], \"expected\": [-598, 199840], \"passed\": false}, {\"check\": \"negative deductible rejected\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"surcharge tie rounds toward positive\", \"actual\": [-67, 22567], \"expected\": [-67, 22567], \"passed\": true}, {\"check\": \"interior knot\", \"actual\": [13376, 80821], \"expected\": [13376, 80821], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":47.453,"exit_code":0,"observations":[{"actual":[0,261724],"check":"base deductible","expected":[0,261724],"passed":true},{"actual":[11543,320440],"check":"interpolated low segment","expected":[11543,320440],"passed":true},{"actual":[23939,92406],"check":"interpolated upper segment","expected":[23939,92406],"passed":true},{"actual":[67985,254219],"check":"beyond largest tabulated deductible","expected":[67985,254219],"passed":true},{"actual":[83102,310746],"check":"exact largest deductible","expected":[83102,310746],"passed":true},{"actual":[-631,211089],"check":"zero deductible uses lowest row","expected":[-631,211089],"passed":true},{"actual":[-598,199840],"check":"deductible below table surcharged","expected":[-598,199840],"passed":true},{"actual":"invalid","check":"negative deductible rejected","expected":"invalid","passed":true},{"actual":[-67,22567],"check":"surcharge tie rounds toward positive","expected":[-67,22567],"passed":true},{"actual":[13376,80821],"check":"interior knot","expected":[13376,80821],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"base deductible\", \"actual\": [0, 261724], \"expected\": [0, 261724], \"passed\": true}, {\"check\": \"interpolated low segment\", \"actual\": [11543, 320440], \"expected\": [11543, 320440], \"passed\": true}, {\"check\": \"interpolated upper segment\", \"actual\": [23939, 92406], \"expected\": [23939, 92406], \"passed\": true}, {\"check\": \"beyond largest tabulated deductible\", \"actual\": [67985, 254219], \"expected\": [67985, 254219], \"passed\": true}, {\"check\": \"exact largest deductible\", \"actual\": [83102, 310746], \"expected\": [83102, 310746], \"passed\": true}, {\"check\": \"zero deductible uses lowest row\", \"actual\": [-631, 211089], \"expected\": [-631, 211089], \"passed\": true}, {\"check\": \"deductible below table surcharged\", \"actual\": [-598, 199840], \"expected\": [-598, 199840], \"passed\": true}, {\"check\": \"negative deductible rejected\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}, {\"check\": \"surcharge tie rounds toward positive\", \"actual\": [-67, 22567], \"expected\": [-67, 22567], \"passed\": true}, {\"check\": \"interior knot\", \"actual\": [13376, 80821], \"expected\": [13376, 80821], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}