FAILURE MAP
← Case archive

FA-84731 / Betting odds conversion / Open access

Winner with no stakes crashes the dividend · case 01

A winner nobody backed raises a division error or pays 0.00.

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

ROOT CAUSE

There is no guard for zero stakes on a winner.

VERIFIED REPAIR

Report None for a winner without stakes.

Unsuccessful approach: Returning "0.00" suggests a paid dividend of zero.

Case contract

Pari-mutuel win dividend per unit stake. The net pool is pool * (100 - takeout_pct) / 100; with a dead heat it is split equally among the winning runners. Each runner's dividend is its share divided by the stakes on it, broken down to the 10-cent step below (breakage), with a minimum of 1.10. A winner with no stakes gets None. Return dividends as "D.D0" strings in winners order.

Why this case matters

Tote operators compute dividends with takeout, breakage and minimum-dividend rules.

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(pool_cents, takeout_pct, winners):
    net = Fraction(pool_cents) * (100 - Fraction(takeout_pct)) / 100
    share = net / len(winners)
    out = []
    for s in winners:
        dimes = math.floor(share / s * 10)
        dimes = max(dimes, 11)
        out.append('%d.%d0' % (dimes // 10, dimes % 10))
    return out
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 single winner', (100000, '15', [25000]), ['3.40']),
  ('boundary breakage down', (100000, '16', [30000]), ['2.80']),
  ('boundary minimum dividend', (100000, '20', [90000]), ['1.10']),
  ('boundary dead heat split', (100000, '20', [10000, 40000]), ['4.00', '1.10']),
  ('control unbacked winner', (100000, '15', [0]), [None]),
  ('regression: unbacked winner', (250000, '0', [0]), [None]),
  ('variant scenario 1', (100000, '16', [46029]), ['1.80']),
  ('variant scenario 2', (50000, '0', [19014, 1025, 3517]), ['1.10', '16.20', '4.70'])],
 [('control single winner', (100000, '15', [25000]), ['3.40']),
  ('boundary breakage down', (100000, '16', [30000]), ['2.80']),
  ('boundary minimum dividend', (100000, '20', [90000]), ['1.10']),
  ('boundary dead heat split', (100000, '20', [10000, 40000]), ['4.00', '1.10']),
  ('control unbacked winner', (100000, '15', [0]), [None]),
  ('regression: unbacked winner', (250000, '20', [41766, 0, 146516]), ['1.50', None, '1.10']),
  ('variant scenario 1', (20000, '16', [8054]), ['2.00']),
  ('variant scenario 2', (1234500, '20', [948216, 357944, 406471]), ['1.10', '1.10', '1.10'])],
 [('control single winner', (100000, '15', [25000]), ['3.40']),
  ('boundary breakage down', (100000, '16', [30000]), ['2.80']),
  ('boundary minimum dividend', (100000, '20', [90000]), ['1.10']),
  ('boundary dead heat split', (100000, '20', [10000, 40000]), ['4.00', '1.10']),
  ('control unbacked winner', (100000, '15', [0]), [None]),
  ('regression: unbacked winner', (20000, '16', [0]), [None]),
  ('variant scenario 1', (20000, '15', [15831, 15772]), ['1.10', '1.10']),
  ('variant scenario 2', (20000, '16', [19210]), ['1.10'])],
 [('control single winner', (100000, '15', [25000]), ['3.40']),
  ('boundary breakage down', (100000, '16', [30000]), ['2.80']),
  ('boundary minimum dividend', (100000, '20', [90000]), ['1.10']),
  ('boundary dead heat split', (100000, '20', [10000, 40000]), ['4.00', '1.10']),
  ('control unbacked winner', (100000, '15', [0]), [None]),
  ('regression: unbacked winner', (20000, '15', [0]), [None]),
  ('variant scenario 1', (50000, '16', [40000]), ['1.10']),
  ('variant scenario 2', (100000, '16', [1500, 50366]), ['28.00', '1.10'])],
 [('control single winner', (100000, '15', [25000]), ['3.40']),
  ('boundary breakage down', (100000, '16', [30000]), ['2.80']),
  ('boundary minimum dividend', (100000, '20', [90000]), ['1.10']),
  ('boundary dead heat split', (100000, '20', [10000, 40000]), ['4.00', '1.10']),
  ('control unbacked winner', (100000, '15', [0]), [None]),
  ('regression: unbacked winner', (1234500, '0', [636655, 0, 10000]), ['1.10', None, '41.10']),
  ('variant scenario 1', (50000, '0', [27761]), ['1.80']),
  ('variant scenario 2', (20000, '20', [5443, 16144]), ['1.40', '1.10'])]]
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 single winner['3.40']['3.40']Passed
boundary breakage down['2.80']['2.80']Passed
boundary minimum dividend['1.10']['1.10']Passed
boundary dead heat split['4.00', '1.10']['4.00', '1.10']Passed
control unbacked winnerraised ZeroDivisionError[None]Failed
regression: unbacked winnerraised ZeroDivisionError[None]Failed
variant scenario 1['1.80']['1.80']Passed
variant scenario 2['1.10', '16.20', '4.70']['1.10', '16.20', '4.70']Passed

SHA-256 / 1cb656a93a13356946341780d5f893d69f524677f5e46b5714a2a89cd28ea5de

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(pool_cents, takeout_pct, winners):
    net = Fraction(pool_cents) * (100 - Fraction(takeout_pct)) / 100
    share = net / len(winners)
    out = []
    for s in winners:
        if s == 0:
            out.append('0.00')
            continue
        dimes = math.floor(share / s * 10)
        dimes = max(dimes, 11)
        out.append('%d.%d0' % (dimes // 10, dimes % 10))
    return out
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 single winner', (100000, '15', [25000]), ['3.40']),
  ('boundary breakage down', (100000, '16', [30000]), ['2.80']),
  ('boundary minimum dividend', (100000, '20', [90000]), ['1.10']),
  ('boundary dead heat split', (100000, '20', [10000, 40000]), ['4.00', '1.10']),
  ('control unbacked winner', (100000, '15', [0]), [None]),
  ('regression: unbacked winner', (250000, '0', [0]), [None]),
  ('variant scenario 1', (100000, '16', [46029]), ['1.80']),
  ('variant scenario 2', (50000, '0', [19014, 1025, 3517]), ['1.10', '16.20', '4.70'])],
 [('control single winner', (100000, '15', [25000]), ['3.40']),
  ('boundary breakage down', (100000, '16', [30000]), ['2.80']),
  ('boundary minimum dividend', (100000, '20', [90000]), ['1.10']),
  ('boundary dead heat split', (100000, '20', [10000, 40000]), ['4.00', '1.10']),
  ('control unbacked winner', (100000, '15', [0]), [None]),
  ('regression: unbacked winner', (250000, '20', [41766, 0, 146516]), ['1.50', None, '1.10']),
  ('variant scenario 1', (20000, '16', [8054]), ['2.00']),
  ('variant scenario 2', (1234500, '20', [948216, 357944, 406471]), ['1.10', '1.10', '1.10'])],
 [('control single winner', (100000, '15', [25000]), ['3.40']),
  ('boundary breakage down', (100000, '16', [30000]), ['2.80']),
  ('boundary minimum dividend', (100000, '20', [90000]), ['1.10']),
  ('boundary dead heat split', (100000, '20', [10000, 40000]), ['4.00', '1.10']),
  ('control unbacked winner', (100000, '15', [0]), [None]),
  ('regression: unbacked winner', (20000, '16', [0]), [None]),
  ('variant scenario 1', (20000, '15', [15831, 15772]), ['1.10', '1.10']),
  ('variant scenario 2', (20000, '16', [19210]), ['1.10'])],
 [('control single winner', (100000, '15', [25000]), ['3.40']),
  ('boundary breakage down', (100000, '16', [30000]), ['2.80']),
  ('boundary minimum dividend', (100000, '20', [90000]), ['1.10']),
  ('boundary dead heat split', (100000, '20', [10000, 40000]), ['4.00', '1.10']),
  ('control unbacked winner', (100000, '15', [0]), [None]),
  ('regression: unbacked winner', (20000, '15', [0]), [None]),
  ('variant scenario 1', (50000, '16', [40000]), ['1.10']),
  ('variant scenario 2', (100000, '16', [1500, 50366]), ['28.00', '1.10'])],
 [('control single winner', (100000, '15', [25000]), ['3.40']),
  ('boundary breakage down', (100000, '16', [30000]), ['2.80']),
  ('boundary minimum dividend', (100000, '20', [90000]), ['1.10']),
  ('boundary dead heat split', (100000, '20', [10000, 40000]), ['4.00', '1.10']),
  ('control unbacked winner', (100000, '15', [0]), [None]),
  ('regression: unbacked winner', (1234500, '0', [636655, 0, 10000]), ['1.10', None, '41.10']),
  ('variant scenario 1', (50000, '0', [27761]), ['1.80']),
  ('variant scenario 2', (20000, '20', [5443, 16144]), ['1.40', '1.10'])]]
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 single winner['3.40']['3.40']Passed
boundary breakage down['2.80']['2.80']Passed
boundary minimum dividend['1.10']['1.10']Passed
boundary dead heat split['4.00', '1.10']['4.00', '1.10']Passed
control unbacked winner['0.00'][None]Failed
regression: unbacked winner['0.00'][None]Failed
variant scenario 1['1.80']['1.80']Passed
variant scenario 2['1.10', '16.20', '4.70']['1.10', '16.20', '4.70']Passed

SHA-256 / b4f93f9202ff7b4c2f56cdc5e701411745f360ed3e02d7d9089ccc8571afc45c

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(pool_cents, takeout_pct, winners):
    net = Fraction(pool_cents) * (100 - Fraction(takeout_pct)) / 100
    share = net / len(winners)
    out = []
    for s in winners:
        if s == 0:
            out.append(None)
            continue
        dimes = math.floor(share / s * 10)
        dimes = max(dimes, 11)
        out.append('%d.%d0' % (dimes // 10, dimes % 10))
    return out
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 single winner', (100000, '15', [25000]), ['3.40']),
  ('boundary breakage down', (100000, '16', [30000]), ['2.80']),
  ('boundary minimum dividend', (100000, '20', [90000]), ['1.10']),
  ('boundary dead heat split', (100000, '20', [10000, 40000]), ['4.00', '1.10']),
  ('control unbacked winner', (100000, '15', [0]), [None]),
  ('regression: unbacked winner', (250000, '0', [0]), [None]),
  ('variant scenario 1', (100000, '16', [46029]), ['1.80']),
  ('variant scenario 2', (50000, '0', [19014, 1025, 3517]), ['1.10', '16.20', '4.70'])],
 [('control single winner', (100000, '15', [25000]), ['3.40']),
  ('boundary breakage down', (100000, '16', [30000]), ['2.80']),
  ('boundary minimum dividend', (100000, '20', [90000]), ['1.10']),
  ('boundary dead heat split', (100000, '20', [10000, 40000]), ['4.00', '1.10']),
  ('control unbacked winner', (100000, '15', [0]), [None]),
  ('regression: unbacked winner', (250000, '20', [41766, 0, 146516]), ['1.50', None, '1.10']),
  ('variant scenario 1', (20000, '16', [8054]), ['2.00']),
  ('variant scenario 2', (1234500, '20', [948216, 357944, 406471]), ['1.10', '1.10', '1.10'])],
 [('control single winner', (100000, '15', [25000]), ['3.40']),
  ('boundary breakage down', (100000, '16', [30000]), ['2.80']),
  ('boundary minimum dividend', (100000, '20', [90000]), ['1.10']),
  ('boundary dead heat split', (100000, '20', [10000, 40000]), ['4.00', '1.10']),
  ('control unbacked winner', (100000, '15', [0]), [None]),
  ('regression: unbacked winner', (20000, '16', [0]), [None]),
  ('variant scenario 1', (20000, '15', [15831, 15772]), ['1.10', '1.10']),
  ('variant scenario 2', (20000, '16', [19210]), ['1.10'])],
 [('control single winner', (100000, '15', [25000]), ['3.40']),
  ('boundary breakage down', (100000, '16', [30000]), ['2.80']),
  ('boundary minimum dividend', (100000, '20', [90000]), ['1.10']),
  ('boundary dead heat split', (100000, '20', [10000, 40000]), ['4.00', '1.10']),
  ('control unbacked winner', (100000, '15', [0]), [None]),
  ('regression: unbacked winner', (20000, '15', [0]), [None]),
  ('variant scenario 1', (50000, '16', [40000]), ['1.10']),
  ('variant scenario 2', (100000, '16', [1500, 50366]), ['28.00', '1.10'])],
 [('control single winner', (100000, '15', [25000]), ['3.40']),
  ('boundary breakage down', (100000, '16', [30000]), ['2.80']),
  ('boundary minimum dividend', (100000, '20', [90000]), ['1.10']),
  ('boundary dead heat split', (100000, '20', [10000, 40000]), ['4.00', '1.10']),
  ('control unbacked winner', (100000, '15', [0]), [None]),
  ('regression: unbacked winner', (1234500, '0', [636655, 0, 10000]), ['1.10', None, '41.10']),
  ('variant scenario 1', (50000, '0', [27761]), ['1.80']),
  ('variant scenario 2', (20000, '20', [5443, 16144]), ['1.40', '1.10'])]]
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 single winner['3.40']['3.40']Passed
boundary breakage down['2.80']['2.80']Passed
boundary minimum dividend['1.10']['1.10']Passed
boundary dead heat split['4.00', '1.10']['4.00', '1.10']Passed
control unbacked winner[None][None]Passed
regression: unbacked winner[None][None]Passed
variant scenario 1['1.80']['1.80']Passed
variant scenario 2['1.10', '16.20', '4.70']['1.10', '16.20', '4.70']Passed

SHA-256 / 3b0c8b7fb713b9a543dafb7e89c65228ba9129041456099b3ad37b1f1bae1a45

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

Case digest / 28d9cf69b5f4084dd95aec4010fe6774960ee67021b2fe9f277a26c745972519