FAILURE MAP
← Case archive

FA-84126 / Sports scoring and tiebreakers / Open access

ERA truncated instead of rounded half up · case 01

An ERA of 3.375 is shown as 3.37.

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

ROOT CAUSE

The cents are computed with floor(v * 100).

THE FAILURE

The cents are computed with floor(v * 100).

Unsuccessful approach: Python's round() on the exact value rounds halves to even and still misses some half-way cases.

Case contract

Pitching line aggregation. outings rows are [innings_pitched, earned_runs] where innings pitched use baseball notation "6.2" = 6 innings and 2 outs (the digit after the point is 0-2; otherwise return "invalid ip <text>"). Sum outs exactly. ERA = innings_per_game * earned runs / innings, rounded half up to two decimals. Return [total innings "I.O", ERA string]; with zero outs ERA is "INF" if any earned runs else "0.00".

Why this case matters

Box scores and stat pages aggregate outs across appearances; thirds of an inning are notorious.

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(outings, innings_per_game):
    outs = er = 0
    for ip, runs in outings:
        whole, _, part = ip.partition('.')
        part = int(part or 0)
        if part > 2:
            return 'invalid ip ' + ip
        outs += int(whole) * 3 + part
        er += runs
    ip_str = '%d.%d' % (outs // 3, outs % 3)
    if outs == 0:
        return [ip_str, 'INF' if er else '0.00']
    v = Fraction(innings_per_game * er * 3, outs)
    cents = math.floor(v * 100)
    return [ip_str, '%d.%02d' % (cents // 100, cents % 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 complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding', ([['8.0', 1]], 9), ['8.0', '1.13']),
  ('variant scenario 1', ([['9.2', 2], ['4.3', 0], ['5.0', 0]], 9), 'invalid ip 4.3'),
  ('variant scenario 2', ([['3.0', 2], ['7.0', 4], ['1.2', 3]], 7), ['11.2', '5.40'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding', ([['7.2', 4]], 9), ['7.2', '4.70']),
  ('regression: era rounding', ([['8.0', 5]], 9), ['8.0', '5.63']),
  ('variant scenario 1', ([['2.0', 0], ['2.2', 1], ['6.0', 1], ['2', 2]], 7), ['12.2', '2.21']),
  ('variant scenario 2', ([['1.1', 4], ['2.2', 4], ['1.2', 4]], 7), ['5.2', '14.82'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding', ([['8.2', 4], ['8.2', 0]], 9), ['17.1', '2.08']),
  ('regression: era rounding',
   ([['3.0', 2], ['1.2', 2], ['8.2', 1], ['3.2', 2], ['4.1', 1]], 7),
   ['21.1', '2.63']),
  ('variant scenario 1', ([['8.1', 3], ['8', 0]], 9), ['16.1', '1.65']),
  ('variant scenario 2', ([['5.3', 0], ['4.1', 4]], 9), 'invalid ip 5.3')],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding',
   ([['4.0', 2], ['4.0', 1], ['0', 1], ['3.2', 2], ['5.1', 0]], 9),
   ['17.0', '3.18']),
  ('regression: era rounding', ([['1', 0], ['0', 0], ['6.0', 3], ['6.1', 0]], 9), ['13.1', '2.03']),
  ('variant scenario 1',
   ([['9.2', 0], ['7.2', 1], ['8.2', 2], ['4.2', 3], ['5.0', 3]], 9),
   ['35.2', '2.27']),
  ('variant scenario 2', ([['6.1', 4]], 9), ['6.1', '5.68'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding',
   ([['3.2', 2], ['2.2', 1], ['6.0', 2], ['6', 0], ['0.1', 4]], 9),
   ['18.2', '4.34']),
  ('regression: era rounding', ([['8.0', 5]], 9), ['8.0', '5.63']),
  ('variant scenario 1', ([['5.0', 3]], 7), ['5.0', '4.20']),
  ('variant scenario 2', ([['7.0', 1], ['7.0', 0]], 9), ['14.0', '0.64'])]]
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 complete game['9.0', '2.00']['9.0', '2.00']Passed
boundary thirds carry['7.0', '1.28']['7.0', '1.29']Failed
boundary seven-inning game['7.0', '3.00']['7.0', '3.00']Passed
boundary no outs with runs['0.0', 'INF']['0.0', 'INF']Passed
boundary invalid out digitinvalid ip 4.3invalid ip 4.3Passed
control half-up rounding['8.0', '3.37']['8.0', '3.38']Failed
regression: era rounding['8.0', '1.12']['8.0', '1.13']Failed
variant scenario 1invalid ip 4.3invalid ip 4.3Passed
variant scenario 2['11.2', '5.40']['11.2', '5.40']Passed

SHA-256 / 5538c96e40826d3c512ca271590fee02b708d734bb15747607a1c195d28b4cb1

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(outings, innings_per_game):
    outs = er = 0
    for ip, runs in outings:
        whole, _, part = ip.partition('.')
        part = int(part or 0)
        if part > 2:
            return 'invalid ip ' + ip
        outs += int(whole) * 3 + part
        er += runs
    ip_str = '%d.%d' % (outs // 3, outs % 3)
    if outs == 0:
        return [ip_str, 'INF' if er else '0.00']
    v = Fraction(innings_per_game * er * 3, outs)
    cents = round(v * 100)
    return [ip_str, '%d.%02d' % (cents // 100, cents % 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 complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding', ([['8.0', 1]], 9), ['8.0', '1.13']),
  ('variant scenario 1', ([['9.2', 2], ['4.3', 0], ['5.0', 0]], 9), 'invalid ip 4.3'),
  ('variant scenario 2', ([['3.0', 2], ['7.0', 4], ['1.2', 3]], 7), ['11.2', '5.40'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding', ([['7.2', 4]], 9), ['7.2', '4.70']),
  ('regression: era rounding', ([['8.0', 5]], 9), ['8.0', '5.63']),
  ('variant scenario 1', ([['2.0', 0], ['2.2', 1], ['6.0', 1], ['2', 2]], 7), ['12.2', '2.21']),
  ('variant scenario 2', ([['1.1', 4], ['2.2', 4], ['1.2', 4]], 7), ['5.2', '14.82'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding', ([['8.2', 4], ['8.2', 0]], 9), ['17.1', '2.08']),
  ('regression: era rounding',
   ([['3.0', 2], ['1.2', 2], ['8.2', 1], ['3.2', 2], ['4.1', 1]], 7),
   ['21.1', '2.63']),
  ('variant scenario 1', ([['8.1', 3], ['8', 0]], 9), ['16.1', '1.65']),
  ('variant scenario 2', ([['5.3', 0], ['4.1', 4]], 9), 'invalid ip 5.3')],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding',
   ([['4.0', 2], ['4.0', 1], ['0', 1], ['3.2', 2], ['5.1', 0]], 9),
   ['17.0', '3.18']),
  ('regression: era rounding', ([['1', 0], ['0', 0], ['6.0', 3], ['6.1', 0]], 9), ['13.1', '2.03']),
  ('variant scenario 1',
   ([['9.2', 0], ['7.2', 1], ['8.2', 2], ['4.2', 3], ['5.0', 3]], 9),
   ['35.2', '2.27']),
  ('variant scenario 2', ([['6.1', 4]], 9), ['6.1', '5.68'])],
 [('control complete game', ([['9.0', 2]], 9), ['9.0', '2.00']),
  ('boundary thirds carry', ([['5.2', 1], ['1.1', 0]], 9), ['7.0', '1.29']),
  ('boundary seven-inning game', ([['7.0', 3]], 7), ['7.0', '3.00']),
  ('boundary no outs with runs', ([['0.0', 2]], 9), ['0.0', 'INF']),
  ('boundary invalid out digit', ([['4.3', 1]], 9), 'invalid ip 4.3'),
  ('control half-up rounding', ([['8.0', 3]], 9), ['8.0', '3.38']),
  ('regression: era rounding',
   ([['3.2', 2], ['2.2', 1], ['6.0', 2], ['6', 0], ['0.1', 4]], 9),
   ['18.2', '4.34']),
  ('regression: era rounding', ([['8.0', 5]], 9), ['8.0', '5.63']),
  ('variant scenario 1', ([['5.0', 3]], 7), ['5.0', '4.20']),
  ('variant scenario 2', ([['7.0', 1], ['7.0', 0]], 9), ['14.0', '0.64'])]]
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 complete game['9.0', '2.00']['9.0', '2.00']Passed
boundary thirds carry['7.0', '1.29']['7.0', '1.29']Passed
boundary seven-inning game['7.0', '3.00']['7.0', '3.00']Passed
boundary no outs with runs['0.0', 'INF']['0.0', 'INF']Passed
boundary invalid out digitinvalid ip 4.3invalid ip 4.3Passed
control half-up rounding['8.0', '3.38']['8.0', '3.38']Passed
regression: era rounding['8.0', '1.12']['8.0', '1.13']Failed
variant scenario 1invalid ip 4.3invalid ip 4.3Passed
variant scenario 2['11.2', '5.40']['11.2', '5.40']Passed

SHA-256 / 074221e0519ca7230c712b1664a4887610dd3211bd4312d76d12f05c34dd85b6

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 governing body rulebook or operator house rules. 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:27.876413+00:00.

Case digest / 0de1bcb4b9a4b53d88395103bb6c4cb54ed3b0b61d4c352a29f5e695dfcce408