FAILURE MAP
← Case archive

FA-84681 / Betting odds conversion / Open access

Decimal comma rejected or read as a thousands separator · case 01

"2,50" is rejected or becomes a +250 American line.

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

ROOT CAUSE

The comma is not converted to a decimal point.

VERIFIED REPAIR

Replace a comma with a decimal point in the decimal branch.

Unsuccessful approach: Stripping the comma as a thousands separator turns "2,50" into 250.

Case contract

Normalise user-typed odds to a decimal price string with two decimals (half up). Detection order: text containing "/" is fractional a/b; text starting with "+" or "-" is American (magnitude >= 100); an unsigned integer >= 100 is a positive American line; anything else is a decimal price, where a comma is the decimal separator ("2,50"). Unparseable input, zero denominators, magnitudes below 100 and results not above 1 return "invalid".

Why this case matters

Bet-slip inputs accept several odds formats and must not misclassify ambiguous text.

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()
    try:
        if '/' in t:
            a, b = t.split('/')
            dec = 1 + Fraction(int(a), int(b))
        elif t[:1] in ('+', '-'):
            n = int(t[1:])
            if n < 100:
                return 'invalid'
            dec = 1 + (Fraction(n, 100) if t[0] == '+' else Fraction(100, n))
        elif t.isdigit() and int(t) >= 100:
            dec = 1 + Fraction(int(t), 100)
        else:
            dec = Fraction(t)
    except (ValueError, ZeroDivisionError):
        return 'invalid'
    if dec <= 1:
        return 'invalid'
    c = math.floor(dec * 100 + Fraction(1, 2))
    return '%d.%02d' % (c // 100, c % 100)
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 fractional', ('5/2',), '3.50'),
  ('control negative american', ('-110',), '1.91'),
  ('boundary unsigned hundred', ('100',), '2.00'),
  ('boundary small integer is decimal', ('3',), '3.00'),
  ('boundary decimal comma', ('2,50',), '2.50'),
  ('control empty input', ('',), 'invalid'),
  ('regression: decimal comma', ('7,89',), '7.89'),
  ('variant scenario 1', ('3.40',), '3.40'),
  ('variant scenario 2', ('-372',), '1.27')],
 [('control fractional', ('5/2',), '3.50'),
  ('control negative american', ('-110',), '1.91'),
  ('boundary unsigned hundred', ('100',), '2.00'),
  ('boundary small integer is decimal', ('3',), '3.00'),
  ('boundary decimal comma', ('2,50',), '2.50'),
  ('control empty input', ('',), 'invalid'),
  ('regression: decimal comma', ('6,60',), '6.60'),
  ('variant scenario 1', ('3.47',), '3.47'),
  ('variant scenario 2', ('+536',), '6.36')],
 [('control fractional', ('5/2',), '3.50'),
  ('control negative american', ('-110',), '1.91'),
  ('boundary unsigned hundred', ('100',), '2.00'),
  ('boundary small integer is decimal', ('3',), '3.00'),
  ('boundary decimal comma', ('2,50',), '2.50'),
  ('control empty input', ('',), 'invalid'),
  ('regression: decimal comma', ('6,37',), '6.37'),
  ('variant scenario 1', ('+584',), '6.84'),
  ('variant scenario 2', ('1,75',), '1.75')],
 [('control fractional', ('5/2',), '3.50'),
  ('control negative american', ('-110',), '1.91'),
  ('boundary unsigned hundred', ('100',), '2.00'),
  ('boundary small integer is decimal', ('3',), '3.00'),
  ('boundary decimal comma', ('2,50',), '2.50'),
  ('control empty input', ('',), 'invalid'),
  ('regression: decimal comma', ('3,22',), '3.22'),
  ('variant scenario 1', ('10/2',), '6.00'),
  ('variant scenario 2', ('2/8',), '1.25')],
 [('control fractional', ('5/2',), '3.50'),
  ('control negative american', ('-110',), '1.91'),
  ('boundary unsigned hundred', ('100',), '2.00'),
  ('boundary small integer is decimal', ('3',), '3.00'),
  ('boundary decimal comma', ('2,50',), '2.50'),
  ('control empty input', ('',), 'invalid'),
  ('regression: decimal comma', ('1,75',), '1.75'),
  ('variant scenario 1', ('6.74',), '6.74'),
  ('variant scenario 2', ('+195',), '2.95')]]
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 fractional3.503.50Passed
control negative american1.911.91Passed
boundary unsigned hundred2.002.00Passed
boundary small integer is decimal3.003.00Passed
boundary decimal commainvalid2.50Failed
control empty inputinvalidinvalidPassed
regression: decimal commainvalid7.89Failed
variant scenario 13.403.40Passed
variant scenario 21.271.27Passed

SHA-256 / f7abd6b447a2bf1209a951d4185bbf917f0bdd7202766fbd74ed82672fd29c76

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):
    t = text.strip()
    try:
        if '/' in t:
            a, b = t.split('/')
            dec = 1 + Fraction(int(a), int(b))
        elif t[:1] in ('+', '-'):
            n = int(t[1:])
            if n < 100:
                return 'invalid'
            dec = 1 + (Fraction(n, 100) if t[0] == '+' else Fraction(100, n))
        elif t.isdigit() and int(t) >= 100:
            dec = 1 + Fraction(int(t), 100)
        else:
            dec = Fraction(t.replace(',', ''))
    except (ValueError, ZeroDivisionError):
        return 'invalid'
    if dec <= 1:
        return 'invalid'
    c = math.floor(dec * 100 + Fraction(1, 2))
    return '%d.%02d' % (c // 100, c % 100)
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 fractional', ('5/2',), '3.50'),
  ('control negative american', ('-110',), '1.91'),
  ('boundary unsigned hundred', ('100',), '2.00'),
  ('boundary small integer is decimal', ('3',), '3.00'),
  ('boundary decimal comma', ('2,50',), '2.50'),
  ('control empty input', ('',), 'invalid'),
  ('regression: decimal comma', ('7,89',), '7.89'),
  ('variant scenario 1', ('3.40',), '3.40'),
  ('variant scenario 2', ('-372',), '1.27')],
 [('control fractional', ('5/2',), '3.50'),
  ('control negative american', ('-110',), '1.91'),
  ('boundary unsigned hundred', ('100',), '2.00'),
  ('boundary small integer is decimal', ('3',), '3.00'),
  ('boundary decimal comma', ('2,50',), '2.50'),
  ('control empty input', ('',), 'invalid'),
  ('regression: decimal comma', ('6,60',), '6.60'),
  ('variant scenario 1', ('3.47',), '3.47'),
  ('variant scenario 2', ('+536',), '6.36')],
 [('control fractional', ('5/2',), '3.50'),
  ('control negative american', ('-110',), '1.91'),
  ('boundary unsigned hundred', ('100',), '2.00'),
  ('boundary small integer is decimal', ('3',), '3.00'),
  ('boundary decimal comma', ('2,50',), '2.50'),
  ('control empty input', ('',), 'invalid'),
  ('regression: decimal comma', ('6,37',), '6.37'),
  ('variant scenario 1', ('+584',), '6.84'),
  ('variant scenario 2', ('1,75',), '1.75')],
 [('control fractional', ('5/2',), '3.50'),
  ('control negative american', ('-110',), '1.91'),
  ('boundary unsigned hundred', ('100',), '2.00'),
  ('boundary small integer is decimal', ('3',), '3.00'),
  ('boundary decimal comma', ('2,50',), '2.50'),
  ('control empty input', ('',), 'invalid'),
  ('regression: decimal comma', ('3,22',), '3.22'),
  ('variant scenario 1', ('10/2',), '6.00'),
  ('variant scenario 2', ('2/8',), '1.25')],
 [('control fractional', ('5/2',), '3.50'),
  ('control negative american', ('-110',), '1.91'),
  ('boundary unsigned hundred', ('100',), '2.00'),
  ('boundary small integer is decimal', ('3',), '3.00'),
  ('boundary decimal comma', ('2,50',), '2.50'),
  ('control empty input', ('',), 'invalid'),
  ('regression: decimal comma', ('1,75',), '1.75'),
  ('variant scenario 1', ('6.74',), '6.74'),
  ('variant scenario 2', ('+195',), '2.95')]]
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 fractional3.503.50Passed
control negative american1.911.91Passed
boundary unsigned hundred2.002.00Passed
boundary small integer is decimal3.003.00Passed
boundary decimal comma250.002.50Failed
control empty inputinvalidinvalidPassed
regression: decimal comma789.007.89Failed
variant scenario 13.403.40Passed
variant scenario 21.271.27Passed

SHA-256 / 629fec38f293c63d14dc3ae1f4297a1689dd167c6073687df1a2d66cbf7153ed

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()
    try:
        if '/' in t:
            a, b = t.split('/')
            dec = 1 + Fraction(int(a), int(b))
        elif t[:1] in ('+', '-'):
            n = int(t[1:])
            if n < 100:
                return 'invalid'
            dec = 1 + (Fraction(n, 100) if t[0] == '+' else Fraction(100, n))
        elif t.isdigit() and int(t) >= 100:
            dec = 1 + Fraction(int(t), 100)
        else:
            dec = Fraction(t.replace(',', '.'))
    except (ValueError, ZeroDivisionError):
        return 'invalid'
    if dec <= 1:
        return 'invalid'
    c = math.floor(dec * 100 + Fraction(1, 2))
    return '%d.%02d' % (c // 100, c % 100)
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 fractional', ('5/2',), '3.50'),
  ('control negative american', ('-110',), '1.91'),
  ('boundary unsigned hundred', ('100',), '2.00'),
  ('boundary small integer is decimal', ('3',), '3.00'),
  ('boundary decimal comma', ('2,50',), '2.50'),
  ('control empty input', ('',), 'invalid'),
  ('regression: decimal comma', ('7,89',), '7.89'),
  ('variant scenario 1', ('3.40',), '3.40'),
  ('variant scenario 2', ('-372',), '1.27')],
 [('control fractional', ('5/2',), '3.50'),
  ('control negative american', ('-110',), '1.91'),
  ('boundary unsigned hundred', ('100',), '2.00'),
  ('boundary small integer is decimal', ('3',), '3.00'),
  ('boundary decimal comma', ('2,50',), '2.50'),
  ('control empty input', ('',), 'invalid'),
  ('regression: decimal comma', ('6,60',), '6.60'),
  ('variant scenario 1', ('3.47',), '3.47'),
  ('variant scenario 2', ('+536',), '6.36')],
 [('control fractional', ('5/2',), '3.50'),
  ('control negative american', ('-110',), '1.91'),
  ('boundary unsigned hundred', ('100',), '2.00'),
  ('boundary small integer is decimal', ('3',), '3.00'),
  ('boundary decimal comma', ('2,50',), '2.50'),
  ('control empty input', ('',), 'invalid'),
  ('regression: decimal comma', ('6,37',), '6.37'),
  ('variant scenario 1', ('+584',), '6.84'),
  ('variant scenario 2', ('1,75',), '1.75')],
 [('control fractional', ('5/2',), '3.50'),
  ('control negative american', ('-110',), '1.91'),
  ('boundary unsigned hundred', ('100',), '2.00'),
  ('boundary small integer is decimal', ('3',), '3.00'),
  ('boundary decimal comma', ('2,50',), '2.50'),
  ('control empty input', ('',), 'invalid'),
  ('regression: decimal comma', ('3,22',), '3.22'),
  ('variant scenario 1', ('10/2',), '6.00'),
  ('variant scenario 2', ('2/8',), '1.25')],
 [('control fractional', ('5/2',), '3.50'),
  ('control negative american', ('-110',), '1.91'),
  ('boundary unsigned hundred', ('100',), '2.00'),
  ('boundary small integer is decimal', ('3',), '3.00'),
  ('boundary decimal comma', ('2,50',), '2.50'),
  ('control empty input', ('',), 'invalid'),
  ('regression: decimal comma', ('1,75',), '1.75'),
  ('variant scenario 1', ('6.74',), '6.74'),
  ('variant scenario 2', ('+195',), '2.95')]]
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 fractional3.503.50Passed
control negative american1.911.91Passed
boundary unsigned hundred2.002.00Passed
boundary small integer is decimal3.003.00Passed
boundary decimal comma2.502.50Passed
control empty inputinvalidinvalidPassed
regression: decimal comma7.897.89Passed
variant scenario 13.403.40Passed
variant scenario 21.271.27Passed

SHA-256 / 6d522091134104277626cc0570538bca5c4b1f07b57a48fc663a0c815d64c2b6

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

Case digest / d25e3903b89e3cad4eba8b11b7f75e8f44a32ac451fae519fc9ec6adafd22c2f