FA-62521 / Tax bracket computation / Open access
Tax-table amounts keep cents · case 01
Table lookups report cents although the table is in whole dollars.
ROOT CAUSE
The midpoint tax is rounded to cents rather than to whole dollars.
VERIFIED REPAIR
Round the midpoint tax half-up to whole dollars.
Unsuccessful approach: Truncating to whole dollars drops the half-dollar rounding.
Case contract
solve(income, brackets): stipulated tax-table lookup. income < 0 returns 0 and incomes below 5 have zero tax. For income < 100000 the tax is the progressive tax on the midpoint of the income's band, rounded half-up to whole dollars: bands are 25 wide below 3000 ([0,25), [25,50), ...) and 50 wide from 3000 ([3000,3050), ...). Incomes of 100000 or more use the exact progressive tax rounded half-up to cents. Return integer cents.
Why this case matters
Tax computations hinge on which slice, threshold, ordering and rounding rule applies at each step; a misplaced boundary silently misstates liabilities.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(income, brackets):
def prog(x, br):
tax, lower = Fraction(0), 0
for upper, rate in br:
top = x if upper is None else min(x, upper)
if top > lower: tax += (top - lower) * Fraction(rate) / 100
if upper is None or x <= upper: break
lower = upper
return tax
def cents(v):
v = v * 100
return int(v + Fraction(1, 2)) if v >= 0 else -int(-v + Fraction(1, 2))
if income < 5: return 0
if income >= 100000: return cents(prog(income, brackets))
w = 25 if income < 3000 else 50
lo = income // w * w
mid = lo + Fraction(w, 2)
return cents(prog(mid, brackets))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression table-dollar-rounding 1', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900),
('regression table-dollar-rounding 2', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
('control: ordinary', (12345, [[10000, '10'], [40000, '12'], [None, '22']]), 127900),
('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
('control: small', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100)],
[('regression table-dollar-rounding 1', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
('regression table-dollar-rounding 2', (40050, [[10000, '10'], [40000, '12'], [None, '22']]), 461700),
('partial repair guard 2', (576, [[10000, '10'], [40000, '12'], [None, '22']]), 5900),
('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
1739400),
('control: above cutoff', (100001, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
1740024)],
[('regression table-dollar-rounding 1', (576, [[10000, '10'], [40000, '12'], [None, '22']]), 5900),
('regression table-dollar-rounding 2', (603, [[10000, '10'], [40000, '12'], [None, '22']]), 6100),
('partial repair guard 1', (99999, [[10000, '10'], [40000, '12'], [None, '22']]), 1779500),
('partial repair guard 2', (2999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
29900),
('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
1739400),
('control: above cutoff', (100001, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
1740024),
('control: band edge', (40050, [[10000, '10'], [40000, '12'], [None, '22']]), 461700),
('control: last narrow band', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900)],
[('regression table-dollar-rounding 1',
(5, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]), 100),
('regression table-dollar-rounding 2', (99999, [[10000, '10'], [40000, '12'], [None, '22']]), 1779500),
('partial repair guard 1', (99975, [[10000, '10'], [40000, '12'], [None, '22']]), 1779500),
('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
30300),
('control: last narrow band', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900),
('control: first wide band', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
('control: ordinary', (12345, [[10000, '10'], [40000, '12'], [None, '22']]), 127900),
('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000)],
[('regression table-dollar-rounding 1',
(2999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]), 29900),
('regression table-dollar-rounding 2', (99975, [[10000, '10'], [40000, '12'], [None, '22']]), 1779500),
('partial repair guard 1', (3024, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
('partial repair guard 2', (1428, [[10000, '10'], [40000, '12'], [None, '22']]), 14400),
('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
('control: small', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
1739400)]]
for label, args, expected in cases[N - 1]:
check(label, 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 table-dollar-rounding 1 | 29875 | 29900 | Failed |
| regression table-dollar-rounding 2 | 30250 | 30300 | Failed |
| control: ordinary | 127900 | 127900 | Passed |
| control: table cutoff | 1780000 | 1780000 | Passed |
| control: tiny | 0 | 0 | Passed |
| control: small | 125 | 100 | Failed |
SHA-256 / 6a6fe9ddb10ffd099a5777bca5f54b0c6d2786a1dde5468c6c9ed414beab3d07
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(income, brackets):
def prog(x, br):
tax, lower = Fraction(0), 0
for upper, rate in br:
top = x if upper is None else min(x, upper)
if top > lower: tax += (top - lower) * Fraction(rate) / 100
if upper is None or x <= upper: break
lower = upper
return tax
def cents(v):
v = v * 100
return int(v + Fraction(1, 2)) if v >= 0 else -int(-v + Fraction(1, 2))
if income < 5: return 0
if income >= 100000: return cents(prog(income, brackets))
w = 25 if income < 3000 else 50
lo = income // w * w
mid = lo + Fraction(w, 2)
return int(prog(mid, brackets)) * 100
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression table-dollar-rounding 1', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900),
('regression table-dollar-rounding 2', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
('control: ordinary', (12345, [[10000, '10'], [40000, '12'], [None, '22']]), 127900),
('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
('control: small', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100)],
[('regression table-dollar-rounding 1', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
('regression table-dollar-rounding 2', (40050, [[10000, '10'], [40000, '12'], [None, '22']]), 461700),
('partial repair guard 2', (576, [[10000, '10'], [40000, '12'], [None, '22']]), 5900),
('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
1739400),
('control: above cutoff', (100001, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
1740024)],
[('regression table-dollar-rounding 1', (576, [[10000, '10'], [40000, '12'], [None, '22']]), 5900),
('regression table-dollar-rounding 2', (603, [[10000, '10'], [40000, '12'], [None, '22']]), 6100),
('partial repair guard 1', (99999, [[10000, '10'], [40000, '12'], [None, '22']]), 1779500),
('partial repair guard 2', (2999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
29900),
('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
1739400),
('control: above cutoff', (100001, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
1740024),
('control: band edge', (40050, [[10000, '10'], [40000, '12'], [None, '22']]), 461700),
('control: last narrow band', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900)],
[('regression table-dollar-rounding 1',
(5, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]), 100),
('regression table-dollar-rounding 2', (99999, [[10000, '10'], [40000, '12'], [None, '22']]), 1779500),
('partial repair guard 1', (99975, [[10000, '10'], [40000, '12'], [None, '22']]), 1779500),
('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
30300),
('control: last narrow band', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900),
('control: first wide band', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
('control: ordinary', (12345, [[10000, '10'], [40000, '12'], [None, '22']]), 127900),
('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000)],
[('regression table-dollar-rounding 1',
(2999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]), 29900),
('regression table-dollar-rounding 2', (99975, [[10000, '10'], [40000, '12'], [None, '22']]), 1779500),
('partial repair guard 1', (3024, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
('partial repair guard 2', (1428, [[10000, '10'], [40000, '12'], [None, '22']]), 14400),
('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
('control: small', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
1739400)]]
for label, args, expected in cases[N - 1]:
check(label, 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 table-dollar-rounding 1 | 29800 | 29900 | Failed |
| regression table-dollar-rounding 2 | 30200 | 30300 | Failed |
| control: ordinary | 127900 | 127900 | Passed |
| control: table cutoff | 1780000 | 1780000 | Passed |
| control: tiny | 0 | 0 | Passed |
| control: small | 100 | 100 | Passed |
SHA-256 / 1c78122aa10d9c2a029332dd10ae4a7eec8bd21be26f63d4693d02fe1fe80546
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(income, brackets):
def prog(x, br):
tax, lower = Fraction(0), 0
for upper, rate in br:
top = x if upper is None else min(x, upper)
if top > lower: tax += (top - lower) * Fraction(rate) / 100
if upper is None or x <= upper: break
lower = upper
return tax
def cents(v):
v = v * 100
return int(v + Fraction(1, 2)) if v >= 0 else -int(-v + Fraction(1, 2))
if income < 5: return 0
if income >= 100000: return cents(prog(income, brackets))
w = 25 if income < 3000 else 50
lo = income // w * w
mid = lo + Fraction(w, 2)
return int(prog(mid, brackets) + Fraction(1, 2)) * 100
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression table-dollar-rounding 1', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900),
('regression table-dollar-rounding 2', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
('control: ordinary', (12345, [[10000, '10'], [40000, '12'], [None, '22']]), 127900),
('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
('control: small', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100)],
[('regression table-dollar-rounding 1', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
('regression table-dollar-rounding 2', (40050, [[10000, '10'], [40000, '12'], [None, '22']]), 461700),
('partial repair guard 2', (576, [[10000, '10'], [40000, '12'], [None, '22']]), 5900),
('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
1739400),
('control: above cutoff', (100001, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
1740024)],
[('regression table-dollar-rounding 1', (576, [[10000, '10'], [40000, '12'], [None, '22']]), 5900),
('regression table-dollar-rounding 2', (603, [[10000, '10'], [40000, '12'], [None, '22']]), 6100),
('partial repair guard 1', (99999, [[10000, '10'], [40000, '12'], [None, '22']]), 1779500),
('partial repair guard 2', (2999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
29900),
('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
1739400),
('control: above cutoff', (100001, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
1740024),
('control: band edge', (40050, [[10000, '10'], [40000, '12'], [None, '22']]), 461700),
('control: last narrow band', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900)],
[('regression table-dollar-rounding 1',
(5, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]), 100),
('regression table-dollar-rounding 2', (99999, [[10000, '10'], [40000, '12'], [None, '22']]), 1779500),
('partial repair guard 1', (99975, [[10000, '10'], [40000, '12'], [None, '22']]), 1779500),
('partial repair guard 2', (3000, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
30300),
('control: last narrow band', (2999, [[10000, '10'], [40000, '12'], [None, '22']]), 29900),
('control: first wide band', (3000, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
('control: ordinary', (12345, [[10000, '10'], [40000, '12'], [None, '22']]), 127900),
('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000)],
[('regression table-dollar-rounding 1',
(2999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]), 29900),
('regression table-dollar-rounding 2', (99975, [[10000, '10'], [40000, '12'], [None, '22']]), 1779500),
('partial repair guard 1', (3024, [[10000, '10'], [40000, '12'], [None, '22']]), 30300),
('partial repair guard 2', (1428, [[10000, '10'], [40000, '12'], [None, '22']]), 14400),
('control: table cutoff', (100000, [[10000, '10'], [40000, '12'], [None, '22']]), 1780000),
('control: tiny', (4, [[10000, '10'], [40000, '12'], [None, '22']]), 0),
('control: small', (24, [[10000, '10'], [40000, '12'], [None, '22']]), 100),
('control: just under cutoff', (99999, [[11000, '10'], [44725, '12'], [95375, '22'], [182100, '24'], [None, '32.5']]),
1739400)]]
for label, args, expected in cases[N - 1]:
check(label, 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 table-dollar-rounding 1 | 29900 | 29900 | Passed |
| regression table-dollar-rounding 2 | 30300 | 30300 | Passed |
| control: ordinary | 127900 | 127900 | Passed |
| control: table cutoff | 1780000 | 1780000 | Passed |
| control: tiny | 0 | 0 | Passed |
| control: small | 100 | 100 | Passed |
SHA-256 / 62f1fe2ac223fa05b792ca1275a03151f46cada465425f12a4c8265618e0c90f
Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:47:05.317832+00:00.
Case digest / fccd0dff0cf6952fd1ef742a8bf790bf936bf7731678e261ea0346cf5272d0df