FA-84346 / Betting odds conversion / Open access
Moneyline magnitude truncated or banker-rounded · case 01
A 2.005 price shows +100 instead of +101.
ROOT CAUSE
The magnitude is truncated toward zero.
THE FAILURE
The magnitude is truncated toward zero.
Unsuccessful approach: Python's round() on the exact Fraction rounds exact halves to even.
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 = int(v)
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: magnitude rounding', ('2.217',), '+122'),
('regression: magnitude rounding', ('2.005',), '+101'),
('variant scenario 1', ('11.70',), '+1070'),
('variant scenario 2', ('2.00',), '+100')],
[('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: magnitude rounding', ('2.005',), '+101'),
('variant scenario 1', ('1.078',), '-1282'),
('variant scenario 2', ('11.34',), '+1034')],
[('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: magnitude rounding', ('2.125',), '+113'),
('variant scenario 1', ('7.99',), '+699'),
('variant scenario 2', ('9.28',), '+828')],
[('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: magnitude rounding', ('3.125',), '+213'),
('variant scenario 1', ('7.98',), '+698'),
('variant scenario 2', ('2.77',), '+177')],
[('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: magnitude rounding', ('1.538',), '-186'),
('regression: magnitude rounding', ('2.125',), '+113'),
('variant scenario 1', ('2.490',), '+149'),
('variant scenario 2', ('1.074',), '-1351')]]
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 underdog | +150 | +150 | Passed |
| control favourite | -200 | -200 | Passed |
| boundary evens | +100 | +100 | Passed |
| boundary half-cent rounds up | +100 | +101 | Failed |
| boundary no-profit price | invalid | invalid | Passed |
| control short favourite | -1250 | -1250 | Passed |
| regression: magnitude rounding | +121 | +122 | Failed |
| regression: magnitude rounding | +100 | +101 | Failed |
| variant scenario 1 | +1070 | +1070 | Passed |
| variant scenario 2 | +100 | +100 | Passed |
SHA-256 / e6a22faba0b9804620b776a30f4c968c587afab5fe6f055c64a3e0981afd985f
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 <= 1:
return 'invalid'
if d >= 2:
v = (d - 1) * 100
sign = '+'
else:
v = 100 / (d - 1)
sign = '-'
n = round(v)
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: magnitude rounding', ('2.217',), '+122'),
('regression: magnitude rounding', ('2.005',), '+101'),
('variant scenario 1', ('11.70',), '+1070'),
('variant scenario 2', ('2.00',), '+100')],
[('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: magnitude rounding', ('2.005',), '+101'),
('variant scenario 1', ('1.078',), '-1282'),
('variant scenario 2', ('11.34',), '+1034')],
[('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: magnitude rounding', ('2.125',), '+113'),
('variant scenario 1', ('7.99',), '+699'),
('variant scenario 2', ('9.28',), '+828')],
[('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: magnitude rounding', ('3.125',), '+213'),
('variant scenario 1', ('7.98',), '+698'),
('variant scenario 2', ('2.77',), '+177')],
[('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: magnitude rounding', ('1.538',), '-186'),
('regression: magnitude rounding', ('2.125',), '+113'),
('variant scenario 1', ('2.490',), '+149'),
('variant scenario 2', ('1.074',), '-1351')]]
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 underdog | +150 | +150 | Passed |
| control favourite | -200 | -200 | Passed |
| boundary evens | +100 | +100 | Passed |
| boundary half-cent rounds up | +100 | +101 | Failed |
| boundary no-profit price | invalid | invalid | Passed |
| control short favourite | -1250 | -1250 | Passed |
| regression: magnitude rounding | +122 | +122 | Passed |
| regression: magnitude rounding | +100 | +101 | Failed |
| variant scenario 1 | +1070 | +1070 | Passed |
| variant scenario 2 | +100 | +100 | Passed |
SHA-256 / 882e3e13725d57eb2462beea6a490d0e583b322f1dd745dc92937dab62f8dcec
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:29.873678+00:00.
Case digest / 6fa00e3619b4701d94bb8da5af45796c02efdcaca29930197b64c6b081ff6b25