FAILURE MAP
← Case archive

FA-84741 / Betting odds conversion / Open access

Maximum extra winnings cap applied to total profit or not at all · case 01

Large boosted bets exceed the promotional cap, or pay less than the unboosted price.

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

ROOT CAUSE

The extra winnings are not capped.

VERIFIED REPAIR

Cap only the extra winnings above the normal profit.

Unsuccessful approach: Capping the whole boosted profit can pay less than the unboosted bet.

Case contract

Profit boost promotion. Normal profit = stake * (price - 1). The boost increases the profit by boost_pct percent, but the extra winnings over the normal profit are capped at max_extra_cents. The displayed boosted price is 1 + (price - 1) * (1 + boost/100) rounded half up to two decimals (display only). Return [displayed price, potential return = stake + floor(normal profit + extra)].

Why this case matters

Promotional boosts must be applied to profit, not stake, and respect maximum extra winnings.

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(price, boost_pct, max_extra_cents, stake_cents):
    d = Fraction(price)
    b = Fraction(boost_pct) / 100
    normal = stake_cents * (d - 1)
    boosted = normal * (1 + b)
    extra = boosted - normal
    shown = 1 + (d - 1) * (1 + b)
    c = math.floor(shown * 100 + Fraction(1, 2))
    return ['%d.%02d' % (c // 100, c % 100), stake_cents + math.floor(normal + extra)]
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 boosted evens', ('2.00', '25', 100000, 1000), ['2.25', 2250]),
  ('boundary capped extra', ('5.00', '50', 1000, 1000), ['7.00', 6000]),
  ('control no boost', ('3.00', '0', 1000, 1000), ['3.00', 3000]),
  ('boundary display half-up', ('1.90', '25', 100000, 1000), ['2.13', 2125]),
  ('regression: extra cap scope', ('6.51', '25', 5000, 1000), ['7.89', 7887]),
  ('regression: extra cap scope', ('1.74', '25', 500, 5000), ['1.93', 9200]),
  ('variant scenario 1', ('4.59', '20', 5000, 5000), ['5.31', 26540]),
  ('variant scenario 2', ('7.77', '50', 5000, 500), ['11.16', 5577])],
 [('control boosted evens', ('2.00', '25', 100000, 1000), ['2.25', 2250]),
  ('boundary capped extra', ('5.00', '50', 1000, 1000), ['7.00', 6000]),
  ('control no boost', ('3.00', '0', 1000, 1000), ['3.00', 3000]),
  ('boundary display half-up', ('1.90', '25', 100000, 1000), ['2.13', 2125]),
  ('regression: extra cap scope', ('2.46', '50', 500, 2000), ['3.19', 5420]),
  ('variant scenario 1', ('1.74', '20', 1000, 1000), ['1.89', 1888]),
  ('variant scenario 2', ('7.11', '100', 500, 1000), ['13.22', 7610])],
 [('control boosted evens', ('2.00', '25', 100000, 1000), ['2.25', 2250]),
  ('boundary capped extra', ('5.00', '50', 1000, 1000), ['7.00', 6000]),
  ('control no boost', ('3.00', '0', 1000, 1000), ['3.00', 3000]),
  ('boundary display half-up', ('1.90', '25', 100000, 1000), ['2.13', 2125]),
  ('regression: extra cap scope', ('5.08', '25', 1000, 1000), ['6.10', 6080]),
  ('variant scenario 1', ('3.91', '50', 5000, 1000), ['5.37', 5365]),
  ('variant scenario 2', ('2.97', '25', 100000, 1000), ['3.46', 3462])],
 [('control boosted evens', ('2.00', '25', 100000, 1000), ['2.25', 2250]),
  ('boundary capped extra', ('5.00', '50', 1000, 1000), ['7.00', 6000]),
  ('control no boost', ('3.00', '0', 1000, 1000), ['3.00', 3000]),
  ('boundary display half-up', ('1.90', '25', 100000, 1000), ['2.13', 2125]),
  ('regression: extra cap scope', ('3.51', '25', 5000, 5000), ['4.14', 20687]),
  ('regression: extra cap scope', ('5.33', '25', 500, 5000), ['6.41', 27150]),
  ('variant scenario 1', ('1.34', '20', 500, 500), ['1.41', 704]),
  ('variant scenario 2', ('4.55', '50', 5000, 2000), ['6.33', 12650])],
 [('control boosted evens', ('2.00', '25', 100000, 1000), ['2.25', 2250]),
  ('boundary capped extra', ('5.00', '50', 1000, 1000), ['7.00', 6000]),
  ('control no boost', ('3.00', '0', 1000, 1000), ['3.00', 3000]),
  ('boundary display half-up', ('1.90', '25', 100000, 1000), ['2.13', 2125]),
  ('regression: extra cap scope', ('6.53', '20', 5000, 2000), ['7.64', 15272]),
  ('regression: extra cap scope', ('4.26', '10', 500, 2000), ['4.59', 9020]),
  ('variant scenario 1', ('1.61', '25', 1000, 500), ['1.76', 881]),
  ('variant scenario 2', ('1.38', '20', 100000, 2000), ['1.46', 2912])]]
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 boosted evens['2.25', 2250]['2.25', 2250]Passed
boundary capped extra['7.00', 7000]['7.00', 6000]Failed
control no boost['3.00', 3000]['3.00', 3000]Passed
boundary display half-up['2.13', 2125]['2.13', 2125]Passed
regression: extra cap scope['7.89', 7887]['7.89', 7887]Passed
regression: extra cap scope['1.93', 9625]['1.93', 9200]Failed
variant scenario 1['5.31', 26540]['5.31', 26540]Passed
variant scenario 2['11.16', 5577]['11.16', 5577]Passed

SHA-256 / 8516014db5fc16223073cd359b2dc2ba61134415bfd126a558245a8d7981e4c3

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(price, boost_pct, max_extra_cents, stake_cents):
    d = Fraction(price)
    b = Fraction(boost_pct) / 100
    normal = stake_cents * (d - 1)
    boosted = normal * (1 + b)
    extra = min(boosted, max_extra_cents) - normal
    shown = 1 + (d - 1) * (1 + b)
    c = math.floor(shown * 100 + Fraction(1, 2))
    return ['%d.%02d' % (c // 100, c % 100), stake_cents + math.floor(normal + extra)]
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 boosted evens', ('2.00', '25', 100000, 1000), ['2.25', 2250]),
  ('boundary capped extra', ('5.00', '50', 1000, 1000), ['7.00', 6000]),
  ('control no boost', ('3.00', '0', 1000, 1000), ['3.00', 3000]),
  ('boundary display half-up', ('1.90', '25', 100000, 1000), ['2.13', 2125]),
  ('regression: extra cap scope', ('6.51', '25', 5000, 1000), ['7.89', 7887]),
  ('regression: extra cap scope', ('1.74', '25', 500, 5000), ['1.93', 9200]),
  ('variant scenario 1', ('4.59', '20', 5000, 5000), ['5.31', 26540]),
  ('variant scenario 2', ('7.77', '50', 5000, 500), ['11.16', 5577])],
 [('control boosted evens', ('2.00', '25', 100000, 1000), ['2.25', 2250]),
  ('boundary capped extra', ('5.00', '50', 1000, 1000), ['7.00', 6000]),
  ('control no boost', ('3.00', '0', 1000, 1000), ['3.00', 3000]),
  ('boundary display half-up', ('1.90', '25', 100000, 1000), ['2.13', 2125]),
  ('regression: extra cap scope', ('2.46', '50', 500, 2000), ['3.19', 5420]),
  ('variant scenario 1', ('1.74', '20', 1000, 1000), ['1.89', 1888]),
  ('variant scenario 2', ('7.11', '100', 500, 1000), ['13.22', 7610])],
 [('control boosted evens', ('2.00', '25', 100000, 1000), ['2.25', 2250]),
  ('boundary capped extra', ('5.00', '50', 1000, 1000), ['7.00', 6000]),
  ('control no boost', ('3.00', '0', 1000, 1000), ['3.00', 3000]),
  ('boundary display half-up', ('1.90', '25', 100000, 1000), ['2.13', 2125]),
  ('regression: extra cap scope', ('5.08', '25', 1000, 1000), ['6.10', 6080]),
  ('variant scenario 1', ('3.91', '50', 5000, 1000), ['5.37', 5365]),
  ('variant scenario 2', ('2.97', '25', 100000, 1000), ['3.46', 3462])],
 [('control boosted evens', ('2.00', '25', 100000, 1000), ['2.25', 2250]),
  ('boundary capped extra', ('5.00', '50', 1000, 1000), ['7.00', 6000]),
  ('control no boost', ('3.00', '0', 1000, 1000), ['3.00', 3000]),
  ('boundary display half-up', ('1.90', '25', 100000, 1000), ['2.13', 2125]),
  ('regression: extra cap scope', ('3.51', '25', 5000, 5000), ['4.14', 20687]),
  ('regression: extra cap scope', ('5.33', '25', 500, 5000), ['6.41', 27150]),
  ('variant scenario 1', ('1.34', '20', 500, 500), ['1.41', 704]),
  ('variant scenario 2', ('4.55', '50', 5000, 2000), ['6.33', 12650])],
 [('control boosted evens', ('2.00', '25', 100000, 1000), ['2.25', 2250]),
  ('boundary capped extra', ('5.00', '50', 1000, 1000), ['7.00', 6000]),
  ('control no boost', ('3.00', '0', 1000, 1000), ['3.00', 3000]),
  ('boundary display half-up', ('1.90', '25', 100000, 1000), ['2.13', 2125]),
  ('regression: extra cap scope', ('6.53', '20', 5000, 2000), ['7.64', 15272]),
  ('regression: extra cap scope', ('4.26', '10', 500, 2000), ['4.59', 9020]),
  ('variant scenario 1', ('1.61', '25', 1000, 500), ['1.76', 881]),
  ('variant scenario 2', ('1.38', '20', 100000, 2000), ['1.46', 2912])]]
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 boosted evens['2.25', 2250]['2.25', 2250]Passed
boundary capped extra['7.00', 2000]['7.00', 6000]Failed
control no boost['3.00', 2000]['3.00', 3000]Failed
boundary display half-up['2.13', 2125]['2.13', 2125]Passed
regression: extra cap scope['7.89', 6000]['7.89', 7887]Failed
regression: extra cap scope['1.93', 5500]['1.93', 9200]Failed
variant scenario 1['5.31', 10000]['5.31', 26540]Failed
variant scenario 2['11.16', 5500]['11.16', 5577]Failed

SHA-256 / 27443754206ae9a5dda6732908b67ccca7afbf4271b29c2794b54f17fcf54d58

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(price, boost_pct, max_extra_cents, stake_cents):
    d = Fraction(price)
    b = Fraction(boost_pct) / 100
    normal = stake_cents * (d - 1)
    boosted = normal * (1 + b)
    extra = min(boosted - normal, max_extra_cents)
    shown = 1 + (d - 1) * (1 + b)
    c = math.floor(shown * 100 + Fraction(1, 2))
    return ['%d.%02d' % (c // 100, c % 100), stake_cents + math.floor(normal + extra)]
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 boosted evens', ('2.00', '25', 100000, 1000), ['2.25', 2250]),
  ('boundary capped extra', ('5.00', '50', 1000, 1000), ['7.00', 6000]),
  ('control no boost', ('3.00', '0', 1000, 1000), ['3.00', 3000]),
  ('boundary display half-up', ('1.90', '25', 100000, 1000), ['2.13', 2125]),
  ('regression: extra cap scope', ('6.51', '25', 5000, 1000), ['7.89', 7887]),
  ('regression: extra cap scope', ('1.74', '25', 500, 5000), ['1.93', 9200]),
  ('variant scenario 1', ('4.59', '20', 5000, 5000), ['5.31', 26540]),
  ('variant scenario 2', ('7.77', '50', 5000, 500), ['11.16', 5577])],
 [('control boosted evens', ('2.00', '25', 100000, 1000), ['2.25', 2250]),
  ('boundary capped extra', ('5.00', '50', 1000, 1000), ['7.00', 6000]),
  ('control no boost', ('3.00', '0', 1000, 1000), ['3.00', 3000]),
  ('boundary display half-up', ('1.90', '25', 100000, 1000), ['2.13', 2125]),
  ('regression: extra cap scope', ('2.46', '50', 500, 2000), ['3.19', 5420]),
  ('variant scenario 1', ('1.74', '20', 1000, 1000), ['1.89', 1888]),
  ('variant scenario 2', ('7.11', '100', 500, 1000), ['13.22', 7610])],
 [('control boosted evens', ('2.00', '25', 100000, 1000), ['2.25', 2250]),
  ('boundary capped extra', ('5.00', '50', 1000, 1000), ['7.00', 6000]),
  ('control no boost', ('3.00', '0', 1000, 1000), ['3.00', 3000]),
  ('boundary display half-up', ('1.90', '25', 100000, 1000), ['2.13', 2125]),
  ('regression: extra cap scope', ('5.08', '25', 1000, 1000), ['6.10', 6080]),
  ('variant scenario 1', ('3.91', '50', 5000, 1000), ['5.37', 5365]),
  ('variant scenario 2', ('2.97', '25', 100000, 1000), ['3.46', 3462])],
 [('control boosted evens', ('2.00', '25', 100000, 1000), ['2.25', 2250]),
  ('boundary capped extra', ('5.00', '50', 1000, 1000), ['7.00', 6000]),
  ('control no boost', ('3.00', '0', 1000, 1000), ['3.00', 3000]),
  ('boundary display half-up', ('1.90', '25', 100000, 1000), ['2.13', 2125]),
  ('regression: extra cap scope', ('3.51', '25', 5000, 5000), ['4.14', 20687]),
  ('regression: extra cap scope', ('5.33', '25', 500, 5000), ['6.41', 27150]),
  ('variant scenario 1', ('1.34', '20', 500, 500), ['1.41', 704]),
  ('variant scenario 2', ('4.55', '50', 5000, 2000), ['6.33', 12650])],
 [('control boosted evens', ('2.00', '25', 100000, 1000), ['2.25', 2250]),
  ('boundary capped extra', ('5.00', '50', 1000, 1000), ['7.00', 6000]),
  ('control no boost', ('3.00', '0', 1000, 1000), ['3.00', 3000]),
  ('boundary display half-up', ('1.90', '25', 100000, 1000), ['2.13', 2125]),
  ('regression: extra cap scope', ('6.53', '20', 5000, 2000), ['7.64', 15272]),
  ('regression: extra cap scope', ('4.26', '10', 500, 2000), ['4.59', 9020]),
  ('variant scenario 1', ('1.61', '25', 1000, 500), ['1.76', 881]),
  ('variant scenario 2', ('1.38', '20', 100000, 2000), ['1.46', 2912])]]
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 boosted evens['2.25', 2250]['2.25', 2250]Passed
boundary capped extra['7.00', 6000]['7.00', 6000]Passed
control no boost['3.00', 3000]['3.00', 3000]Passed
boundary display half-up['2.13', 2125]['2.13', 2125]Passed
regression: extra cap scope['7.89', 7887]['7.89', 7887]Passed
regression: extra cap scope['1.93', 9200]['1.93', 9200]Passed
variant scenario 1['5.31', 26540]['5.31', 26540]Passed
variant scenario 2['11.16', 5577]['11.16', 5577]Passed

SHA-256 / e5bdbca2d29a8109407b345d4a9748be8cb29746781ad025f94e34bff1b22fe5

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

Case digest / 1bc143bc5649f99d42292c669671fdefa6fdc9dd9d8fbf1cb98d8b3b5f201cee