FA-5351 / Integer arithmetic / Open access
Integer square root exact · case 01
Binary float conversion erases low bits before the root.
ROOT CAUSE
Binary float conversion erases low bits before the root.
VERIFIED REPAIR
Apply the specified mathematical contract directly, preserving all terms and boundary cases: return math.isqrt(n)
Unsuccessful approach: Nearest rounding does not compute the lower integer root.
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 greatest r such that r*r<=n. Exact operational definition: math.isqrt(n)
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 int(math.sqrt(n))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (81129638414606681695789005144063,)', solve(*(81129638414606681695789005144063,)), 9007199254740991)
check('fixture 2: (15,)', solve(*(15,)), 3)
check('fixture 3: (16,)', solve(*(16,)), 4)
check('fixture 4: (0,)', solve(*(0,)), 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: (81129638414606681695789005144063,) | 9007199254740992 | 9007199254740991 | Failed |
| fixture 2: (15,) | 3 | 3 | Passed |
| fixture 3: (16,) | 4 | 4 | Passed |
| fixture 4: (0,) | 0 | 0 | Passed |
SHA-256 / 00693e3180d02711342c38e9275ddcfe15fe9299cf316e08670fee72c96a7d7e
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 round(math.sqrt(n))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (81129638414606681695789005144063,)', solve(*(81129638414606681695789005144063,)), 9007199254740991)
check('fixture 2: (15,)', solve(*(15,)), 3)
check('fixture 3: (16,)', solve(*(16,)), 4)
check('fixture 4: (0,)', solve(*(0,)), 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: (81129638414606681695789005144063,) | 9007199254740992 | 9007199254740991 | Failed |
| fixture 2: (15,) | 4 | 3 | Failed |
| fixture 3: (16,) | 4 | 4 | Passed |
| fixture 4: (0,) | 0 | 0 | Passed |
SHA-256 / 98f7a56dc54f3608ac8becfcd52bd65c62935908a2e508e37f187610b09bd0d6
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(n):
return math.isqrt(n)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1: (81129638414606681695789005144063,)', solve(*(81129638414606681695789005144063,)), 9007199254740991)
check('fixture 2: (15,)', solve(*(15,)), 3)
check('fixture 3: (16,)', solve(*(16,)), 4)
check('fixture 4: (0,)', solve(*(0,)), 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: (81129638414606681695789005144063,) | 9007199254740991 | 9007199254740991 | Passed |
| fixture 2: (15,) | 3 | 3 | Passed |
| fixture 3: (16,) | 4 | 4 | Passed |
| fixture 4: (0,) | 0 | 0 | Passed |
SHA-256 / a23061df2ed95ed05085e30f9f3302f7cff4f212f27f46e21f86aea2102ca17b
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.599766+00:00.
Case digest / 37700a562202183534b96359a835c48d1b5f826edf2db81248c284c8a2555e80