FAILURE MAP
← Case archive

FA-84376 / Betting odds conversion / Open access

Whole-number fractional odds rendered without denominator · case 01

Even money shows "1" instead of "1/1" and unreduced forms leak through.

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

ROOT CAUSE

The fraction is rendered with an unreduced N/100 template.

THE FAILURE

The fraction is rendered with an unreduced N/100 template.

Unsuccessful approach: Using str() on the Fraction prints whole numbers without the '/1'.

Case contract

Expand an American moneyline ("+150", "150" or "-200"; magnitude at least 100, otherwise "invalid"). Profit per unit is N/100 for positive or unsigned lines and 100/N for negative lines. Return [decimal price with two decimals, reduced fractional profit "a/b", implied probability percent with one decimal], all computed exactly and rounded half up.

Why this case matters

Odds screens show American, decimal, fractional and implied-probability columns for one price.

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(american):
    s = american.strip()
    neg = s.startswith('-')
    n = int(s.lstrip('+-'))
    if n < 100:
        return 'invalid'
    profit = Fraction(100, n) if neg else Fraction(n, 100)
    dec = 1 + profit
    def fmt(x, places):
        q = 10 ** places
        v = math.floor(x * q + Fraction(1, 2))
        return '%d.%0*d' % (v // q, places, v % q)
    prob = Fraction(n, n + 100) * 100 if neg else Fraction(100, n + 100) * 100
    return [fmt(dec, 2), ('100/%d' % n if neg else '%d/100' % n), fmt(prob, 1)]
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 underdog', ('+150',), ['2.50', '3/2', '40.0']),
  ('control favourite', ('-200',), ['1.50', '1/2', '66.7']),
  ('boundary even money', ('+100',), ['2.00', '1/1', '50.0']),
  ('boundary unsigned line', ('250',), ['3.50', '5/2', '28.6']),
  ('boundary below minimum', ('+50',), 'invalid'),
  ('control half-up decimal', ('-800',), ['1.13', '1/8', '88.9']),
  ('regression: fraction rendering', ('175',), ['2.75', '7/4', '36.4']),
  ('regression: fraction rendering', ('800',), ['9.00', '8/1', '11.1']),
  ('variant scenario 1', ('-283',), ['1.35', '100/283', '73.9']),
  ('variant scenario 2', ('+660',), ['7.60', '33/5', '13.2'])],
 [('control underdog', ('+150',), ['2.50', '3/2', '40.0']),
  ('control favourite', ('-200',), ['1.50', '1/2', '66.7']),
  ('boundary even money', ('+100',), ['2.00', '1/1', '50.0']),
  ('boundary unsigned line', ('250',), ['3.50', '5/2', '28.6']),
  ('boundary below minimum', ('+50',), 'invalid'),
  ('control half-up decimal', ('-800',), ['1.13', '1/8', '88.9']),
  ('regression: fraction rendering', ('120',), ['2.20', '6/5', '45.5']),
  ('regression: fraction rendering', ('+100',), ['2.00', '1/1', '50.0']),
  ('variant scenario 1', ('756',), ['8.56', '189/25', '11.7']),
  ('variant scenario 2', ('295',), ['3.95', '59/20', '25.3'])],
 [('control underdog', ('+150',), ['2.50', '3/2', '40.0']),
  ('control favourite', ('-200',), ['1.50', '1/2', '66.7']),
  ('boundary even money', ('+100',), ['2.00', '1/1', '50.0']),
  ('boundary unsigned line', ('250',), ['3.50', '5/2', '28.6']),
  ('boundary below minimum', ('+50',), 'invalid'),
  ('control half-up decimal', ('-800',), ['1.13', '1/8', '88.9']),
  ('regression: fraction rendering', ('168',), ['2.68', '42/25', '37.3']),
  ('regression: fraction rendering', ('+200',), ['3.00', '2/1', '33.3']),
  ('variant scenario 1', ('-125',), ['1.80', '4/5', '55.6']),
  ('variant scenario 2', ('+225',), ['3.25', '9/4', '30.8'])],
 [('control underdog', ('+150',), ['2.50', '3/2', '40.0']),
  ('control favourite', ('-200',), ['1.50', '1/2', '66.7']),
  ('boundary even money', ('+100',), ['2.00', '1/1', '50.0']),
  ('boundary unsigned line', ('250',), ['3.50', '5/2', '28.6']),
  ('boundary below minimum', ('+50',), 'invalid'),
  ('control half-up decimal', ('-800',), ['1.13', '1/8', '88.9']),
  ('regression: fraction rendering', ('+1016',), ['11.16', '254/25', '9.0']),
  ('regression: fraction rendering', ('+200',), ['3.00', '2/1', '33.3']),
  ('variant scenario 1', ('845',), ['9.45', '169/20', '10.6']),
  ('variant scenario 2', ('+1181',), ['12.81', '1181/100', '7.8'])],
 [('control underdog', ('+150',), ['2.50', '3/2', '40.0']),
  ('control favourite', ('-200',), ['1.50', '1/2', '66.7']),
  ('boundary even money', ('+100',), ['2.00', '1/1', '50.0']),
  ('boundary unsigned line', ('250',), ['3.50', '5/2', '28.6']),
  ('boundary below minimum', ('+50',), 'invalid'),
  ('control half-up decimal', ('-800',), ['1.13', '1/8', '88.9']),
  ('regression: fraction rendering', ('-225',), ['1.44', '4/9', '69.2']),
  ('regression: fraction rendering', ('-100',), ['2.00', '1/1', '50.0']),
  ('variant scenario 1', ('-249',), ['1.40', '100/249', '71.3']),
  ('variant scenario 2', ('+175',), ['2.75', '7/4', '36.4'])]]
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 underdog['2.50', '150/100', '40.0']['2.50', '3/2', '40.0']Failed
control favourite['1.50', '100/200', '66.7']['1.50', '1/2', '66.7']Failed
boundary even money['2.00', '100/100', '50.0']['2.00', '1/1', '50.0']Failed
boundary unsigned line['3.50', '250/100', '28.6']['3.50', '5/2', '28.6']Failed
boundary below minimuminvalidinvalidPassed
control half-up decimal['1.13', '100/800', '88.9']['1.13', '1/8', '88.9']Failed
regression: fraction rendering['2.75', '175/100', '36.4']['2.75', '7/4', '36.4']Failed
regression: fraction rendering['9.00', '800/100', '11.1']['9.00', '8/1', '11.1']Failed
variant scenario 1['1.35', '100/283', '73.9']['1.35', '100/283', '73.9']Passed
variant scenario 2['7.60', '660/100', '13.2']['7.60', '33/5', '13.2']Failed

SHA-256 / 472233db71f0525779841a5f4309503be9393eca15575e6e62542fe861cf4190

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(american):
    s = american.strip()
    neg = s.startswith('-')
    n = int(s.lstrip('+-'))
    if n < 100:
        return 'invalid'
    profit = Fraction(100, n) if neg else Fraction(n, 100)
    dec = 1 + profit
    def fmt(x, places):
        q = 10 ** places
        v = math.floor(x * q + Fraction(1, 2))
        return '%d.%0*d' % (v // q, places, v % q)
    prob = Fraction(n, n + 100) * 100 if neg else Fraction(100, n + 100) * 100
    return [fmt(dec, 2), str(profit), fmt(prob, 1)]
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 underdog', ('+150',), ['2.50', '3/2', '40.0']),
  ('control favourite', ('-200',), ['1.50', '1/2', '66.7']),
  ('boundary even money', ('+100',), ['2.00', '1/1', '50.0']),
  ('boundary unsigned line', ('250',), ['3.50', '5/2', '28.6']),
  ('boundary below minimum', ('+50',), 'invalid'),
  ('control half-up decimal', ('-800',), ['1.13', '1/8', '88.9']),
  ('regression: fraction rendering', ('175',), ['2.75', '7/4', '36.4']),
  ('regression: fraction rendering', ('800',), ['9.00', '8/1', '11.1']),
  ('variant scenario 1', ('-283',), ['1.35', '100/283', '73.9']),
  ('variant scenario 2', ('+660',), ['7.60', '33/5', '13.2'])],
 [('control underdog', ('+150',), ['2.50', '3/2', '40.0']),
  ('control favourite', ('-200',), ['1.50', '1/2', '66.7']),
  ('boundary even money', ('+100',), ['2.00', '1/1', '50.0']),
  ('boundary unsigned line', ('250',), ['3.50', '5/2', '28.6']),
  ('boundary below minimum', ('+50',), 'invalid'),
  ('control half-up decimal', ('-800',), ['1.13', '1/8', '88.9']),
  ('regression: fraction rendering', ('120',), ['2.20', '6/5', '45.5']),
  ('regression: fraction rendering', ('+100',), ['2.00', '1/1', '50.0']),
  ('variant scenario 1', ('756',), ['8.56', '189/25', '11.7']),
  ('variant scenario 2', ('295',), ['3.95', '59/20', '25.3'])],
 [('control underdog', ('+150',), ['2.50', '3/2', '40.0']),
  ('control favourite', ('-200',), ['1.50', '1/2', '66.7']),
  ('boundary even money', ('+100',), ['2.00', '1/1', '50.0']),
  ('boundary unsigned line', ('250',), ['3.50', '5/2', '28.6']),
  ('boundary below minimum', ('+50',), 'invalid'),
  ('control half-up decimal', ('-800',), ['1.13', '1/8', '88.9']),
  ('regression: fraction rendering', ('168',), ['2.68', '42/25', '37.3']),
  ('regression: fraction rendering', ('+200',), ['3.00', '2/1', '33.3']),
  ('variant scenario 1', ('-125',), ['1.80', '4/5', '55.6']),
  ('variant scenario 2', ('+225',), ['3.25', '9/4', '30.8'])],
 [('control underdog', ('+150',), ['2.50', '3/2', '40.0']),
  ('control favourite', ('-200',), ['1.50', '1/2', '66.7']),
  ('boundary even money', ('+100',), ['2.00', '1/1', '50.0']),
  ('boundary unsigned line', ('250',), ['3.50', '5/2', '28.6']),
  ('boundary below minimum', ('+50',), 'invalid'),
  ('control half-up decimal', ('-800',), ['1.13', '1/8', '88.9']),
  ('regression: fraction rendering', ('+1016',), ['11.16', '254/25', '9.0']),
  ('regression: fraction rendering', ('+200',), ['3.00', '2/1', '33.3']),
  ('variant scenario 1', ('845',), ['9.45', '169/20', '10.6']),
  ('variant scenario 2', ('+1181',), ['12.81', '1181/100', '7.8'])],
 [('control underdog', ('+150',), ['2.50', '3/2', '40.0']),
  ('control favourite', ('-200',), ['1.50', '1/2', '66.7']),
  ('boundary even money', ('+100',), ['2.00', '1/1', '50.0']),
  ('boundary unsigned line', ('250',), ['3.50', '5/2', '28.6']),
  ('boundary below minimum', ('+50',), 'invalid'),
  ('control half-up decimal', ('-800',), ['1.13', '1/8', '88.9']),
  ('regression: fraction rendering', ('-225',), ['1.44', '4/9', '69.2']),
  ('regression: fraction rendering', ('-100',), ['2.00', '1/1', '50.0']),
  ('variant scenario 1', ('-249',), ['1.40', '100/249', '71.3']),
  ('variant scenario 2', ('+175',), ['2.75', '7/4', '36.4'])]]
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 underdog['2.50', '3/2', '40.0']['2.50', '3/2', '40.0']Passed
control favourite['1.50', '1/2', '66.7']['1.50', '1/2', '66.7']Passed
boundary even money['2.00', '1', '50.0']['2.00', '1/1', '50.0']Failed
boundary unsigned line['3.50', '5/2', '28.6']['3.50', '5/2', '28.6']Passed
boundary below minimuminvalidinvalidPassed
control half-up decimal['1.13', '1/8', '88.9']['1.13', '1/8', '88.9']Passed
regression: fraction rendering['2.75', '7/4', '36.4']['2.75', '7/4', '36.4']Passed
regression: fraction rendering['9.00', '8', '11.1']['9.00', '8/1', '11.1']Failed
variant scenario 1['1.35', '100/283', '73.9']['1.35', '100/283', '73.9']Passed
variant scenario 2['7.60', '33/5', '13.2']['7.60', '33/5', '13.2']Passed

SHA-256 / 5902228ce93752be511cb6e4ad89589500a0afaa4661090c8f778a79e94b2e30

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 10 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:30.382488+00:00.

Case digest / f2c65a8ca51af7f838946efc9e256d7844937af8d6e9ca5f48babf49c6d61875