FAILURE MAP
← Case archive

FA-62606 / Tax bracket computation / Open access

The liability is rounded to the nearest pound instead of down · case 01

Some liabilities are one pound higher than stipulated.

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

ROOT CAUSE

The pence total is rounded half-up to pounds.

VERIFIED REPAIR

Round down to whole pounds.

Unsuccessful approach: Rounding up to whole pounds overcharges every liability with pence.

Case contract

solve(price, ftb, additional, nonresident): stipulated property transfer tax in whole pounds. Normal slices: 0% to 250000, 5% to 925000, 10% to 1500000, 12% above. First-time-buyer slices (0% to 425000, 5% to 625000) apply only when ftb is true, the purchase is not an additional dwelling, and price <= 625000; otherwise normal slices. Surcharges add percentage points to every slice including 0% slices: +3 for an additional dwelling when price >= 40000, +2 for a non-resident buyer; they stack. Return the tax rounded down to whole pounds.

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

N = 1
observations = []
def solve(price, ftb, additional, nonresident):
    normal = [(250000, 0), (925000, 5), (1500000, 10), (None, 12)]
    first = [(425000, 0), (625000, 5)]
    use_ftb = ftb and not additional and price <= 625000
    bands = first if use_ftb else normal
    sur = (3 if additional and price >= 40000 else 0) + (2 if nonresident else 0)
    tax, lower = 0, 0
    for upper, rate in bands:
        top = price if upper is None else min(price, upper)
        if top > lower: tax += (top - lower) * (rate + sur)
        if upper is None or price <= upper: break
        lower = upper
    return (tax + 50) // 100
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression round-down-pounds 1', (250013, False, False, False), 0),
  ('regression round-down-pounds 2', (250019, False, False, False), 0),
  ('control: normal', (300000, False, False, False), 2500),
  ('control: first-time buyer', (500000, True, False, False), 3750),
  ('control: ftb at cap', (625000, True, False, False), 10000),
  ('control: ftb over cap', (625001, True, False, False), 18750)],
 [('regression round-down-pounds 1', (39999, False, False, True), 799),
  ('regression round-down-pounds 2', (919321, True, True, False), 61045),
  ('partial repair guard 1', (625001, True, False, False), 18750),
  ('control: additional dwelling', (300000, False, True, False), 11500),
  ('control: additional nonresident', (300000, False, True, True), 17500),
  ('control: below surcharge floor', (39999, False, True, False), 0),
  ('control: ftb additional', (400000, True, True, False), 19500)],
 [('regression round-down-pounds 1', (575918, True, False, False), 7545),
  ('regression round-down-pounds 2', (628677, True, True, True), 50367),
  ('partial repair guard 1', (625001, True, True, False), 37500),
  ('partial repair guard 2', (919321, True, True, False), 61045),
  ('control: below surcharge floor', (39999, False, True, False), 0),
  ('control: nonresident cheap', (39999, False, False, True), 799),
  ('control: ftb additional', (400000, True, True, False), 19500),
  ('control: expensive', (2000000, False, False, False), 151250)],
 [('regression round-down-pounds 1', (665697, False, False, False), 20784),
  ('regression round-down-pounds 2', (330173, False, False, False), 4008),
  ('partial repair guard 1', (250001, False, False, False), 0),
  ('partial repair guard 2', (625001, False, False, False), 18750),
  ('control: expensive', (2000000, False, False, False), 151250),
  ('control: odd pounds', (250013, False, False, False), 0), ('control: normal', (300000, False, False, False), 2500),
  ('control: first-time buyer', (500000, True, False, False), 3750)],
 [('regression round-down-pounds 1', (1296206, False, True, False), 109756),
  ('regression round-down-pounds 2', (558699, True, False, False), 6684),
  ('partial repair guard 1', (250001, True, False, True), 5000),
  ('partial repair guard 2', (2087334, True, False, False), 161730),
  ('control: first-time buyer', (500000, True, False, False), 3750),
  ('control: ftb at cap', (625000, True, False, False), 10000),
  ('control: ftb over cap', (625001, True, False, False), 18750),
  ('control: additional dwelling', (300000, False, True, False), 11500)]]
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 fixtureActualExpectedOutcome
regression round-down-pounds 110Failed
regression round-down-pounds 210Failed
control: normal25002500Passed
control: first-time buyer37503750Passed
control: ftb at cap1000010000Passed
control: ftb over cap1875018750Passed

SHA-256 / 91b630b6bb01ace20231278d4c60b6a47a547a881091ce1cedc4dcc642a3b24a

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(price, ftb, additional, nonresident):
    normal = [(250000, 0), (925000, 5), (1500000, 10), (None, 12)]
    first = [(425000, 0), (625000, 5)]
    use_ftb = ftb and not additional and price <= 625000
    bands = first if use_ftb else normal
    sur = (3 if additional and price >= 40000 else 0) + (2 if nonresident else 0)
    tax, lower = 0, 0
    for upper, rate in bands:
        top = price if upper is None else min(price, upper)
        if top > lower: tax += (top - lower) * (rate + sur)
        if upper is None or price <= upper: break
        lower = upper
    return -(-tax // 100)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression round-down-pounds 1', (250013, False, False, False), 0),
  ('regression round-down-pounds 2', (250019, False, False, False), 0),
  ('control: normal', (300000, False, False, False), 2500),
  ('control: first-time buyer', (500000, True, False, False), 3750),
  ('control: ftb at cap', (625000, True, False, False), 10000),
  ('control: ftb over cap', (625001, True, False, False), 18750)],
 [('regression round-down-pounds 1', (39999, False, False, True), 799),
  ('regression round-down-pounds 2', (919321, True, True, False), 61045),
  ('partial repair guard 1', (625001, True, False, False), 18750),
  ('control: additional dwelling', (300000, False, True, False), 11500),
  ('control: additional nonresident', (300000, False, True, True), 17500),
  ('control: below surcharge floor', (39999, False, True, False), 0),
  ('control: ftb additional', (400000, True, True, False), 19500)],
 [('regression round-down-pounds 1', (575918, True, False, False), 7545),
  ('regression round-down-pounds 2', (628677, True, True, True), 50367),
  ('partial repair guard 1', (625001, True, True, False), 37500),
  ('partial repair guard 2', (919321, True, True, False), 61045),
  ('control: below surcharge floor', (39999, False, True, False), 0),
  ('control: nonresident cheap', (39999, False, False, True), 799),
  ('control: ftb additional', (400000, True, True, False), 19500),
  ('control: expensive', (2000000, False, False, False), 151250)],
 [('regression round-down-pounds 1', (665697, False, False, False), 20784),
  ('regression round-down-pounds 2', (330173, False, False, False), 4008),
  ('partial repair guard 1', (250001, False, False, False), 0),
  ('partial repair guard 2', (625001, False, False, False), 18750),
  ('control: expensive', (2000000, False, False, False), 151250),
  ('control: odd pounds', (250013, False, False, False), 0), ('control: normal', (300000, False, False, False), 2500),
  ('control: first-time buyer', (500000, True, False, False), 3750)],
 [('regression round-down-pounds 1', (1296206, False, True, False), 109756),
  ('regression round-down-pounds 2', (558699, True, False, False), 6684),
  ('partial repair guard 1', (250001, True, False, True), 5000),
  ('partial repair guard 2', (2087334, True, False, False), 161730),
  ('control: first-time buyer', (500000, True, False, False), 3750),
  ('control: ftb at cap', (625000, True, False, False), 10000),
  ('control: ftb over cap', (625001, True, False, False), 18750),
  ('control: additional dwelling', (300000, False, True, False), 11500)]]
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 fixtureActualExpectedOutcome
regression round-down-pounds 110Failed
regression round-down-pounds 210Failed
control: normal25002500Passed
control: first-time buyer37503750Passed
control: ftb at cap1000010000Passed
control: ftb over cap1875118750Failed

SHA-256 / 809349deec6c4e8fff8c3cc3dc008f73ae7cdc685ba9c01d0d26d0b8e0979b12

3 / The verified repair

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

N = 1
observations = []
def solve(price, ftb, additional, nonresident):
    normal = [(250000, 0), (925000, 5), (1500000, 10), (None, 12)]
    first = [(425000, 0), (625000, 5)]
    use_ftb = ftb and not additional and price <= 625000
    bands = first if use_ftb else normal
    sur = (3 if additional and price >= 40000 else 0) + (2 if nonresident else 0)
    tax, lower = 0, 0
    for upper, rate in bands:
        top = price if upper is None else min(price, upper)
        if top > lower: tax += (top - lower) * (rate + sur)
        if upper is None or price <= upper: break
        lower = upper
    return tax // 100
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression round-down-pounds 1', (250013, False, False, False), 0),
  ('regression round-down-pounds 2', (250019, False, False, False), 0),
  ('control: normal', (300000, False, False, False), 2500),
  ('control: first-time buyer', (500000, True, False, False), 3750),
  ('control: ftb at cap', (625000, True, False, False), 10000),
  ('control: ftb over cap', (625001, True, False, False), 18750)],
 [('regression round-down-pounds 1', (39999, False, False, True), 799),
  ('regression round-down-pounds 2', (919321, True, True, False), 61045),
  ('partial repair guard 1', (625001, True, False, False), 18750),
  ('control: additional dwelling', (300000, False, True, False), 11500),
  ('control: additional nonresident', (300000, False, True, True), 17500),
  ('control: below surcharge floor', (39999, False, True, False), 0),
  ('control: ftb additional', (400000, True, True, False), 19500)],
 [('regression round-down-pounds 1', (575918, True, False, False), 7545),
  ('regression round-down-pounds 2', (628677, True, True, True), 50367),
  ('partial repair guard 1', (625001, True, True, False), 37500),
  ('partial repair guard 2', (919321, True, True, False), 61045),
  ('control: below surcharge floor', (39999, False, True, False), 0),
  ('control: nonresident cheap', (39999, False, False, True), 799),
  ('control: ftb additional', (400000, True, True, False), 19500),
  ('control: expensive', (2000000, False, False, False), 151250)],
 [('regression round-down-pounds 1', (665697, False, False, False), 20784),
  ('regression round-down-pounds 2', (330173, False, False, False), 4008),
  ('partial repair guard 1', (250001, False, False, False), 0),
  ('partial repair guard 2', (625001, False, False, False), 18750),
  ('control: expensive', (2000000, False, False, False), 151250),
  ('control: odd pounds', (250013, False, False, False), 0), ('control: normal', (300000, False, False, False), 2500),
  ('control: first-time buyer', (500000, True, False, False), 3750)],
 [('regression round-down-pounds 1', (1296206, False, True, False), 109756),
  ('regression round-down-pounds 2', (558699, True, False, False), 6684),
  ('partial repair guard 1', (250001, True, False, True), 5000),
  ('partial repair guard 2', (2087334, True, False, False), 161730),
  ('control: first-time buyer', (500000, True, False, False), 3750),
  ('control: ftb at cap', (625000, True, False, False), 10000),
  ('control: ftb over cap', (625001, True, False, False), 18750),
  ('control: additional dwelling', (300000, False, True, False), 11500)]]
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 fixtureActualExpectedOutcome
regression round-down-pounds 100Passed
regression round-down-pounds 200Passed
control: normal25002500Passed
control: first-time buyer37503750Passed
control: ftb at cap1000010000Passed
control: ftb over cap1875018750Passed

SHA-256 / 0e15fef4e872ffdc4d422f13a3040cd37174c8ef6b1e9e1d162c1feeaa5942c0

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:06.201972+00:00.

Case digest / a21ff95142026c8fe09ec99755bf47184b1e7a5c3f82cb88cedc95932cde4a02