FAILURE MAP
← Case archive

FA-84356 / Betting odds conversion / Open access

Decimal price of 1.00 not rejected · case 01

A 1.00 price raises a division error instead of returning invalid.

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

ROOT CAUSE

The guard only rejects prices below 1.

THE FAILURE

The guard only rejects prices below 1.

Unsuccessful approach: Rejecting only non-positive prices still divides by zero at 1.00.

Case contract

Convert a decimal price string to an American moneyline string. Prices at or below 1 return "invalid". For d >= 2 the line is "+" followed by 100 * (d - 1); for d < 2 it is "-" followed by 100 / (d - 1). The magnitude is computed exactly from the decimal text and rounded half up to an integer. Evens (2.00) is "+100".

Why this case matters

Sportsbooks display the same price in decimal and American formats and must agree at every boundary.

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(decimal):
    d = Fraction(decimal)
    if d < 1:
        return 'invalid'
    if d >= 2:
        v = (d - 1) * 100
        sign = '+'
    else:
        v = 100 / (d - 1)
        sign = '-'
    n = math.floor(v + Fraction(1, 2))
    return sign + str(n)
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', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('2.125',), '+113'),
  ('variant scenario 2', ('2.56',), '+156')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('0.95',), 'invalid'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('9.66',), '+866'),
  ('variant scenario 2', ('3.95',), '+295')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('2.00',), '+100'),
  ('variant scenario 2', ('1.82',), '-122')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('0.95',), 'invalid'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('8.63',), '+763'),
  ('variant scenario 2', ('1.916',), '-109')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('0.95',), 'invalid'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('1.188',), '-532'),
  ('variant scenario 2', ('3.17',), '+217')]]
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+150+150Passed
control favourite-200-200Passed
boundary evens+100+100Passed
boundary half-cent rounds up+101+101Passed
boundary no-profit priceraised ZeroDivisionErrorinvalidFailed
control short favourite-1250-1250Passed
regression: no profit guardraised ZeroDivisionErrorinvalidFailed
variant scenario 1+113+113Passed
variant scenario 2+156+156Passed

SHA-256 / 8eed7860d8dddc07be42c548be6b006a26398394524b80d775736d066981ee25

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(decimal):
    d = Fraction(decimal)
    if d <= 0:
        return 'invalid'
    if d >= 2:
        v = (d - 1) * 100
        sign = '+'
    else:
        v = 100 / (d - 1)
        sign = '-'
    n = math.floor(v + Fraction(1, 2))
    return sign + str(n)
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', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('2.125',), '+113'),
  ('variant scenario 2', ('2.56',), '+156')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('0.95',), 'invalid'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('9.66',), '+866'),
  ('variant scenario 2', ('3.95',), '+295')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('2.00',), '+100'),
  ('variant scenario 2', ('1.82',), '-122')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('0.95',), 'invalid'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('8.63',), '+763'),
  ('variant scenario 2', ('1.916',), '-109')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('0.95',), 'invalid'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('1.188',), '-532'),
  ('variant scenario 2', ('3.17',), '+217')]]
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+150+150Passed
control favourite-200-200Passed
boundary evens+100+100Passed
boundary half-cent rounds up+101+101Passed
boundary no-profit priceraised ZeroDivisionErrorinvalidFailed
control short favourite-1250-1250Passed
regression: no profit guardraised ZeroDivisionErrorinvalidFailed
variant scenario 1+113+113Passed
variant scenario 2+156+156Passed

SHA-256 / ce21bcf20e8663c424093c89fe1bbd94b5e864e5b52250be717c3cdb047c29e1

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 9 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.056875+00:00.

Case digest / 8ce0c5159e884f9ea6526528da63ced9327296e209a1941a210083c4f14879b8