FAILURE MAP
← Case archive

FA-5441 / Integer arithmetic / Open access

Ceil log two capacity · case 01

Exact powers of two consume an extra address bit.

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

ROOT CAUSE

Exact powers of two consume an extra address bit.

THE FAILURE

Exact powers of two consume an extra address bit.

Unsuccessful approach: Flooring the logarithm underallocates nonpowers.

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. n is nonnegative; return the minimum nonnegative k with 2**k>=n. Exact operational definition: 0 if n <= 1 else (n-1).bit_length()

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(n):
    return n.bit_length()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0,)', solve(*(0,)), 0)
check('fixture 2: (1,)', solve(*(1,)), 0)
check('fixture 3: (8,)', solve(*(8,)), 3)
check('fixture 4: (9,)', solve(*(9,)), 4)
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: (0,)00Passed
fixture 2: (1,)10Failed
fixture 3: (8,)43Failed
fixture 4: (9,)44Passed

SHA-256 / 74732c8d90f1a36c35802a7436815e8c6c856fee77562288873a9dacf870eba0

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(n):
    return int(math.log2(n)) if n else 0
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (0,)', solve(*(0,)), 0)
check('fixture 2: (1,)', solve(*(1,)), 0)
check('fixture 3: (8,)', solve(*(8,)), 3)
check('fixture 4: (9,)', solve(*(9,)), 4)
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: (0,)00Passed
fixture 2: (1,)00Passed
fixture 3: (8,)33Passed
fixture 4: (9,)34Failed

SHA-256 / 1fe2a16426ab0893f39f4d21137f3abfd788a10382f2cddb9d8568159c8ab90a

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 4 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

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

Case digest / d3b17da31c33be3360148bc73daca54bb4d3259d2da86e4da4404d08a5de26fe