FAILURE MAP
← Case archive

FA-17211 / Floating-point arithmetic / Open access

Scaled square root drops the odd exponent remainder · case 01

Scaled square root drops the odd exponent remainder.

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

ROOT CAUSE

Scaled square root drops the odd exponent remainder. The faulty expression is root=math.sqrt(m).

THE FAILURE

Scaled square root drops the odd exponent remainder. The faulty expression is root=math.sqrt(m).

Unsuccessful approach: The attempted local correction root=math.sqrt(m)*r still violates the explicit regression fixtures.

Case contract

Nonnegative square root of finite binary64 x via exponent normalization. Negative input returns domain; negative zero is preserved. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.

Why this case matters

An offline floating representation model isolates a reproducible arithmetic fault.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
def render(x):
    if math.isnan(x): return 'nan'
    if math.isinf(x): return '-infinity' if x<0 else '+infinity'
    return format(x,'.11g')

N = 1
observations = []
def solve(x):
    try:
        if x<0: return 'domain'
        if x==0: return render(x)
        m,e=math.frexp(x)
        q,r=divmod(e,2)
        root=math.sqrt(m)
        return render(math.ldexp(root,q))
    except (ValueError, OverflowError, ZeroDivisionError, TypeError):
        return "arithmetic-error"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('square', solve(float(N*N)), render(float(N)))
check('normal', solve(float(N)), render(math.sqrt(N)))
check('huge', solve(1e300), "1e+150")
check('tiny', solve(1e-300), "1e-150")
check('odd exponent', solve(2.0), render(math.sqrt(2)))
check('positive root zero', solve(0.0), "0")
check('negative domain', solve(-float(N)), "domain")
check('negative zero', solve(-0.0), "-0")
check('subnormal', solve(math.ldexp(1.0,-1074)), render(math.ldexp(1.0,-537)))
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
square0.707106781191Failed
normal0.707106781191Failed
huge7.0710678119e+1491e+150Failed
tiny1e-1501e-150Passed
odd exponent1.41421356241.4142135624Passed
positive root zero00Passed
negative domaindomaindomainPassed
negative zero-0-0Passed
subnormal1.5717277847e-1622.2227587495e-162Failed

SHA-256 / 009feeae73661c5ecdfc5b93328b7c83544166a18201ef0280bb4818d052d840

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
def render(x):
    if math.isnan(x): return 'nan'
    if math.isinf(x): return '-infinity' if x<0 else '+infinity'
    return format(x,'.11g')

N = 1
observations = []
def solve(x):
    try:
        if x<0: return 'domain'
        if x==0: return render(x)
        m,e=math.frexp(x)
        q,r=divmod(e,2)
        root=math.sqrt(m)*r
        return render(math.ldexp(root,q))
    except (ValueError, OverflowError, ZeroDivisionError, TypeError):
        return "arithmetic-error"
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('square', solve(float(N*N)), render(float(N)))
check('normal', solve(float(N)), render(math.sqrt(N)))
check('huge', solve(1e300), "1e+150")
check('tiny', solve(1e-300), "1e-150")
check('odd exponent', solve(2.0), render(math.sqrt(2)))
check('positive root zero', solve(0.0), "0")
check('negative domain', solve(-float(N)), "domain")
check('negative zero', solve(-0.0), "-0")
check('subnormal', solve(math.ldexp(1.0,-1074)), render(math.ldexp(1.0,-537)))
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
square0.707106781191Failed
normal0.707106781191Failed
huge7.0710678119e+1491e+150Failed
tiny01e-150Failed
odd exponent01.4142135624Failed
positive root zero00Passed
negative domaindomaindomainPassed
negative zero-0-0Passed
subnormal1.5717277847e-1622.2227587495e-162Failed

SHA-256 / f9b25ce96563ac98336daeeead7dff0b574d51cfc638d9ba0d24b2fec9c6db2a

HELD IN THE MEMBER ARCHIVE

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

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

Controlled binary64 or explicitly stipulated miniature format; no hardware exception flags or platform floating environment are modeled. 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:39:44.363901+00:00.

Case digest / 21d0fa0bdfe71bb224474baffb9f28a2b97459fbaa4436a0c8775724d010f394