FAILURE MAP
← Case archive

FA-5331 / Integer arithmetic / Open access

Ceiling integer quotient · case 01

Floor division is substituted for ceiling division.

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

ROOT CAUSE

Floor division is substituted for ceiling division.

VERIFIED REPAIR

Apply the specified mathematical contract directly, preserving all terms and boundary cases: return -(-a // b)

Unsuccessful approach: The signed shortcut truncates negative nonmultiples incorrectly.

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 least integer greater than or equal to a/b, including negative a. 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 // 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)), 3)
check('fixture 2: (-7, 3)', solve(*(-7, 3)), -2)
check('fixture 3: (6, 3)', solve(*(6, 3)), 2)
check('fixture 4: (0, 3)', solve(*(0, 3)), 0)
check('fixture 5: (-1, 3)', solve(*(-1, 3)), 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 fixtureActualExpectedOutcome
fixture 1: (7, 3)23Failed
fixture 2: (-7, 3)-3-2Failed
fixture 3: (6, 3)22Passed
fixture 4: (0, 3)00Passed
fixture 5: (-1, 3)-10Failed

SHA-256 / 9242eafef1ec4662481a07c2111ca89fc404e8d2286027b2b52a29159cf85100

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 (a + b - 1) // b if a >= 0 else -((abs(a)+b-1) // 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)), 3)
check('fixture 2: (-7, 3)', solve(*(-7, 3)), -2)
check('fixture 3: (6, 3)', solve(*(6, 3)), 2)
check('fixture 4: (0, 3)', solve(*(0, 3)), 0)
check('fixture 5: (-1, 3)', solve(*(-1, 3)), 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 fixtureActualExpectedOutcome
fixture 1: (7, 3)33Passed
fixture 2: (-7, 3)-3-2Failed
fixture 3: (6, 3)22Passed
fixture 4: (0, 3)00Passed
fixture 5: (-1, 3)-10Failed

SHA-256 / c0cb20fef18cbc41ad8d28b8dbba8333736fd7b8ba982d847da45af4596fa478

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)), 3)
check('fixture 2: (-7, 3)', solve(*(-7, 3)), -2)
check('fixture 3: (6, 3)', solve(*(6, 3)), 2)
check('fixture 4: (0, 3)', solve(*(0, 3)), 0)
check('fixture 5: (-1, 3)', solve(*(-1, 3)), 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 fixtureActualExpectedOutcome
fixture 1: (7, 3)33Passed
fixture 2: (-7, 3)-2-2Passed
fixture 3: (6, 3)22Passed
fixture 4: (0, 3)00Passed
fixture 5: (-1, 3)00Passed

SHA-256 / 8ee377a33e80a3863c14a0ada37c884283910eb472c74ecf1854ab0f22002ab3

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.408919+00:00.

Case digest / 8edb856a688e537b0e3c2384cc23e0c4fc2086e8d65c30f325a0412d5acc4f42