FAILURE MAP
← Case archive

FA-58876 / Payroll withholding rules / Open access

Additional Medicare withholding threshold: separately rounded components · case 01

The total Medicare line is off by a cent from the sum of its two printed components.

Verified by executionVariant 1 · 10 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The total is recomputed with one combined rounding instead of adding the separately rounded regular and additional amounts.

VERIFIED REPAIR

Restore the contract rule at the separately rounded components step: use `return [base_tax, extra_wages, base_tax + extra]`.

Unsuccessful approach: The attempt still combines the components before rounding and additionally truncates, so the total diverges even more often.

Case contract

Input [ytd_wages, wages] in cents. Regular Medicare is 1.45% of wages rounded half-up. Additional Medicare is 0.9% of the part of this paycheck that pushes year-to-date wages above 200,000.00, rounded half-up separately. Return [medicare, additional_wages, medicare + additional].

Why this case matters

The employer must begin the extra 0.9% exactly with the paycheck that crosses the threshold, and only on the excess portion.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    ytd, wages = x
    base_tax = (wages * 145 + 5000) // 10000
    over_before = max(0, ytd - 20000000)
    over_after = max(0, ytd + wages - 20000000)
    extra_wages = over_after - over_before
    extra = (extra_wages * 9 + 500) // 1000
    return [base_tax, extra_wages, (wages * 145 + extra_wages * 90 + 5000) // 10000]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', [19294581, 2127366], [30847, 1421947, 43645]), ('regression', [20189609, 125208], [1816, 125208, 2943]), ('partial-repair probe', [2439490, 49414], [717, 0, 717]), ('partial-repair probe', [20723172, 31906], [463, 31906, 750]), ('boundary control', [20000000, 100000], [1450, 100000, 2350]), ('boundary control', [19950000, 100000], [1450, 50000, 1900]), ('normal control', [20158685, 407195], [5904, 407195, 9569]), ('normal control', [20518887, 2208012], [32016, 2208012, 51888]), ('normal control', [20000000, 1829965], [26534, 1829965, 43004]), ('normal control', [7554383, 209883], [3043, 0, 3043])], [('regression', [20189609, 125208], [1816, 125208, 2943]), ('regression', [20000000, 13601], [197, 13601, 319]), ('partial-repair probe', [20767841, 19138], [278, 19138, 450]), ('partial-repair probe', [20469014, 260626], [3779, 260626, 6125]), ('boundary control', [0, 0], [0, 0, 0]), ('boundary control', [25000000, 12345], [179, 12345, 290]), ('normal control', [8001356, 2662166], [38601, 0, 38601]), ('normal control', [19681988, 1173456], [17015, 855444, 24714]), ('normal control', [19655408, 1735735], [25168, 1391143, 37688]), ('normal control', [19686537, 15872], [230, 0, 230])], [('regression', [20164631, 554176], [8036, 554176, 13024]), ('regression', [20000000, 13601], [197, 13601, 319]), ('partial-repair probe', [23912137, 659488], [9563, 659488, 15498]), ('partial-repair probe', [21835663, 1842418], [26715, 1842418, 43297]), ('boundary control', [19999999, 1], [0, 0, 0]), ('boundary control', [20000000, 100000], [1450, 100000, 2350]), ('normal control', [3879860, 1040777], [15091, 0, 15091]), ('normal control', [4213397, 2332986], [33828, 0, 33828]), ('normal control', [20000000, 654261], [9487, 654261, 15375]), ('normal control', [20000000, 35595], [516, 35595, 836])], [('regression', [20333577, 41631], [604, 41631, 979]), ('regression', [20290634, 2600150], [37702, 2600150, 61103]), ('partial-repair probe', [19294581, 2127366], [30847, 1421947, 43645]), ('partial-repair probe', [20000000, 1204410], [17464, 1204410, 28304]), ('boundary control', [19950000, 100000], [1450, 50000, 1900]), ('boundary control', [0, 0], [0, 0, 0]), ('normal control', [4705614, 33884], [491, 0, 491]), ('normal control', [4401788, 1347616], [19540, 0, 19540]), ('normal control', [703223, 1018779], [14772, 0, 14772]), ('normal control', [916863, 25193], [365, 0, 365])], [('regression', [20000000, 2376741], [34463, 2376741, 55854]), ('regression', [18969228, 1480792], [21471, 450020, 25521]), ('partial-repair probe', [624582, 1378603], [19990, 0, 19990]), ('partial-repair probe', [19201069, 465833], [6755, 0, 6755]), ('boundary control', [25000000, 12345], [179, 12345, 290]), ('boundary control', [19999999, 1], [0, 0, 0]), ('normal control', [10176860, 61801], [896, 0, 896]), ('normal control', [20000000, 541335], [7849, 541335, 12721]), ('normal control', [20613452, 926054], [13428, 926054, 21762]), ('normal control', [20270374, 43541], [631, 43541, 1023])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression 0[30847, 1421947, 43644][30847, 1421947, 43645]Failed
regression 1[1816, 125208, 2942][1816, 125208, 2943]Failed
partial-repair probe 2[717, 0, 717][717, 0, 717]Passed
partial-repair probe 3[463, 31906, 750][463, 31906, 750]Passed
boundary control 4[1450, 100000, 2350][1450, 100000, 2350]Passed
boundary control 5[1450, 50000, 1900][1450, 50000, 1900]Passed
normal control 6[5904, 407195, 9569][5904, 407195, 9569]Passed
normal control 7[32016, 2208012, 51888][32016, 2208012, 51888]Passed
normal control 8[26534, 1829965, 43004][26534, 1829965, 43004]Passed
normal control 9[3043, 0, 3043][3043, 0, 3043]Passed

SHA-256 / baa38e7ce62e52e2f7d83eb4e63fdfdcca2ab8330826c3318c62fd1d7c6c7963

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    ytd, wages = x
    base_tax = (wages * 145 + 5000) // 10000
    over_before = max(0, ytd - 20000000)
    over_after = max(0, ytd + wages - 20000000)
    extra_wages = over_after - over_before
    extra = (extra_wages * 9 + 500) // 1000
    return [base_tax, extra_wages, (wages * 145 + extra_wages * 90) // 10000]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', [19294581, 2127366], [30847, 1421947, 43645]), ('regression', [20189609, 125208], [1816, 125208, 2943]), ('partial-repair probe', [2439490, 49414], [717, 0, 717]), ('partial-repair probe', [20723172, 31906], [463, 31906, 750]), ('boundary control', [20000000, 100000], [1450, 100000, 2350]), ('boundary control', [19950000, 100000], [1450, 50000, 1900]), ('normal control', [20158685, 407195], [5904, 407195, 9569]), ('normal control', [20518887, 2208012], [32016, 2208012, 51888]), ('normal control', [20000000, 1829965], [26534, 1829965, 43004]), ('normal control', [7554383, 209883], [3043, 0, 3043])], [('regression', [20189609, 125208], [1816, 125208, 2943]), ('regression', [20000000, 13601], [197, 13601, 319]), ('partial-repair probe', [20767841, 19138], [278, 19138, 450]), ('partial-repair probe', [20469014, 260626], [3779, 260626, 6125]), ('boundary control', [0, 0], [0, 0, 0]), ('boundary control', [25000000, 12345], [179, 12345, 290]), ('normal control', [8001356, 2662166], [38601, 0, 38601]), ('normal control', [19681988, 1173456], [17015, 855444, 24714]), ('normal control', [19655408, 1735735], [25168, 1391143, 37688]), ('normal control', [19686537, 15872], [230, 0, 230])], [('regression', [20164631, 554176], [8036, 554176, 13024]), ('regression', [20000000, 13601], [197, 13601, 319]), ('partial-repair probe', [23912137, 659488], [9563, 659488, 15498]), ('partial-repair probe', [21835663, 1842418], [26715, 1842418, 43297]), ('boundary control', [19999999, 1], [0, 0, 0]), ('boundary control', [20000000, 100000], [1450, 100000, 2350]), ('normal control', [3879860, 1040777], [15091, 0, 15091]), ('normal control', [4213397, 2332986], [33828, 0, 33828]), ('normal control', [20000000, 654261], [9487, 654261, 15375]), ('normal control', [20000000, 35595], [516, 35595, 836])], [('regression', [20333577, 41631], [604, 41631, 979]), ('regression', [20290634, 2600150], [37702, 2600150, 61103]), ('partial-repair probe', [19294581, 2127366], [30847, 1421947, 43645]), ('partial-repair probe', [20000000, 1204410], [17464, 1204410, 28304]), ('boundary control', [19950000, 100000], [1450, 50000, 1900]), ('boundary control', [0, 0], [0, 0, 0]), ('normal control', [4705614, 33884], [491, 0, 491]), ('normal control', [4401788, 1347616], [19540, 0, 19540]), ('normal control', [703223, 1018779], [14772, 0, 14772]), ('normal control', [916863, 25193], [365, 0, 365])], [('regression', [20000000, 2376741], [34463, 2376741, 55854]), ('regression', [18969228, 1480792], [21471, 450020, 25521]), ('partial-repair probe', [624582, 1378603], [19990, 0, 19990]), ('partial-repair probe', [19201069, 465833], [6755, 0, 6755]), ('boundary control', [25000000, 12345], [179, 12345, 290]), ('boundary control', [19999999, 1], [0, 0, 0]), ('normal control', [10176860, 61801], [896, 0, 896]), ('normal control', [20000000, 541335], [7849, 541335, 12721]), ('normal control', [20613452, 926054], [13428, 926054, 21762]), ('normal control', [20270374, 43541], [631, 43541, 1023])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression 0[30847, 1421947, 43644][30847, 1421947, 43645]Failed
regression 1[1816, 125208, 2942][1816, 125208, 2943]Failed
partial-repair probe 2[717, 0, 716][717, 0, 717]Failed
partial-repair probe 3[463, 31906, 749][463, 31906, 750]Failed
boundary control 4[1450, 100000, 2350][1450, 100000, 2350]Passed
boundary control 5[1450, 50000, 1900][1450, 50000, 1900]Passed
normal control 6[5904, 407195, 9569][5904, 407195, 9569]Passed
normal control 7[32016, 2208012, 51888][32016, 2208012, 51888]Passed
normal control 8[26534, 1829965, 43004][26534, 1829965, 43004]Passed
normal control 9[3043, 0, 3043][3043, 0, 3043]Passed

SHA-256 / dda0f7d5677b1edfe73b2ac5525fa1f4419cc483de415f254222f59b6624d336

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    ytd, wages = x
    base_tax = (wages * 145 + 5000) // 10000
    over_before = max(0, ytd - 20000000)
    over_after = max(0, ytd + wages - 20000000)
    extra_wages = over_after - over_before
    extra = (extra_wages * 9 + 500) // 1000
    return [base_tax, extra_wages, base_tax + extra]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', [19294581, 2127366], [30847, 1421947, 43645]), ('regression', [20189609, 125208], [1816, 125208, 2943]), ('partial-repair probe', [2439490, 49414], [717, 0, 717]), ('partial-repair probe', [20723172, 31906], [463, 31906, 750]), ('boundary control', [20000000, 100000], [1450, 100000, 2350]), ('boundary control', [19950000, 100000], [1450, 50000, 1900]), ('normal control', [20158685, 407195], [5904, 407195, 9569]), ('normal control', [20518887, 2208012], [32016, 2208012, 51888]), ('normal control', [20000000, 1829965], [26534, 1829965, 43004]), ('normal control', [7554383, 209883], [3043, 0, 3043])], [('regression', [20189609, 125208], [1816, 125208, 2943]), ('regression', [20000000, 13601], [197, 13601, 319]), ('partial-repair probe', [20767841, 19138], [278, 19138, 450]), ('partial-repair probe', [20469014, 260626], [3779, 260626, 6125]), ('boundary control', [0, 0], [0, 0, 0]), ('boundary control', [25000000, 12345], [179, 12345, 290]), ('normal control', [8001356, 2662166], [38601, 0, 38601]), ('normal control', [19681988, 1173456], [17015, 855444, 24714]), ('normal control', [19655408, 1735735], [25168, 1391143, 37688]), ('normal control', [19686537, 15872], [230, 0, 230])], [('regression', [20164631, 554176], [8036, 554176, 13024]), ('regression', [20000000, 13601], [197, 13601, 319]), ('partial-repair probe', [23912137, 659488], [9563, 659488, 15498]), ('partial-repair probe', [21835663, 1842418], [26715, 1842418, 43297]), ('boundary control', [19999999, 1], [0, 0, 0]), ('boundary control', [20000000, 100000], [1450, 100000, 2350]), ('normal control', [3879860, 1040777], [15091, 0, 15091]), ('normal control', [4213397, 2332986], [33828, 0, 33828]), ('normal control', [20000000, 654261], [9487, 654261, 15375]), ('normal control', [20000000, 35595], [516, 35595, 836])], [('regression', [20333577, 41631], [604, 41631, 979]), ('regression', [20290634, 2600150], [37702, 2600150, 61103]), ('partial-repair probe', [19294581, 2127366], [30847, 1421947, 43645]), ('partial-repair probe', [20000000, 1204410], [17464, 1204410, 28304]), ('boundary control', [19950000, 100000], [1450, 50000, 1900]), ('boundary control', [0, 0], [0, 0, 0]), ('normal control', [4705614, 33884], [491, 0, 491]), ('normal control', [4401788, 1347616], [19540, 0, 19540]), ('normal control', [703223, 1018779], [14772, 0, 14772]), ('normal control', [916863, 25193], [365, 0, 365])], [('regression', [20000000, 2376741], [34463, 2376741, 55854]), ('regression', [18969228, 1480792], [21471, 450020, 25521]), ('partial-repair probe', [624582, 1378603], [19990, 0, 19990]), ('partial-repair probe', [19201069, 465833], [6755, 0, 6755]), ('boundary control', [25000000, 12345], [179, 12345, 290]), ('boundary control', [19999999, 1], [0, 0, 0]), ('normal control', [10176860, 61801], [896, 0, 896]), ('normal control', [20000000, 541335], [7849, 541335, 12721]), ('normal control', [20613452, 926054], [13428, 926054, 21762]), ('normal control', [20270374, 43541], [631, 43541, 1023])]]
for i, (label, args, expected) in enumerate(fixtures[N-1]):
    check("%s %d" % (label, i), solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
regression 0[30847, 1421947, 43645][30847, 1421947, 43645]Passed
regression 1[1816, 125208, 2943][1816, 125208, 2943]Passed
partial-repair probe 2[717, 0, 717][717, 0, 717]Passed
partial-repair probe 3[463, 31906, 750][463, 31906, 750]Passed
boundary control 4[1450, 100000, 2350][1450, 100000, 2350]Passed
boundary control 5[1450, 50000, 1900][1450, 50000, 1900]Passed
normal control 6[5904, 407195, 9569][5904, 407195, 9569]Passed
normal control 7[32016, 2208012, 51888][32016, 2208012, 51888]Passed
normal control 8[26534, 1829965, 43004][26534, 1829965, 43004]Passed
normal control 9[3043, 0, 3043][3043, 0, 3043]Passed

SHA-256 / 88ce9a801341cd2ce432485eb3f07f0f09bc90af60d5b62174251bf974876b89

Verification & scope

A deterministic teaching model of a stipulated payroll rule with toy thresholds and rates. It makes no claim of conformance to any tax authority, statute or jurisdiction and is not payroll software. 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.

Observations recorded using Python 3.12.14 at 2026-09-29T14:46:30.848807+00:00.

Case digest / 7ac5a1765bae65fcd59fbe86ef8becfe4cc8e9cf1104e2c8704e6d787d3ba9ec