FA-84816 / Betting odds conversion / Open access
Winnings equal to the threshold taxed or cents ignored · case 01
A win of exactly the threshold is taxed, or one just above it is not.
ROOT CAUSE
The threshold comparison uses >=.
THE FAILURE
The threshold comparison uses >=.
Unsuccessful approach: Comparing whole currency units drops the cents that put a win over the threshold.
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 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: threshold inclusivity', (100, 60101, 60000, '12.5'), [7500, 52601]),
('regression: threshold inclusivity', (5000, 65000, 60000, '20'), [0, 65000]),
('variant scenario 1', (20000, 63223, 60000, '20'), [0, 63223]),
('variant scenario 2', (20000, 79999, 60000, '20'), [0, 79999])],
[('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: threshold inclusivity', (20000, 80001, 60000, '12.5'), [7500, 72501]),
('regression: threshold inclusivity', (1000, 61000, 60000, '15'), [0, 61000]),
('variant scenario 1', (1000, 60999, 60000, '15'), [0, 60999]),
('variant scenario 2', (1000, 195918, 60000, '12.5'), [24365, 171553])],
[('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: threshold inclusivity', (1000, 61001, 60000, '15'), [9000, 52001]),
('regression: threshold inclusivity', (1000, 61000, 60000, '15'), [0, 61000]),
('variant scenario 1', (20000, 297537, 60000, '15'), [41631, 255906]),
('variant scenario 2', (20000, 20000, 60000, '12.5'), [0, 20000])],
[('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: threshold inclusivity', (100, 60101, 60000, '20'), [12000, 48101]),
('regression: threshold inclusivity', (20000, 80000, 60000, '12.5'), [0, 80000]),
('variant scenario 1', (100, 0, 60000, '20'), [0, 0]),
('variant scenario 2', (1000, 61000, 60000, '20'), [0, 61000])],
[('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: threshold inclusivity', (1000, 61050, 60000, '12.5'), [7506, 53544]),
('regression: threshold inclusivity', (100, 60100, 60000, '15'), [0, 60100]),
('variant scenario 1', (100, 100534, 60000, '20'), [20087, 80447]),
('variant scenario 2', (5000, 5000, 60000, '20'), [0, 5000])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| 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: threshold inclusivity | [7500, 52601] | [7500, 52601] | Passed |
| regression: threshold inclusivity | [12000, 53000] | [0, 65000] | Failed |
| variant scenario 1 | [0, 63223] | [0, 63223] | Passed |
| variant scenario 2 | [0, 79999] | [0, 79999] | Passed |
SHA-256 / 9fc69fc0b88cdc8c84b3b7d319deb2bb6104aca318e284281a99527006e5e9f5
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 net // 100 > threshold_cents // 100:
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: threshold inclusivity', (100, 60101, 60000, '12.5'), [7500, 52601]),
('regression: threshold inclusivity', (5000, 65000, 60000, '20'), [0, 65000]),
('variant scenario 1', (20000, 63223, 60000, '20'), [0, 63223]),
('variant scenario 2', (20000, 79999, 60000, '20'), [0, 79999])],
[('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: threshold inclusivity', (20000, 80001, 60000, '12.5'), [7500, 72501]),
('regression: threshold inclusivity', (1000, 61000, 60000, '15'), [0, 61000]),
('variant scenario 1', (1000, 60999, 60000, '15'), [0, 60999]),
('variant scenario 2', (1000, 195918, 60000, '12.5'), [24365, 171553])],
[('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: threshold inclusivity', (1000, 61001, 60000, '15'), [9000, 52001]),
('regression: threshold inclusivity', (1000, 61000, 60000, '15'), [0, 61000]),
('variant scenario 1', (20000, 297537, 60000, '15'), [41631, 255906]),
('variant scenario 2', (20000, 20000, 60000, '12.5'), [0, 20000])],
[('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: threshold inclusivity', (100, 60101, 60000, '20'), [12000, 48101]),
('regression: threshold inclusivity', (20000, 80000, 60000, '12.5'), [0, 80000]),
('variant scenario 1', (100, 0, 60000, '20'), [0, 0]),
('variant scenario 2', (1000, 61000, 60000, '20'), [0, 61000])],
[('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: threshold inclusivity', (1000, 61050, 60000, '12.5'), [7506, 53544]),
('regression: threshold inclusivity', (100, 60100, 60000, '15'), [0, 60100]),
('variant scenario 1', (100, 100534, 60000, '20'), [20087, 80447]),
('variant scenario 2', (5000, 5000, 60000, '20'), [0, 5000])]]
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| control below threshold | [0, 50000] | [0, 50000] | Passed |
| boundary exactly threshold | [0, 61000] | [0, 61000] | Passed |
| boundary one cent above | [0, 61001] | [9000, 52001] | Failed |
| control losing bet | [0, 0] | [0, 0] | Passed |
| control large win | [20000, 85000] | [20000, 85000] | Passed |
| regression: threshold inclusivity | [0, 60101] | [7500, 52601] | Failed |
| regression: threshold inclusivity | [0, 65000] | [0, 65000] | Passed |
| variant scenario 1 | [0, 63223] | [0, 63223] | Passed |
| variant scenario 2 | [0, 79999] | [0, 79999] | Passed |
SHA-256 / 4765fb5b4cba60a6f04a30b0eb357b998bc4f22553ba811ff4d27740a5f4d1b3
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 9 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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.635068+00:00.
Case digest / 8a3937bc903923d5d2475b79fa757e528826a8918ac1903c7f507fb0a70210f2