FA-84456 / Betting odds conversion / Open access
Negative Malay price computed as negated profit · case 01
A 2.25 price shows -1.25 instead of -0.80 in Malay format.
ROOT CAUSE
The negative branch negates d - 1 instead of taking -1 / (d - 1).
VERIFIED REPAIR
Use -1 / (d - 1) above evens.
Unsuccessful approach: Using -1 / d confuses the Malay price with an implied probability.
Case contract
Convert a decimal price (> 1, else "invalid") to an Asian odds style. hk: d - 1. malay: d - 1 when d <= 2, else -1 / (d - 1). indo: d - 1 when d >= 2, else -1 / (d - 1). Other styles return "invalid style". Values are rounded half away from zero to two decimals and formatted with a leading "-" for negatives.
Why this case matters
Asian-facing sportsbooks show Hong Kong, Malay and Indonesian prices with sign conventions.
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, style):
def fmt(x):
sign = '-' if x < 0 else ''
c = math.floor(abs(x) * 100 + Fraction(1, 2))
return sign + '%d.%02d' % (c // 100, c % 100)
d = Fraction(decimal)
if d <= 1:
return 'invalid'
if style == 'hk':
v = d - 1
elif style == 'malay':
v = d - 1 if d <= 2 else -(d - 1)
elif style == 'indo':
v = d - 1 if d >= 2 else -1 / (d - 1)
else:
return 'invalid style'
return fmt(v)
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 hong kong', ('1.85', 'hk'), '0.85'),
('control malay positive', ('1.80', 'malay'), '0.80'),
('control malay negative', ('2.25', 'malay'), '-0.80'),
('boundary malay evens', ('2.00', 'malay'), '1.00'),
('control indo negative', ('1.80', 'indo'), '-1.25'),
('boundary indo half rounds away', ('9.00', 'malay'), '-0.13'),
('regression: malay negative formula', ('2.25', 'malay'), '-0.80'),
('variant scenario 1', ('1.620', 'indo'), '-1.61'),
('variant scenario 2', ('1.679', 'indo'), '-1.47')],
[('control hong kong', ('1.85', 'hk'), '0.85'),
('control malay positive', ('1.80', 'malay'), '0.80'),
('control malay negative', ('2.25', 'malay'), '-0.80'),
('boundary malay evens', ('2.00', 'malay'), '1.00'),
('control indo negative', ('1.80', 'indo'), '-1.25'),
('boundary indo half rounds away', ('9.00', 'malay'), '-0.13'),
('regression: malay negative formula', ('2.40', 'malay'), '-0.71'),
('variant scenario 1', ('1.00', 'us'), 'invalid'),
('variant scenario 2', ('1.80', 'indo'), '-1.25')],
[('control hong kong', ('1.85', 'hk'), '0.85'),
('control malay positive', ('1.80', 'malay'), '0.80'),
('control malay negative', ('2.25', 'malay'), '-0.80'),
('boundary malay evens', ('2.00', 'malay'), '1.00'),
('control indo negative', ('1.80', 'indo'), '-1.25'),
('boundary indo half rounds away', ('9.00', 'malay'), '-0.13'),
('regression: malay negative formula', ('9.00', 'malay'), '-0.13'),
('variant scenario 1', ('9.00', 'us'), 'invalid style'),
('variant scenario 2', ('9.00', 'indo'), '8.00')],
[('control hong kong', ('1.85', 'hk'), '0.85'),
('control malay positive', ('1.80', 'malay'), '0.80'),
('control malay negative', ('2.25', 'malay'), '-0.80'),
('boundary malay evens', ('2.00', 'malay'), '1.00'),
('control indo negative', ('1.80', 'indo'), '-1.25'),
('boundary indo half rounds away', ('9.00', 'malay'), '-0.13'),
('regression: malay negative formula', ('2.25', 'malay'), '-0.80'),
('variant scenario 1', ('9.00', 'indo'), '8.00'),
('variant scenario 2', ('1.00', 'malay'), 'invalid')],
[('control hong kong', ('1.85', 'hk'), '0.85'),
('control malay positive', ('1.80', 'malay'), '0.80'),
('control malay negative', ('2.25', 'malay'), '-0.80'),
('boundary malay evens', ('2.00', 'malay'), '1.00'),
('control indo negative', ('1.80', 'indo'), '-1.25'),
('boundary indo half rounds away', ('9.00', 'malay'), '-0.13'),
('regression: malay negative formula', ('2.399', 'malay'), '-0.71'),
('variant scenario 1', ('1.80', 'indo'), '-1.25'),
('variant scenario 2', ('1.80', 'malay'), '0.80')]]
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 hong kong | 0.85 | 0.85 | Passed |
| control malay positive | 0.80 | 0.80 | Passed |
| control malay negative | -1.25 | -0.80 | Failed |
| boundary malay evens | 1.00 | 1.00 | Passed |
| control indo negative | -1.25 | -1.25 | Passed |
| boundary indo half rounds away | -8.00 | -0.13 | Failed |
| regression: malay negative formula | -1.25 | -0.80 | Failed |
| variant scenario 1 | -1.61 | -1.61 | Passed |
| variant scenario 2 | -1.47 | -1.47 | Passed |
SHA-256 / 022d887c0ad4c75fc398a7058bd0ba24f1e52d9537a0ac5029dc01c1e0195e67
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, style):
def fmt(x):
sign = '-' if x < 0 else ''
c = math.floor(abs(x) * 100 + Fraction(1, 2))
return sign + '%d.%02d' % (c // 100, c % 100)
d = Fraction(decimal)
if d <= 1:
return 'invalid'
if style == 'hk':
v = d - 1
elif style == 'malay':
v = d - 1 if d <= 2 else -1 / d
elif style == 'indo':
v = d - 1 if d >= 2 else -1 / (d - 1)
else:
return 'invalid style'
return fmt(v)
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 hong kong', ('1.85', 'hk'), '0.85'),
('control malay positive', ('1.80', 'malay'), '0.80'),
('control malay negative', ('2.25', 'malay'), '-0.80'),
('boundary malay evens', ('2.00', 'malay'), '1.00'),
('control indo negative', ('1.80', 'indo'), '-1.25'),
('boundary indo half rounds away', ('9.00', 'malay'), '-0.13'),
('regression: malay negative formula', ('2.25', 'malay'), '-0.80'),
('variant scenario 1', ('1.620', 'indo'), '-1.61'),
('variant scenario 2', ('1.679', 'indo'), '-1.47')],
[('control hong kong', ('1.85', 'hk'), '0.85'),
('control malay positive', ('1.80', 'malay'), '0.80'),
('control malay negative', ('2.25', 'malay'), '-0.80'),
('boundary malay evens', ('2.00', 'malay'), '1.00'),
('control indo negative', ('1.80', 'indo'), '-1.25'),
('boundary indo half rounds away', ('9.00', 'malay'), '-0.13'),
('regression: malay negative formula', ('2.40', 'malay'), '-0.71'),
('variant scenario 1', ('1.00', 'us'), 'invalid'),
('variant scenario 2', ('1.80', 'indo'), '-1.25')],
[('control hong kong', ('1.85', 'hk'), '0.85'),
('control malay positive', ('1.80', 'malay'), '0.80'),
('control malay negative', ('2.25', 'malay'), '-0.80'),
('boundary malay evens', ('2.00', 'malay'), '1.00'),
('control indo negative', ('1.80', 'indo'), '-1.25'),
('boundary indo half rounds away', ('9.00', 'malay'), '-0.13'),
('regression: malay negative formula', ('9.00', 'malay'), '-0.13'),
('variant scenario 1', ('9.00', 'us'), 'invalid style'),
('variant scenario 2', ('9.00', 'indo'), '8.00')],
[('control hong kong', ('1.85', 'hk'), '0.85'),
('control malay positive', ('1.80', 'malay'), '0.80'),
('control malay negative', ('2.25', 'malay'), '-0.80'),
('boundary malay evens', ('2.00', 'malay'), '1.00'),
('control indo negative', ('1.80', 'indo'), '-1.25'),
('boundary indo half rounds away', ('9.00', 'malay'), '-0.13'),
('regression: malay negative formula', ('2.25', 'malay'), '-0.80'),
('variant scenario 1', ('9.00', 'indo'), '8.00'),
('variant scenario 2', ('1.00', 'malay'), 'invalid')],
[('control hong kong', ('1.85', 'hk'), '0.85'),
('control malay positive', ('1.80', 'malay'), '0.80'),
('control malay negative', ('2.25', 'malay'), '-0.80'),
('boundary malay evens', ('2.00', 'malay'), '1.00'),
('control indo negative', ('1.80', 'indo'), '-1.25'),
('boundary indo half rounds away', ('9.00', 'malay'), '-0.13'),
('regression: malay negative formula', ('2.399', 'malay'), '-0.71'),
('variant scenario 1', ('1.80', 'indo'), '-1.25'),
('variant scenario 2', ('1.80', 'malay'), '0.80')]]
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 hong kong | 0.85 | 0.85 | Passed |
| control malay positive | 0.80 | 0.80 | Passed |
| control malay negative | -0.44 | -0.80 | Failed |
| boundary malay evens | 1.00 | 1.00 | Passed |
| control indo negative | -1.25 | -1.25 | Passed |
| boundary indo half rounds away | -0.11 | -0.13 | Failed |
| regression: malay negative formula | -0.44 | -0.80 | Failed |
| variant scenario 1 | -1.61 | -1.61 | Passed |
| variant scenario 2 | -1.47 | -1.47 | Passed |
SHA-256 / 40b18f089acd16eb9f1388f78f950dc836f6f36864a218a3c82f3945ccdcfb4c
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(decimal, style):
def fmt(x):
sign = '-' if x < 0 else ''
c = math.floor(abs(x) * 100 + Fraction(1, 2))
return sign + '%d.%02d' % (c // 100, c % 100)
d = Fraction(decimal)
if d <= 1:
return 'invalid'
if style == 'hk':
v = d - 1
elif style == 'malay':
v = d - 1 if d <= 2 else -1 / (d - 1)
elif style == 'indo':
v = d - 1 if d >= 2 else -1 / (d - 1)
else:
return 'invalid style'
return fmt(v)
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 hong kong', ('1.85', 'hk'), '0.85'),
('control malay positive', ('1.80', 'malay'), '0.80'),
('control malay negative', ('2.25', 'malay'), '-0.80'),
('boundary malay evens', ('2.00', 'malay'), '1.00'),
('control indo negative', ('1.80', 'indo'), '-1.25'),
('boundary indo half rounds away', ('9.00', 'malay'), '-0.13'),
('regression: malay negative formula', ('2.25', 'malay'), '-0.80'),
('variant scenario 1', ('1.620', 'indo'), '-1.61'),
('variant scenario 2', ('1.679', 'indo'), '-1.47')],
[('control hong kong', ('1.85', 'hk'), '0.85'),
('control malay positive', ('1.80', 'malay'), '0.80'),
('control malay negative', ('2.25', 'malay'), '-0.80'),
('boundary malay evens', ('2.00', 'malay'), '1.00'),
('control indo negative', ('1.80', 'indo'), '-1.25'),
('boundary indo half rounds away', ('9.00', 'malay'), '-0.13'),
('regression: malay negative formula', ('2.40', 'malay'), '-0.71'),
('variant scenario 1', ('1.00', 'us'), 'invalid'),
('variant scenario 2', ('1.80', 'indo'), '-1.25')],
[('control hong kong', ('1.85', 'hk'), '0.85'),
('control malay positive', ('1.80', 'malay'), '0.80'),
('control malay negative', ('2.25', 'malay'), '-0.80'),
('boundary malay evens', ('2.00', 'malay'), '1.00'),
('control indo negative', ('1.80', 'indo'), '-1.25'),
('boundary indo half rounds away', ('9.00', 'malay'), '-0.13'),
('regression: malay negative formula', ('9.00', 'malay'), '-0.13'),
('variant scenario 1', ('9.00', 'us'), 'invalid style'),
('variant scenario 2', ('9.00', 'indo'), '8.00')],
[('control hong kong', ('1.85', 'hk'), '0.85'),
('control malay positive', ('1.80', 'malay'), '0.80'),
('control malay negative', ('2.25', 'malay'), '-0.80'),
('boundary malay evens', ('2.00', 'malay'), '1.00'),
('control indo negative', ('1.80', 'indo'), '-1.25'),
('boundary indo half rounds away', ('9.00', 'malay'), '-0.13'),
('regression: malay negative formula', ('2.25', 'malay'), '-0.80'),
('variant scenario 1', ('9.00', 'indo'), '8.00'),
('variant scenario 2', ('1.00', 'malay'), 'invalid')],
[('control hong kong', ('1.85', 'hk'), '0.85'),
('control malay positive', ('1.80', 'malay'), '0.80'),
('control malay negative', ('2.25', 'malay'), '-0.80'),
('boundary malay evens', ('2.00', 'malay'), '1.00'),
('control indo negative', ('1.80', 'indo'), '-1.25'),
('boundary indo half rounds away', ('9.00', 'malay'), '-0.13'),
('regression: malay negative formula', ('2.399', 'malay'), '-0.71'),
('variant scenario 1', ('1.80', 'indo'), '-1.25'),
('variant scenario 2', ('1.80', 'malay'), '0.80')]]
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 hong kong | 0.85 | 0.85 | Passed |
| control malay positive | 0.80 | 0.80 | Passed |
| control malay negative | -0.80 | -0.80 | Passed |
| boundary malay evens | 1.00 | 1.00 | Passed |
| control indo negative | -1.25 | -1.25 | Passed |
| boundary indo half rounds away | -0.13 | -0.13 | Passed |
| regression: malay negative formula | -0.80 | -0.80 | Passed |
| variant scenario 1 | -1.61 | -1.61 | Passed |
| variant scenario 2 | -1.47 | -1.47 | Passed |
SHA-256 / 46c5fd154fac5c6e44e2984f5d2276fe33261a72f8f35228d7ad1579d0793a13
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:31.098882+00:00.
Case digest / 251c0e3f22d2de22eea00d24640159bb6ace3734346ea30d58e877739e49da37