FA-5336 / Integer arithmetic / Open access
Euclidean remainder positive modulus · case 01
Truncating division leaves a negative remainder.
ROOT CAUSE
Truncating division leaves a negative remainder.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return a % b
Unsuccessful approach: Taking the input magnitude changes the residue class.
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 r in [0,b) such that a-r is divisible by b. Exact operational definition: a % b
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, b):
return a - int(a / b) * b
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (-7, 3)', solve(*(-7, 3)), 2)
check('fixture 2: (7, 3)', solve(*(7, 3)), 1)
check('fixture 3: (-6, 3)', solve(*(-6, 3)), 0)
check('fixture 4: (0, 4)', solve(*(0, 4)), 0)
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: (-7, 3) | -1 | 2 | Failed |
| fixture 2: (7, 3) | 1 | 1 | Passed |
| fixture 3: (-6, 3) | 0 | 0 | Passed |
| fixture 4: (0, 4) | 0 | 0 | Passed |
SHA-256 / 40347854217f4f06f7efd01ef213d6761cfe8eaf40f880d9569a6ae0faad4ffd
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, b):
return abs(a) % b
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (-7, 3)', solve(*(-7, 3)), 2)
check('fixture 2: (7, 3)', solve(*(7, 3)), 1)
check('fixture 3: (-6, 3)', solve(*(-6, 3)), 0)
check('fixture 4: (0, 4)', solve(*(0, 4)), 0)
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: (-7, 3) | 1 | 2 | Failed |
| fixture 2: (7, 3) | 1 | 1 | Passed |
| fixture 3: (-6, 3) | 0 | 0 | Passed |
| fixture 4: (0, 4) | 0 | 0 | Passed |
SHA-256 / d617a5d426c66cb9bbee329c69d60c8fa95e388b04ed6c7b15d14ce6fc4900a1
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, b):
return a % b
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (-7, 3)', solve(*(-7, 3)), 2)
check('fixture 2: (7, 3)', solve(*(7, 3)), 1)
check('fixture 3: (-6, 3)', solve(*(-6, 3)), 0)
check('fixture 4: (0, 4)', solve(*(0, 4)), 0)
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: (-7, 3) | 2 | 2 | Passed |
| fixture 2: (7, 3) | 1 | 1 | Passed |
| fixture 3: (-6, 3) | 0 | 0 | Passed |
| fixture 4: (0, 4) | 0 | 0 | Passed |
SHA-256 / 9352434f052b9250cf9768cc3ff55624ebc6a16b1e1469800783cc5096b6c12b
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.420877+00:00.
Case digest / 81114c2b6e5510660b3ff7dae2ecc327bf55c3b1cd39da7a74f9694e251b99e7