FAILURE MAP
← Case archive

FA-84811 / Betting odds conversion / Open access

Tax computed on the gross return · case 01

Winners are taxed on their own stake.

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

ROOT CAUSE

The tax base and threshold use the gross return instead of net winnings.

VERIFIED REPAIR

Compute both threshold test and tax on net winnings.

Unsuccessful approach: Taxing net winnings but testing the threshold on the gross return taxes bets whose winnings are below it.

Case contract

Withholding on a settled winning bet. Net winnings = return - stake. If net winnings strictly exceed the threshold, the whole net winnings (not only the excess) are taxed at rate_pct, rounded half up to a cent; otherwise no tax. Return [tax, payout after tax].

Why this case matters

Operators in taxed jurisdictions withhold on net winnings above a reporting threshold.

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(stake_cents, return_cents, threshold_cents, rate_pct):
    net = return_cents - stake_cents
    tax = 0
    if return_cents > threshold_cents:
        tax = math.floor(return_cents * Fraction(rate_pct) / 100 + Fraction(1, 2))
    return [tax, return_cents - tax]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control below threshold', (1000, 50000, 60000, '15'), [0, 50000]),
  ('boundary exactly threshold', (1000, 61000, 60000, '15'), [0, 61000]),
  ('boundary one cent above', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('control losing bet', (1000, 0, 60000, '15'), [0, 0]),
  ('control large win', (5000, 105000, 60000, '20'), [20000, 85000]),
  ('regression: tax base', (1000, 60999, 60000, '20'), [0, 60999]),
  ('variant scenario 1', (1000, 0, 60000, '20'), [0, 0]),
  ('variant scenario 2', (5000, 53181, 60000, '15'), [0, 53181])],
 [('control below threshold', (1000, 50000, 60000, '15'), [0, 50000]),
  ('boundary exactly threshold', (1000, 61000, 60000, '15'), [0, 61000]),
  ('boundary one cent above', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('control losing bet', (1000, 0, 60000, '15'), [0, 0]),
  ('control large win', (5000, 105000, 60000, '20'), [20000, 85000]),
  ('regression: tax base', (1000, 61050, 60000, '20'), [12010, 49040]),
  ('regression: tax base', (5000, 64999, 60000, '15'), [0, 64999]),
  ('variant scenario 1', (20000, 0, 60000, '15'), [0, 0]),
  ('variant scenario 2', (100, 60150, 60000, '12.5'), [7506, 52644])],
 [('control below threshold', (1000, 50000, 60000, '15'), [0, 50000]),
  ('boundary exactly threshold', (1000, 61000, 60000, '15'), [0, 61000]),
  ('boundary one cent above', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('control losing bet', (1000, 0, 60000, '15'), [0, 0]),
  ('control large win', (5000, 105000, 60000, '20'), [20000, 85000]),
  ('regression: tax base', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('regression: tax base', (5000, 64999, 60000, '12.5'), [0, 64999]),
  ('variant scenario 1', (20000, 80000, 60000, '15'), [0, 80000]),
  ('variant scenario 2', (1000, 15646, 60000, '20'), [0, 15646])],
 [('control below threshold', (1000, 50000, 60000, '15'), [0, 50000]),
  ('boundary exactly threshold', (1000, 61000, 60000, '15'), [0, 61000]),
  ('boundary one cent above', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('control losing bet', (1000, 0, 60000, '15'), [0, 0]),
  ('control large win', (5000, 105000, 60000, '20'), [20000, 85000]),
  ('regression: tax base', (100, 60099, 60000, '20'), [0, 60099]),
  ('variant scenario 1', (5000, 64999, 60000, '12.5'), [0, 64999]),
  ('variant scenario 2', (1000, 61001, 60000, '20'), [12000, 49001])],
 [('control below threshold', (1000, 50000, 60000, '15'), [0, 50000]),
  ('boundary exactly threshold', (1000, 61000, 60000, '15'), [0, 61000]),
  ('boundary one cent above', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('control losing bet', (1000, 0, 60000, '15'), [0, 0]),
  ('control large win', (5000, 105000, 60000, '20'), [20000, 85000]),
  ('regression: tax base', (5000, 109425, 60000, '20'), [20885, 88540]),
  ('regression: tax base', (5000, 64999, 60000, '15'), [0, 64999]),
  ('variant scenario 1', (5000, 5000, 60000, '12.5'), [0, 5000]),
  ('variant scenario 2', (1000, 154790, 60000, '20'), [30758, 124032])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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
control below threshold[0, 50000][0, 50000]Passed
boundary exactly threshold[9150, 51850][0, 61000]Failed
boundary one cent above[9150, 51851][9000, 52001]Failed
control losing bet[0, 0][0, 0]Passed
control large win[21000, 84000][20000, 85000]Failed
regression: tax base[12200, 48799][0, 60999]Failed
variant scenario 1[0, 0][0, 0]Passed
variant scenario 2[0, 53181][0, 53181]Passed

SHA-256 / 3ec98fe78b7b127cb0de27a2047c2a29154e8cf39af95099b58dc4e60bb739c3

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(stake_cents, return_cents, threshold_cents, rate_pct):
    net = return_cents - stake_cents
    tax = 0
    if return_cents > threshold_cents:
        tax = math.floor(net * Fraction(rate_pct) / 100 + Fraction(1, 2))
    return [tax, return_cents - tax]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control below threshold', (1000, 50000, 60000, '15'), [0, 50000]),
  ('boundary exactly threshold', (1000, 61000, 60000, '15'), [0, 61000]),
  ('boundary one cent above', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('control losing bet', (1000, 0, 60000, '15'), [0, 0]),
  ('control large win', (5000, 105000, 60000, '20'), [20000, 85000]),
  ('regression: tax base', (1000, 60999, 60000, '20'), [0, 60999]),
  ('variant scenario 1', (1000, 0, 60000, '20'), [0, 0]),
  ('variant scenario 2', (5000, 53181, 60000, '15'), [0, 53181])],
 [('control below threshold', (1000, 50000, 60000, '15'), [0, 50000]),
  ('boundary exactly threshold', (1000, 61000, 60000, '15'), [0, 61000]),
  ('boundary one cent above', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('control losing bet', (1000, 0, 60000, '15'), [0, 0]),
  ('control large win', (5000, 105000, 60000, '20'), [20000, 85000]),
  ('regression: tax base', (1000, 61050, 60000, '20'), [12010, 49040]),
  ('regression: tax base', (5000, 64999, 60000, '15'), [0, 64999]),
  ('variant scenario 1', (20000, 0, 60000, '15'), [0, 0]),
  ('variant scenario 2', (100, 60150, 60000, '12.5'), [7506, 52644])],
 [('control below threshold', (1000, 50000, 60000, '15'), [0, 50000]),
  ('boundary exactly threshold', (1000, 61000, 60000, '15'), [0, 61000]),
  ('boundary one cent above', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('control losing bet', (1000, 0, 60000, '15'), [0, 0]),
  ('control large win', (5000, 105000, 60000, '20'), [20000, 85000]),
  ('regression: tax base', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('regression: tax base', (5000, 64999, 60000, '12.5'), [0, 64999]),
  ('variant scenario 1', (20000, 80000, 60000, '15'), [0, 80000]),
  ('variant scenario 2', (1000, 15646, 60000, '20'), [0, 15646])],
 [('control below threshold', (1000, 50000, 60000, '15'), [0, 50000]),
  ('boundary exactly threshold', (1000, 61000, 60000, '15'), [0, 61000]),
  ('boundary one cent above', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('control losing bet', (1000, 0, 60000, '15'), [0, 0]),
  ('control large win', (5000, 105000, 60000, '20'), [20000, 85000]),
  ('regression: tax base', (100, 60099, 60000, '20'), [0, 60099]),
  ('variant scenario 1', (5000, 64999, 60000, '12.5'), [0, 64999]),
  ('variant scenario 2', (1000, 61001, 60000, '20'), [12000, 49001])],
 [('control below threshold', (1000, 50000, 60000, '15'), [0, 50000]),
  ('boundary exactly threshold', (1000, 61000, 60000, '15'), [0, 61000]),
  ('boundary one cent above', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('control losing bet', (1000, 0, 60000, '15'), [0, 0]),
  ('control large win', (5000, 105000, 60000, '20'), [20000, 85000]),
  ('regression: tax base', (5000, 109425, 60000, '20'), [20885, 88540]),
  ('regression: tax base', (5000, 64999, 60000, '15'), [0, 64999]),
  ('variant scenario 1', (5000, 5000, 60000, '12.5'), [0, 5000]),
  ('variant scenario 2', (1000, 154790, 60000, '20'), [30758, 124032])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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
control below threshold[0, 50000][0, 50000]Passed
boundary exactly threshold[9000, 52000][0, 61000]Failed
boundary one cent above[9000, 52001][9000, 52001]Passed
control losing bet[0, 0][0, 0]Passed
control large win[20000, 85000][20000, 85000]Passed
regression: tax base[12000, 48999][0, 60999]Failed
variant scenario 1[0, 0][0, 0]Passed
variant scenario 2[0, 53181][0, 53181]Passed

SHA-256 / ef97e9a86bfcc87870705586b468786752eec28cea2da9602cbf66c4f57ec470

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(stake_cents, return_cents, threshold_cents, rate_pct):
    net = return_cents - stake_cents
    tax = 0
    if net > threshold_cents:
        tax = math.floor(net * Fraction(rate_pct) / 100 + Fraction(1, 2))
    return [tax, return_cents - tax]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control below threshold', (1000, 50000, 60000, '15'), [0, 50000]),
  ('boundary exactly threshold', (1000, 61000, 60000, '15'), [0, 61000]),
  ('boundary one cent above', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('control losing bet', (1000, 0, 60000, '15'), [0, 0]),
  ('control large win', (5000, 105000, 60000, '20'), [20000, 85000]),
  ('regression: tax base', (1000, 60999, 60000, '20'), [0, 60999]),
  ('variant scenario 1', (1000, 0, 60000, '20'), [0, 0]),
  ('variant scenario 2', (5000, 53181, 60000, '15'), [0, 53181])],
 [('control below threshold', (1000, 50000, 60000, '15'), [0, 50000]),
  ('boundary exactly threshold', (1000, 61000, 60000, '15'), [0, 61000]),
  ('boundary one cent above', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('control losing bet', (1000, 0, 60000, '15'), [0, 0]),
  ('control large win', (5000, 105000, 60000, '20'), [20000, 85000]),
  ('regression: tax base', (1000, 61050, 60000, '20'), [12010, 49040]),
  ('regression: tax base', (5000, 64999, 60000, '15'), [0, 64999]),
  ('variant scenario 1', (20000, 0, 60000, '15'), [0, 0]),
  ('variant scenario 2', (100, 60150, 60000, '12.5'), [7506, 52644])],
 [('control below threshold', (1000, 50000, 60000, '15'), [0, 50000]),
  ('boundary exactly threshold', (1000, 61000, 60000, '15'), [0, 61000]),
  ('boundary one cent above', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('control losing bet', (1000, 0, 60000, '15'), [0, 0]),
  ('control large win', (5000, 105000, 60000, '20'), [20000, 85000]),
  ('regression: tax base', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('regression: tax base', (5000, 64999, 60000, '12.5'), [0, 64999]),
  ('variant scenario 1', (20000, 80000, 60000, '15'), [0, 80000]),
  ('variant scenario 2', (1000, 15646, 60000, '20'), [0, 15646])],
 [('control below threshold', (1000, 50000, 60000, '15'), [0, 50000]),
  ('boundary exactly threshold', (1000, 61000, 60000, '15'), [0, 61000]),
  ('boundary one cent above', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('control losing bet', (1000, 0, 60000, '15'), [0, 0]),
  ('control large win', (5000, 105000, 60000, '20'), [20000, 85000]),
  ('regression: tax base', (100, 60099, 60000, '20'), [0, 60099]),
  ('variant scenario 1', (5000, 64999, 60000, '12.5'), [0, 64999]),
  ('variant scenario 2', (1000, 61001, 60000, '20'), [12000, 49001])],
 [('control below threshold', (1000, 50000, 60000, '15'), [0, 50000]),
  ('boundary exactly threshold', (1000, 61000, 60000, '15'), [0, 61000]),
  ('boundary one cent above', (1000, 61001, 60000, '15'), [9000, 52001]),
  ('control losing bet', (1000, 0, 60000, '15'), [0, 0]),
  ('control large win', (5000, 105000, 60000, '20'), [20000, 85000]),
  ('regression: tax base', (5000, 109425, 60000, '20'), [20885, 88540]),
  ('regression: tax base', (5000, 64999, 60000, '15'), [0, 64999]),
  ('variant scenario 1', (5000, 5000, 60000, '12.5'), [0, 5000]),
  ('variant scenario 2', (1000, 154790, 60000, '20'), [30758, 124032])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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
control below threshold[0, 50000][0, 50000]Passed
boundary exactly threshold[0, 61000][0, 61000]Passed
boundary one cent above[9000, 52001][9000, 52001]Passed
control losing bet[0, 0][0, 0]Passed
control large win[20000, 85000][20000, 85000]Passed
regression: tax base[0, 60999][0, 60999]Passed
variant scenario 1[0, 0][0, 0]Passed
variant scenario 2[0, 53181][0, 53181]Passed

SHA-256 / 5a4ee5c2d7c518b965a47f804d4d0541088ce638eeb3807c6bbb10a665037b9f

Verification & scope

Stipulated, bounded toy contract stated in the contract field; not a claim of conformance with any operator, exchange or regulator rule set. 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:50:34.548002+00:00.

Case digest / d4b1952d246f3a0f3c5455b0ea66fbb6b06a5cf46c6ed40bb85e1dbc7ebb88bf