FA-59204 / Payroll withholding rules / Member archive
Multi-state wage allocation by work days: remainder ranking · case 04
Leftover cents go to the states with the most days instead of the largest fractional shares.
Case contract
Input {wage, days: {state: work days}, resident}. With zero total days all wages go to the resident state. Otherwise each state gets floor(wage*days/total); leftover cents go one each to states ranked by largest fractional remainder, ties by the base order (days descending, then state name). States allocated 0 cents are omitted. Return {state: cents}.
Why this case matters
State wage allocation must sum exactly to the paycheck with a deterministic remainder rule.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression 0 | {"NJ": 729888, "PA": 72988} | {"NJ": 729887, "PA": 72989} | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗