FA-84396 / Betting odds conversion / Open access
Upper-case odds text rejected · case 01
"EVS" and "2/1 ON" are rejected or mispriced.
ROOT CAUSE
The text is not lower-cased before matching aliases and the suffix.
VERIFIED REPAIR
Lower-case before detecting the suffix and aliases.
Unsuccessful approach: Lower-casing after the suffix check still misses an upper-case " ON".
Case contract
Parse traditional fractional odds text, case-insensitively: "a/b" or "a-b" with positive integers, "evens"/"evs"/"even" for 1/1, and an optional trailing " on" meaning odds-on (the fraction is inverted, "2/1 on" = 1/2). Zero parts or anything else return "invalid". Return [decimal price rounded half up to two decimals, reduced profit fraction "a/b"].
Why this case matters
Racing feeds and manual price entry use traditional fractional notation with odds-on suffixes.
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(text):
t = text.strip()
on = t.endswith(' on')
if on:
t = t[:-3].strip()
if t in ('evens', 'evs', 'even'):
frac = Fraction(1)
else:
for sep in ('/', '-'):
if sep in t:
a, _, b = t.partition(sep)
break
else:
return 'invalid'
if not a.isdigit() or not b.isdigit() or int(b) == 0 or int(a) == 0:
return 'invalid'
frac = Fraction(int(a), int(b))
if on:
frac = 1 / frac
dec = 1 + frac
cents = math.floor(dec * 100 + Fraction(1, 2))
return ['%d.%02d' % (cents // 100, cents % 100), '%d/%d' % (frac.numerator, frac.denominator)]
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 five to two', ('5/2',), ['3.50', '5/2']),
('control hyphen separator', ('11-4',), ['3.75', '11/4']),
('boundary evens alias', ('EVS',), ['2.00', '1/1']),
('boundary odds-on suffix', ('2/1 on',), ['1.50', '1/2']),
('boundary unreduced input', ('4/6',), ['1.67', '2/3']),
('boundary zero denominator', ('5/0',), 'invalid'),
('control half-up rounding', ('1/8',), ['1.13', '1/8']),
('regression: case normalization', ('EVS',), ['2.00', '1/1']),
('regression: case normalization', ('12/11 ON',), ['1.92', '11/12']),
('variant scenario 1', ('11/13',), ['1.85', '11/13']),
('variant scenario 2', ('18/1',), ['19.00', '18/1'])],
[('control five to two', ('5/2',), ['3.50', '5/2']),
('control hyphen separator', ('11-4',), ['3.75', '11/4']),
('boundary evens alias', ('EVS',), ['2.00', '1/1']),
('boundary odds-on suffix', ('2/1 on',), ['1.50', '1/2']),
('boundary unreduced input', ('4/6',), ['1.67', '2/3']),
('boundary zero denominator', ('5/0',), 'invalid'),
('control half-up rounding', ('1/8',), ['1.13', '1/8']),
('regression: case normalization', ('Evens',), ['2.00', '1/1']),
('regression: case normalization', ('9/1 ON',), ['1.11', '1/9']),
('variant scenario 1', ('5/10',), ['1.50', '1/2']),
('variant scenario 2', ('16-5',), ['4.20', '16/5'])],
[('control five to two', ('5/2',), ['3.50', '5/2']),
('control hyphen separator', ('11-4',), ['3.75', '11/4']),
('boundary evens alias', ('EVS',), ['2.00', '1/1']),
('boundary odds-on suffix', ('2/1 on',), ['1.50', '1/2']),
('boundary unreduced input', ('4/6',), ['1.67', '2/3']),
('boundary zero denominator', ('5/0',), 'invalid'),
('control half-up rounding', ('1/8',), ['1.13', '1/8']),
('regression: case normalization', ('Evens',), ['2.00', '1/1']),
('regression: case normalization', ('2/13 ON',), ['7.50', '13/2']),
('variant scenario 1', ('5/13 on',), ['3.60', '13/5']),
('variant scenario 2', ('13/4',), ['4.25', '13/4'])],
[('control five to two', ('5/2',), ['3.50', '5/2']),
('control hyphen separator', ('11-4',), ['3.75', '11/4']),
('boundary evens alias', ('EVS',), ['2.00', '1/1']),
('boundary odds-on suffix', ('2/1 on',), ['1.50', '1/2']),
('boundary unreduced input', ('4/6',), ['1.67', '2/3']),
('boundary zero denominator', ('5/0',), 'invalid'),
('control half-up rounding', ('1/8',), ['1.13', '1/8']),
('regression: case normalization', ('16/10 ON',), ['1.63', '5/8']),
('variant scenario 1', ('2-1',), ['3.00', '2/1']),
('variant scenario 2', ('2/3',), ['1.67', '2/3'])],
[('control five to two', ('5/2',), ['3.50', '5/2']),
('control hyphen separator', ('11-4',), ['3.75', '11/4']),
('boundary evens alias', ('EVS',), ['2.00', '1/1']),
('boundary odds-on suffix', ('2/1 on',), ['1.50', '1/2']),
('boundary unreduced input', ('4/6',), ['1.67', '2/3']),
('boundary zero denominator', ('5/0',), 'invalid'),
('control half-up rounding', ('1/8',), ['1.13', '1/8']),
('regression: case normalization', ('Evens',), ['2.00', '1/1']),
('regression: case normalization', ('7-2 ON',), ['1.29', '2/7']),
('variant scenario 1', ('13/2 on',), ['1.15', '2/13']),
('variant scenario 2', ('11/3',), ['4.67', '11/3'])]]
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 five to two | ['3.50', '5/2'] | ['3.50', '5/2'] | Passed |
| control hyphen separator | ['3.75', '11/4'] | ['3.75', '11/4'] | Passed |
| boundary evens alias | invalid | ['2.00', '1/1'] | Failed |
| boundary odds-on suffix | ['1.50', '1/2'] | ['1.50', '1/2'] | Passed |
| boundary unreduced input | ['1.67', '2/3'] | ['1.67', '2/3'] | Passed |
| boundary zero denominator | invalid | invalid | Passed |
| control half-up rounding | ['1.13', '1/8'] | ['1.13', '1/8'] | Passed |
| regression: case normalization | invalid | ['2.00', '1/1'] | Failed |
| regression: case normalization | invalid | ['1.92', '11/12'] | Failed |
| variant scenario 1 | ['1.85', '11/13'] | ['1.85', '11/13'] | Passed |
| variant scenario 2 | ['19.00', '18/1'] | ['19.00', '18/1'] | Passed |
SHA-256 / 0c40df4cfac76f81633cf6d53a2b784d89a065bc72097b72414882e1d731a878
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(text):
on = text.strip().endswith(' on')
t = text.strip().lower()
if on:
t = t[:-3].strip()
if t in ('evens', 'evs', 'even'):
frac = Fraction(1)
else:
for sep in ('/', '-'):
if sep in t:
a, _, b = t.partition(sep)
break
else:
return 'invalid'
if not a.isdigit() or not b.isdigit() or int(b) == 0 or int(a) == 0:
return 'invalid'
frac = Fraction(int(a), int(b))
if on:
frac = 1 / frac
dec = 1 + frac
cents = math.floor(dec * 100 + Fraction(1, 2))
return ['%d.%02d' % (cents // 100, cents % 100), '%d/%d' % (frac.numerator, frac.denominator)]
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 five to two', ('5/2',), ['3.50', '5/2']),
('control hyphen separator', ('11-4',), ['3.75', '11/4']),
('boundary evens alias', ('EVS',), ['2.00', '1/1']),
('boundary odds-on suffix', ('2/1 on',), ['1.50', '1/2']),
('boundary unreduced input', ('4/6',), ['1.67', '2/3']),
('boundary zero denominator', ('5/0',), 'invalid'),
('control half-up rounding', ('1/8',), ['1.13', '1/8']),
('regression: case normalization', ('EVS',), ['2.00', '1/1']),
('regression: case normalization', ('12/11 ON',), ['1.92', '11/12']),
('variant scenario 1', ('11/13',), ['1.85', '11/13']),
('variant scenario 2', ('18/1',), ['19.00', '18/1'])],
[('control five to two', ('5/2',), ['3.50', '5/2']),
('control hyphen separator', ('11-4',), ['3.75', '11/4']),
('boundary evens alias', ('EVS',), ['2.00', '1/1']),
('boundary odds-on suffix', ('2/1 on',), ['1.50', '1/2']),
('boundary unreduced input', ('4/6',), ['1.67', '2/3']),
('boundary zero denominator', ('5/0',), 'invalid'),
('control half-up rounding', ('1/8',), ['1.13', '1/8']),
('regression: case normalization', ('Evens',), ['2.00', '1/1']),
('regression: case normalization', ('9/1 ON',), ['1.11', '1/9']),
('variant scenario 1', ('5/10',), ['1.50', '1/2']),
('variant scenario 2', ('16-5',), ['4.20', '16/5'])],
[('control five to two', ('5/2',), ['3.50', '5/2']),
('control hyphen separator', ('11-4',), ['3.75', '11/4']),
('boundary evens alias', ('EVS',), ['2.00', '1/1']),
('boundary odds-on suffix', ('2/1 on',), ['1.50', '1/2']),
('boundary unreduced input', ('4/6',), ['1.67', '2/3']),
('boundary zero denominator', ('5/0',), 'invalid'),
('control half-up rounding', ('1/8',), ['1.13', '1/8']),
('regression: case normalization', ('Evens',), ['2.00', '1/1']),
('regression: case normalization', ('2/13 ON',), ['7.50', '13/2']),
('variant scenario 1', ('5/13 on',), ['3.60', '13/5']),
('variant scenario 2', ('13/4',), ['4.25', '13/4'])],
[('control five to two', ('5/2',), ['3.50', '5/2']),
('control hyphen separator', ('11-4',), ['3.75', '11/4']),
('boundary evens alias', ('EVS',), ['2.00', '1/1']),
('boundary odds-on suffix', ('2/1 on',), ['1.50', '1/2']),
('boundary unreduced input', ('4/6',), ['1.67', '2/3']),
('boundary zero denominator', ('5/0',), 'invalid'),
('control half-up rounding', ('1/8',), ['1.13', '1/8']),
('regression: case normalization', ('16/10 ON',), ['1.63', '5/8']),
('variant scenario 1', ('2-1',), ['3.00', '2/1']),
('variant scenario 2', ('2/3',), ['1.67', '2/3'])],
[('control five to two', ('5/2',), ['3.50', '5/2']),
('control hyphen separator', ('11-4',), ['3.75', '11/4']),
('boundary evens alias', ('EVS',), ['2.00', '1/1']),
('boundary odds-on suffix', ('2/1 on',), ['1.50', '1/2']),
('boundary unreduced input', ('4/6',), ['1.67', '2/3']),
('boundary zero denominator', ('5/0',), 'invalid'),
('control half-up rounding', ('1/8',), ['1.13', '1/8']),
('regression: case normalization', ('Evens',), ['2.00', '1/1']),
('regression: case normalization', ('7-2 ON',), ['1.29', '2/7']),
('variant scenario 1', ('13/2 on',), ['1.15', '2/13']),
('variant scenario 2', ('11/3',), ['4.67', '11/3'])]]
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 five to two | ['3.50', '5/2'] | ['3.50', '5/2'] | Passed |
| control hyphen separator | ['3.75', '11/4'] | ['3.75', '11/4'] | Passed |
| boundary evens alias | ['2.00', '1/1'] | ['2.00', '1/1'] | Passed |
| boundary odds-on suffix | ['1.50', '1/2'] | ['1.50', '1/2'] | Passed |
| boundary unreduced input | ['1.67', '2/3'] | ['1.67', '2/3'] | Passed |
| boundary zero denominator | invalid | invalid | Passed |
| control half-up rounding | ['1.13', '1/8'] | ['1.13', '1/8'] | Passed |
| regression: case normalization | ['2.00', '1/1'] | ['2.00', '1/1'] | Passed |
| regression: case normalization | invalid | ['1.92', '11/12'] | Failed |
| variant scenario 1 | ['1.85', '11/13'] | ['1.85', '11/13'] | Passed |
| variant scenario 2 | ['19.00', '18/1'] | ['19.00', '18/1'] | Passed |
SHA-256 / fab7f37c3d4a9ac73adce8d63d56cd2c946bae1ac519add8f6a1c7526ecbd9a0
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(text):
t = text.strip().lower()
on = t.endswith(' on')
if on:
t = t[:-3].strip()
if t in ('evens', 'evs', 'even'):
frac = Fraction(1)
else:
for sep in ('/', '-'):
if sep in t:
a, _, b = t.partition(sep)
break
else:
return 'invalid'
if not a.isdigit() or not b.isdigit() or int(b) == 0 or int(a) == 0:
return 'invalid'
frac = Fraction(int(a), int(b))
if on:
frac = 1 / frac
dec = 1 + frac
cents = math.floor(dec * 100 + Fraction(1, 2))
return ['%d.%02d' % (cents // 100, cents % 100), '%d/%d' % (frac.numerator, frac.denominator)]
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 five to two', ('5/2',), ['3.50', '5/2']),
('control hyphen separator', ('11-4',), ['3.75', '11/4']),
('boundary evens alias', ('EVS',), ['2.00', '1/1']),
('boundary odds-on suffix', ('2/1 on',), ['1.50', '1/2']),
('boundary unreduced input', ('4/6',), ['1.67', '2/3']),
('boundary zero denominator', ('5/0',), 'invalid'),
('control half-up rounding', ('1/8',), ['1.13', '1/8']),
('regression: case normalization', ('EVS',), ['2.00', '1/1']),
('regression: case normalization', ('12/11 ON',), ['1.92', '11/12']),
('variant scenario 1', ('11/13',), ['1.85', '11/13']),
('variant scenario 2', ('18/1',), ['19.00', '18/1'])],
[('control five to two', ('5/2',), ['3.50', '5/2']),
('control hyphen separator', ('11-4',), ['3.75', '11/4']),
('boundary evens alias', ('EVS',), ['2.00', '1/1']),
('boundary odds-on suffix', ('2/1 on',), ['1.50', '1/2']),
('boundary unreduced input', ('4/6',), ['1.67', '2/3']),
('boundary zero denominator', ('5/0',), 'invalid'),
('control half-up rounding', ('1/8',), ['1.13', '1/8']),
('regression: case normalization', ('Evens',), ['2.00', '1/1']),
('regression: case normalization', ('9/1 ON',), ['1.11', '1/9']),
('variant scenario 1', ('5/10',), ['1.50', '1/2']),
('variant scenario 2', ('16-5',), ['4.20', '16/5'])],
[('control five to two', ('5/2',), ['3.50', '5/2']),
('control hyphen separator', ('11-4',), ['3.75', '11/4']),
('boundary evens alias', ('EVS',), ['2.00', '1/1']),
('boundary odds-on suffix', ('2/1 on',), ['1.50', '1/2']),
('boundary unreduced input', ('4/6',), ['1.67', '2/3']),
('boundary zero denominator', ('5/0',), 'invalid'),
('control half-up rounding', ('1/8',), ['1.13', '1/8']),
('regression: case normalization', ('Evens',), ['2.00', '1/1']),
('regression: case normalization', ('2/13 ON',), ['7.50', '13/2']),
('variant scenario 1', ('5/13 on',), ['3.60', '13/5']),
('variant scenario 2', ('13/4',), ['4.25', '13/4'])],
[('control five to two', ('5/2',), ['3.50', '5/2']),
('control hyphen separator', ('11-4',), ['3.75', '11/4']),
('boundary evens alias', ('EVS',), ['2.00', '1/1']),
('boundary odds-on suffix', ('2/1 on',), ['1.50', '1/2']),
('boundary unreduced input', ('4/6',), ['1.67', '2/3']),
('boundary zero denominator', ('5/0',), 'invalid'),
('control half-up rounding', ('1/8',), ['1.13', '1/8']),
('regression: case normalization', ('16/10 ON',), ['1.63', '5/8']),
('variant scenario 1', ('2-1',), ['3.00', '2/1']),
('variant scenario 2', ('2/3',), ['1.67', '2/3'])],
[('control five to two', ('5/2',), ['3.50', '5/2']),
('control hyphen separator', ('11-4',), ['3.75', '11/4']),
('boundary evens alias', ('EVS',), ['2.00', '1/1']),
('boundary odds-on suffix', ('2/1 on',), ['1.50', '1/2']),
('boundary unreduced input', ('4/6',), ['1.67', '2/3']),
('boundary zero denominator', ('5/0',), 'invalid'),
('control half-up rounding', ('1/8',), ['1.13', '1/8']),
('regression: case normalization', ('Evens',), ['2.00', '1/1']),
('regression: case normalization', ('7-2 ON',), ['1.29', '2/7']),
('variant scenario 1', ('13/2 on',), ['1.15', '2/13']),
('variant scenario 2', ('11/3',), ['4.67', '11/3'])]]
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 five to two | ['3.50', '5/2'] | ['3.50', '5/2'] | Passed |
| control hyphen separator | ['3.75', '11/4'] | ['3.75', '11/4'] | Passed |
| boundary evens alias | ['2.00', '1/1'] | ['2.00', '1/1'] | Passed |
| boundary odds-on suffix | ['1.50', '1/2'] | ['1.50', '1/2'] | Passed |
| boundary unreduced input | ['1.67', '2/3'] | ['1.67', '2/3'] | Passed |
| boundary zero denominator | invalid | invalid | Passed |
| control half-up rounding | ['1.13', '1/8'] | ['1.13', '1/8'] | Passed |
| regression: case normalization | ['2.00', '1/1'] | ['2.00', '1/1'] | Passed |
| regression: case normalization | ['1.92', '11/12'] | ['1.92', '11/12'] | Passed |
| variant scenario 1 | ['1.85', '11/13'] | ['1.85', '11/13'] | Passed |
| variant scenario 2 | ['19.00', '18/1'] | ['19.00', '18/1'] | Passed |
SHA-256 / 2664aa351b96c645ce361d64a5b1b53aca563bdedfa554e909b50f222595976e
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.508592+00:00.
Case digest / 38c6252f1a4e6ce23fdef3295080072dd7dc9e5670ea77e67024cff1e2ea3171