FA-58996 / Payroll withholding rules / Open access
Overtime regular rate with bonuses and differentials: regular rate divisor · case 01
Employees working long weeks receive an inflated overtime premium.
ROOT CAUSE
The regular rate divides total straight-time compensation by 40 instead of by all hours worked.
THE FAILURE
The regular rate divides total straight-time compensation by 40 instead of by all hours worked.
Unsuccessful approach: The attempt divides by hours plus overtime hours, understating the regular rate.
Case contract
Input weekly {hours, rate, bonus, discretionary, diff_hours, diff}. Straight pay = hours*rate + diff_hours*diff. Regular rate = (straight pay + bonus unless discretionary) / hours. Overtime premium = regular rate * max(0, hours-40) / 2, rounded half-up to the cent. Total = straight pay + bonus + premium. Zero hours returns [0, bonus]. Return [premium, total].
Why this case matters
Nondiscretionary bonuses and shift differentials raise the regular rate, and only a half-time premium is owed on top of straight-time pay.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(x):
h = x['hours']
base = h * x['rate'] + x['diff_hours'] * x['diff']
included = base + (0 if x['discretionary'] else x['bonus'])
if h == 0:
return [0, x['bonus']]
ot = max(0, h - 40)
rr = Fraction(included, 40)
premium = rr * ot / 2
prem_c = math.floor(premium + Fraction(1, 2))
total = base + x['bonus'] + prem_c
return [prem_c, total]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'hours': 56, 'rate': 2894, 'bonus': 0, 'discretionary': True, 'diff_hours': 20, 'diff': 189}, [23692, 189536]), ('regression', {'hours': 48, 'rate': 2361, 'bonus': 0, 'discretionary': False, 'diff_hours': 15, 'diff': 150}, [9632, 125210]), ('partial-repair probe', {'hours': 45, 'rate': 1070, 'bonus': 6593, 'discretionary': True, 'diff_hours': 3, 'diff': 100}, [2692, 57735]), ('partial-repair probe', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('normal control', {'hours': 29, 'rate': 3185, 'bonus': 18960, 'discretionary': True, 'diff_hours': 0, 'diff': 235}, [0, 111325]), ('normal control', {'hours': 15, 'rate': 1913, 'bonus': 0, 'discretionary': False, 'diff_hours': 3, 'diff': 100}, [0, 28995]), ('normal control', {'hours': 36, 'rate': 1564, 'bonus': 12440, 'discretionary': False, 'diff_hours': 0, 'diff': 150}, [0, 68744]), ('normal control', {'hours': 36, 'rate': 3124, 'bonus': 20788, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 133252])], [('regression', {'hours': 48, 'rate': 2361, 'bonus': 0, 'discretionary': False, 'diff_hours': 15, 'diff': 150}, [9632, 125210]), ('regression', {'hours': 45, 'rate': 1070, 'bonus': 6593, 'discretionary': True, 'diff_hours': 3, 'diff': 100}, [2692, 57735]), ('partial-repair probe', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('partial-repair probe', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('normal control', {'hours': 38, 'rate': 3803, 'bonus': 0, 'discretionary': False, 'diff_hours': 5, 'diff': 175}, [0, 145389]), ('normal control', {'hours': 40, 'rate': 2368, 'bonus': 0, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 94720]), ('normal control', {'hours': 15, 'rate': 1275, 'bonus': 16297, 'discretionary': False, 'diff_hours': 0, 'diff': 100}, [0, 35422]), ('normal control', {'hours': 0, 'rate': 1235, 'bonus': 452, 'discretionary': False, 'diff_hours': 15, 'diff': 0}, [0, 452])], [('regression', {'hours': 45, 'rate': 1070, 'bonus': 6593, 'discretionary': True, 'diff_hours': 3, 'diff': 100}, [2692, 57735]), ('regression', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('partial-repair probe', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('partial-repair probe', {'hours': 42, 'rate': 2619, 'bonus': 0, 'discretionary': False, 'diff_hours': 0, 'diff': 150}, [2619, 112617]), ('normal control', {'hours': 25, 'rate': 2784, 'bonus': 431, 'discretionary': False, 'diff_hours': 0, 'diff': 150}, [0, 70031]), ('normal control', {'hours': 4, 'rate': 2630, 'bonus': 24821, 'discretionary': False, 'diff_hours': 10, 'diff': 100}, [0, 36341]), ('normal control', {'hours': 36, 'rate': 3824, 'bonus': 0, 'discretionary': False, 'diff_hours': 12, 'diff': 100}, [0, 138864]), ('normal control', {'hours': 36, 'rate': 3363, 'bonus': 0, 'discretionary': True, 'diff_hours': 0, 'diff': 0}, [0, 121068])], [('regression', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('regression', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('partial-repair probe', {'hours': 42, 'rate': 1092, 'bonus': 0, 'discretionary': False, 'diff_hours': 2, 'diff': 157}, [1099, 47277]), ('partial-repair probe', {'hours': 41, 'rate': 1051, 'bonus': 26, 'discretionary': False, 'diff_hours': 0, 'diff': 259}, [526, 43643]), ('normal control', {'hours': 25, 'rate': 1555, 'bonus': 17670, 'discretionary': True, 'diff_hours': 0, 'diff': 150}, [0, 56545]), ('normal control', {'hours': 13, 'rate': 3420, 'bonus': 0, 'discretionary': True, 'diff_hours': 0, 'diff': 150}, [0, 44460]), ('normal control', {'hours': 17, 'rate': 3366, 'bonus': 396, 'discretionary': True, 'diff_hours': 8, 'diff': 0}, [0, 57618]), ('normal control', {'hours': 1, 'rate': 1458, 'bonus': 0, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 1458])], [('regression', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('regression', {'hours': 42, 'rate': 2619, 'bonus': 0, 'discretionary': False, 'diff_hours': 0, 'diff': 150}, [2619, 112617]), ('partial-repair probe', {'hours': 41, 'rate': 1070, 'bonus': 0, 'discretionary': False, 'diff_hours': 14, 'diff': 300}, [586, 48656]), ('partial-repair probe', {'hours': 49, 'rate': 2740, 'bonus': 1615, 'discretionary': True, 'diff_hours': 20, 'diff': 0}, [12330, 148205]), ('normal control', {'hours': 40, 'rate': 2719, 'bonus': 0, 'discretionary': False, 'diff_hours': 13, 'diff': 100}, [0, 110060]), ('normal control', {'hours': 32, 'rate': 3242, 'bonus': 990, 'discretionary': True, 'diff_hours': 0, 'diff': 48}, [0, 104734]), ('normal control', {'hours': 23, 'rate': 2339, 'bonus': 720, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 54517]), ('normal control', {'hours': 22, 'rate': 2030, 'bonus': 44512, 'discretionary': False, 'diff_hours': 13, 'diff': 183}, [0, 91551])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 0 | [33169, 199013] | [23692, 189536] | Failed |
| regression 1 | [11558, 127136] | [9632, 125210] | Failed |
| partial-repair probe 2 | [3028, 58071] | [2692, 57735] | Failed |
| partial-repair probe 3 | [55972, 279860] | [37315, 261203] | Failed |
| normal control 4 | [0, 111325] | [0, 111325] | Passed |
| normal control 5 | [0, 28995] | [0, 28995] | Passed |
| normal control 6 | [0, 68744] | [0, 68744] | Passed |
| normal control 7 | [0, 133252] | [0, 133252] | Passed |
SHA-256 / 319e68e7975f301b7e48455236bc66ca7387957dba9da10ce31c045b0c285f43
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(x):
h = x['hours']
base = h * x['rate'] + x['diff_hours'] * x['diff']
included = base + (0 if x['discretionary'] else x['bonus'])
if h == 0:
return [0, x['bonus']]
ot = max(0, h - 40)
rr = Fraction(included, h + ot)
premium = rr * ot / 2
prem_c = math.floor(premium + Fraction(1, 2))
total = base + x['bonus'] + prem_c
return [prem_c, total]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression', {'hours': 56, 'rate': 2894, 'bonus': 0, 'discretionary': True, 'diff_hours': 20, 'diff': 189}, [23692, 189536]), ('regression', {'hours': 48, 'rate': 2361, 'bonus': 0, 'discretionary': False, 'diff_hours': 15, 'diff': 150}, [9632, 125210]), ('partial-repair probe', {'hours': 45, 'rate': 1070, 'bonus': 6593, 'discretionary': True, 'diff_hours': 3, 'diff': 100}, [2692, 57735]), ('partial-repair probe', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('normal control', {'hours': 29, 'rate': 3185, 'bonus': 18960, 'discretionary': True, 'diff_hours': 0, 'diff': 235}, [0, 111325]), ('normal control', {'hours': 15, 'rate': 1913, 'bonus': 0, 'discretionary': False, 'diff_hours': 3, 'diff': 100}, [0, 28995]), ('normal control', {'hours': 36, 'rate': 1564, 'bonus': 12440, 'discretionary': False, 'diff_hours': 0, 'diff': 150}, [0, 68744]), ('normal control', {'hours': 36, 'rate': 3124, 'bonus': 20788, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 133252])], [('regression', {'hours': 48, 'rate': 2361, 'bonus': 0, 'discretionary': False, 'diff_hours': 15, 'diff': 150}, [9632, 125210]), ('regression', {'hours': 45, 'rate': 1070, 'bonus': 6593, 'discretionary': True, 'diff_hours': 3, 'diff': 100}, [2692, 57735]), ('partial-repair probe', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('partial-repair probe', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('normal control', {'hours': 38, 'rate': 3803, 'bonus': 0, 'discretionary': False, 'diff_hours': 5, 'diff': 175}, [0, 145389]), ('normal control', {'hours': 40, 'rate': 2368, 'bonus': 0, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 94720]), ('normal control', {'hours': 15, 'rate': 1275, 'bonus': 16297, 'discretionary': False, 'diff_hours': 0, 'diff': 100}, [0, 35422]), ('normal control', {'hours': 0, 'rate': 1235, 'bonus': 452, 'discretionary': False, 'diff_hours': 15, 'diff': 0}, [0, 452])], [('regression', {'hours': 45, 'rate': 1070, 'bonus': 6593, 'discretionary': True, 'diff_hours': 3, 'diff': 100}, [2692, 57735]), ('regression', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('partial-repair probe', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('partial-repair probe', {'hours': 42, 'rate': 2619, 'bonus': 0, 'discretionary': False, 'diff_hours': 0, 'diff': 150}, [2619, 112617]), ('normal control', {'hours': 25, 'rate': 2784, 'bonus': 431, 'discretionary': False, 'diff_hours': 0, 'diff': 150}, [0, 70031]), ('normal control', {'hours': 4, 'rate': 2630, 'bonus': 24821, 'discretionary': False, 'diff_hours': 10, 'diff': 100}, [0, 36341]), ('normal control', {'hours': 36, 'rate': 3824, 'bonus': 0, 'discretionary': False, 'diff_hours': 12, 'diff': 100}, [0, 138864]), ('normal control', {'hours': 36, 'rate': 3363, 'bonus': 0, 'discretionary': True, 'diff_hours': 0, 'diff': 0}, [0, 121068])], [('regression', {'hours': 60, 'rate': 3726, 'bonus': 328, 'discretionary': False, 'diff_hours': 13, 'diff': 0}, [37315, 261203]), ('regression', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('partial-repair probe', {'hours': 42, 'rate': 1092, 'bonus': 0, 'discretionary': False, 'diff_hours': 2, 'diff': 157}, [1099, 47277]), ('partial-repair probe', {'hours': 41, 'rate': 1051, 'bonus': 26, 'discretionary': False, 'diff_hours': 0, 'diff': 259}, [526, 43643]), ('normal control', {'hours': 25, 'rate': 1555, 'bonus': 17670, 'discretionary': True, 'diff_hours': 0, 'diff': 150}, [0, 56545]), ('normal control', {'hours': 13, 'rate': 3420, 'bonus': 0, 'discretionary': True, 'diff_hours': 0, 'diff': 150}, [0, 44460]), ('normal control', {'hours': 17, 'rate': 3366, 'bonus': 396, 'discretionary': True, 'diff_hours': 8, 'diff': 0}, [0, 57618]), ('normal control', {'hours': 1, 'rate': 1458, 'bonus': 0, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 1458])], [('regression', {'hours': 51, 'rate': 1430, 'bonus': 583, 'discretionary': True, 'diff_hours': 17, 'diff': 212}, [8254, 85371]), ('regression', {'hours': 42, 'rate': 2619, 'bonus': 0, 'discretionary': False, 'diff_hours': 0, 'diff': 150}, [2619, 112617]), ('partial-repair probe', {'hours': 41, 'rate': 1070, 'bonus': 0, 'discretionary': False, 'diff_hours': 14, 'diff': 300}, [586, 48656]), ('partial-repair probe', {'hours': 49, 'rate': 2740, 'bonus': 1615, 'discretionary': True, 'diff_hours': 20, 'diff': 0}, [12330, 148205]), ('normal control', {'hours': 40, 'rate': 2719, 'bonus': 0, 'discretionary': False, 'diff_hours': 13, 'diff': 100}, [0, 110060]), ('normal control', {'hours': 32, 'rate': 3242, 'bonus': 990, 'discretionary': True, 'diff_hours': 0, 'diff': 48}, [0, 104734]), ('normal control', {'hours': 23, 'rate': 2339, 'bonus': 720, 'discretionary': False, 'diff_hours': 0, 'diff': 0}, [0, 54517]), ('normal control', {'hours': 22, 'rate': 2030, 'bonus': 44512, 'discretionary': False, 'diff_hours': 13, 'diff': 183}, [0, 91551])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 0 | [18427, 184271] | [23692, 189536] | Failed |
| regression 1 | [8256, 123834] | [9632, 125210] | Failed |
| partial-repair probe 2 | [2423, 57466] | [2692, 57735] | Failed |
| partial-repair probe 3 | [27986, 251874] | [37315, 261203] | Failed |
| normal control 4 | [0, 111325] | [0, 111325] | Passed |
| normal control 5 | [0, 28995] | [0, 28995] | Passed |
| normal control 6 | [0, 68744] | [0, 68744] | Passed |
| normal control 7 | [0, 133252] | [0, 133252] | Passed |
SHA-256 / 0c0460869c7534f9ff0d098dcd180e6aefd5940827f37c2543b7ea7efcde0798
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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:32.079870+00:00.
Case digest / 280f2d0e5a0afd67fab5f7e27eeeb2796e4915e3a3058cebad6312701a1d7863