FA-5346 / Integer arithmetic / Open access
Nearest multiple ties up · case 01
Banker rounding violates the upward midpoint convention.
ROOT CAUSE
Banker rounding violates the upward midpoint convention.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return ((2*a + step) // (2*step))*step
Unsuccessful approach: Adding a full step rounds every nonmultiple upward and moves exact multiples.
Case contract
Integer arguments; denominators, steps, moduli, and bit widths are positive. Unsigned word inputs fit the specified width except where masking is explicitly the operation. Sequence sizes are nonnegative. Return the nearest multiple of step; exact halfway cases choose the greater signed result. Exact operational definition: ((2*a + step) // (2*step))*step
Why this case matters
Small exact fixtures expose this error without platform timing, external services, or probabilistic observations. Integer mathematics results depend on the stated convention.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR
N = 1
observations = []
def solve(a, step):
return round(a/step)*step
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (5, 10)', solve(*(5, 10)), 10)
check('fixture 2: (4, 10)', solve(*(4, 10)), 0)
check('fixture 3: (-5, 10)', solve(*(-5, 10)), 0)
check('fixture 4: (-6, 10)', solve(*(-6, 10)), -10)
check('fixture 5: (20, 10)', solve(*(20, 10)), 20)
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 |
|---|---|---|---|
| fixture 1: (5, 10) | 0 | 10 | Failed |
| fixture 2: (4, 10) | 0 | 0 | Passed |
| fixture 3: (-5, 10) | 0 | 0 | Passed |
| fixture 4: (-6, 10) | -10 | -10 | Passed |
| fixture 5: (20, 10) | 20 | 20 | Passed |
SHA-256 / 0c32ce0b86d7fd3877e5f203e13e4df0897858e56e91912cf4177d95f364e38b
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR
N = 1
observations = []
def solve(a, step):
return ((a + step) // step)*step
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (5, 10)', solve(*(5, 10)), 10)
check('fixture 2: (4, 10)', solve(*(4, 10)), 0)
check('fixture 3: (-5, 10)', solve(*(-5, 10)), 0)
check('fixture 4: (-6, 10)', solve(*(-6, 10)), -10)
check('fixture 5: (20, 10)', solve(*(20, 10)), 20)
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 |
|---|---|---|---|
| fixture 1: (5, 10) | 10 | 10 | Passed |
| fixture 2: (4, 10) | 10 | 0 | Failed |
| fixture 3: (-5, 10) | 0 | 0 | Passed |
| fixture 4: (-6, 10) | 0 | -10 | Failed |
| fixture 5: (20, 10) | 30 | 20 | Failed |
SHA-256 / e3fd984e777f67c881d10dfa0bb6981de181e6a9732c777ba44ef26a764ac61d
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
import calendar
import statistics
import itertools
from fractions import Fraction
from datetime import date, datetime, timedelta, timezone
from decimal import Decimal, ROUND_HALF_UP, ROUND_DOWN, ROUND_CEILING, ROUND_FLOOR
N = 1
observations = []
def solve(a, step):
return ((2*a + step) // (2*step))*step
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (5, 10)', solve(*(5, 10)), 10)
check('fixture 2: (4, 10)', solve(*(4, 10)), 0)
check('fixture 3: (-5, 10)', solve(*(-5, 10)), 0)
check('fixture 4: (-6, 10)', solve(*(-6, 10)), -10)
check('fixture 5: (20, 10)', solve(*(20, 10)), 20)
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 |
|---|---|---|---|
| fixture 1: (5, 10) | 10 | 10 | Passed |
| fixture 2: (4, 10) | 0 | 0 | Passed |
| fixture 3: (-5, 10) | 0 | 0 | Passed |
| fixture 4: (-6, 10) | -10 | -10 | Passed |
| fixture 5: (20, 10) | 20 | 20 | Passed |
SHA-256 / 51d904438827e2fafc310ac31a0de1be1e80d786155ec739b66223940748fe1f
Verification & scope
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:37:48.555460+00:00.
Case digest / c424804d7e2c44c379121d7b6ecb907bba945dc3bb4bb30dfed0906fd8ed14a2