FAILURE MAP
← Case archive

FA-62591 / Tax bracket computation / Open access

Exempt dividends are ignored when choosing the rate band · case 01

A company whose dividends lift it above the limit keeps small-profits treatment.

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

ROOT CAUSE

The band test uses taxable profits instead of augmented profits.

VERIFIED REPAIR

Use A = profits + dividends for the band test and the relief fraction.

Unsuccessful approach: Using A for the band but dropping the N/A factor over-relieves companies with dividends.

Case contract

solve(profits, dividends, associates, days): stipulated small-profits relief. Limits L = 50000 and U = 250000 are divided by (associates + 1) and prorated by days/365 (exact fractions). Augmented profits A = profits + dividends decide the band: A <= L taxes profits N at 19%; A >= U at 25%; otherwise tax = 25% of N minus 3/200 * (U - A) * N / A. Return integer cents rounded half-up.

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(profits, dividends, associates, days):
    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))
    
    div = associates + 1
    L = Fraction(50000 * days, 365 * div)
    U = Fraction(250000 * days, 365 * div)
    A = profits
    N = Fraction(profits)
    if A <= L: tax = N * 19 / 100
    elif A >= U: tax = N * 25 / 100
    else: tax = N * 25 / 100 - Fraction(3, 200) * (U - A) * N / A
    return cents(tax)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression augmented-profits 1', (100000, 25000, 0, 365), 2350000),
  ('regression augmented-profits 2', (200000, 60000, 0, 365), 5000000),
  ('partial repair guard 2', (100000, 5000, 1, 365), 2471429), ('control: small profits', (40000, 0, 0, 365), 760000),
  ('control: relief zone', (100000, 0, 0, 365), 2275000), ('control: main rate', (300000, 0, 0, 365), 7500000),
  ('control: associated company', (60000, 0, 1, 365), 1402500)],
 [('regression augmented-profits 1', (100000, 5000, 1, 365), 2471429),
  ('regression augmented-profits 2', (50000, 25000, 0, 365), 1075000), ('partial repair guard 1', (0, 5000, 4, 181), 0),
  ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000), ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000)],
 [('regression augmented-profits 1', (100000, 5000, 0, 300), 2356458),
  ('regression augmented-profits 2', (50000, 60000, 0, 365), 1154545),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000),
  ('control: small profits', (40000, 0, 0, 365), 760000), ('control: relief zone', (100000, 0, 0, 365), 2275000)],
 [('regression augmented-profits 1', (30000, 5000, 0, 200), 618875),
  ('regression augmented-profits 2', (30000, 25000, 4, 365), 750000), ('partial repair guard 1', (0, 25000, 0, 181), 0),
  ('control: relief zone', (100000, 0, 0, 365), 2275000), ('control: main rate', (300000, 0, 0, 365), 7500000),
  ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000)],
 [('regression augmented-profits 1', (50000, 60000, 0, 90), 1250000),
  ('regression augmented-profits 2', (50000, 5000, 0, 300), 1044801),
  ('partial repair guard 2', (180000, 60000, 0, 365), 4488750),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000), ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000)]]
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 augmented-profits 122750002350000Failed
regression augmented-profits 249250005000000Failed
partial repair guard 224625002471429Failed
control: small profits760000760000Passed
control: relief zone22750002275000Passed
control: main rate75000007500000Passed
control: associated company14025001402500Passed

SHA-256 / 5e5f5346f6a136a379b928048435a1d6253bd36598756bfe697ffcd7c2e60a57

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(profits, dividends, associates, days):
    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))
    
    div = associates + 1
    L = Fraction(50000 * days, 365 * div)
    U = Fraction(250000 * days, 365 * div)
    A = profits + dividends
    N = Fraction(profits)
    if A <= L: tax = N * 19 / 100
    elif A >= U: tax = N * 25 / 100
    else: tax = N * 25 / 100 - Fraction(3, 200) * (U - A)
    return cents(tax)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression augmented-profits 1', (100000, 25000, 0, 365), 2350000),
  ('regression augmented-profits 2', (200000, 60000, 0, 365), 5000000),
  ('partial repair guard 2', (100000, 5000, 1, 365), 2471429), ('control: small profits', (40000, 0, 0, 365), 760000),
  ('control: relief zone', (100000, 0, 0, 365), 2275000), ('control: main rate', (300000, 0, 0, 365), 7500000),
  ('control: associated company', (60000, 0, 1, 365), 1402500)],
 [('regression augmented-profits 1', (100000, 5000, 1, 365), 2471429),
  ('regression augmented-profits 2', (50000, 25000, 0, 365), 1075000), ('partial repair guard 1', (0, 5000, 4, 181), 0),
  ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000), ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000)],
 [('regression augmented-profits 1', (100000, 5000, 0, 300), 2356458),
  ('regression augmented-profits 2', (50000, 60000, 0, 365), 1154545),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000),
  ('control: small profits', (40000, 0, 0, 365), 760000), ('control: relief zone', (100000, 0, 0, 365), 2275000)],
 [('regression augmented-profits 1', (30000, 5000, 0, 200), 618875),
  ('regression augmented-profits 2', (30000, 25000, 4, 365), 750000), ('partial repair guard 1', (0, 25000, 0, 181), 0),
  ('control: relief zone', (100000, 0, 0, 365), 2275000), ('control: main rate', (300000, 0, 0, 365), 7500000),
  ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000)],
 [('regression augmented-profits 1', (50000, 60000, 0, 90), 1250000),
  ('regression augmented-profits 2', (50000, 5000, 0, 300), 1044801),
  ('partial repair guard 2', (180000, 60000, 0, 365), 4488750),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000), ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000)]]
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 augmented-profits 123125002350000Failed
regression augmented-profits 250000005000000Passed
partial repair guard 224700002471429Failed
control: small profits760000760000Passed
control: relief zone22750002275000Passed
control: main rate75000007500000Passed
control: associated company14025001402500Passed

SHA-256 / 98ff8a122f035eef523d8b809c19d643db704f2ba1d70bed9a0d86382f8a12b0

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(profits, dividends, associates, days):
    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))
    
    div = associates + 1
    L = Fraction(50000 * days, 365 * div)
    U = Fraction(250000 * days, 365 * div)
    A = profits + dividends
    N = Fraction(profits)
    if A <= L: tax = N * 19 / 100
    elif A >= U: tax = N * 25 / 100
    else: tax = N * 25 / 100 - Fraction(3, 200) * (U - A) * N / A
    return cents(tax)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[('regression augmented-profits 1', (100000, 25000, 0, 365), 2350000),
  ('regression augmented-profits 2', (200000, 60000, 0, 365), 5000000),
  ('partial repair guard 2', (100000, 5000, 1, 365), 2471429), ('control: small profits', (40000, 0, 0, 365), 760000),
  ('control: relief zone', (100000, 0, 0, 365), 2275000), ('control: main rate', (300000, 0, 0, 365), 7500000),
  ('control: associated company', (60000, 0, 1, 365), 1402500)],
 [('regression augmented-profits 1', (100000, 5000, 1, 365), 2471429),
  ('regression augmented-profits 2', (50000, 25000, 0, 365), 1075000), ('partial repair guard 1', (0, 5000, 4, 181), 0),
  ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000), ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000)],
 [('regression augmented-profits 1', (100000, 5000, 0, 300), 2356458),
  ('regression augmented-profits 2', (50000, 60000, 0, 365), 1154545),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000),
  ('control: small profits', (40000, 0, 0, 365), 760000), ('control: relief zone', (100000, 0, 0, 365), 2275000)],
 [('regression augmented-profits 1', (30000, 5000, 0, 200), 618875),
  ('regression augmented-profits 2', (30000, 25000, 4, 365), 750000), ('partial repair guard 1', (0, 25000, 0, 181), 0),
  ('control: relief zone', (100000, 0, 0, 365), 2275000), ('control: main rate', (300000, 0, 0, 365), 7500000),
  ('control: associated company', (60000, 0, 1, 365), 1402500),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000)],
 [('regression augmented-profits 1', (50000, 60000, 0, 90), 1250000),
  ('regression augmented-profits 2', (50000, 5000, 0, 300), 1044801),
  ('partial repair guard 2', (180000, 60000, 0, 365), 4488750),
  ('control: with dividends', (100000, 25000, 0, 365), 2350000), ('control: short period', (30000, 0, 0, 181), 609041),
  ('control: two associates short', (70000, 5000, 2, 200), 1750000),
  ('control: dividends push to main rate', (200000, 60000, 0, 365), 5000000)]]
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 augmented-profits 123500002350000Passed
regression augmented-profits 250000005000000Passed
partial repair guard 224714292471429Passed
control: small profits760000760000Passed
control: relief zone22750002275000Passed
control: main rate75000007500000Passed
control: associated company14025001402500Passed

SHA-256 / 8220b29d7c1bf7340ad059fe336b43a4a046bd3831631cf8f2014d773a230225

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

Case digest / 6f9cace55a9c34037d62666bc04b0f511ba92ddd5ff689171d7f02e8e8942f99