FAILURE MAP
← Case archive

FA-17261 / Floating-point arithmetic / Open access

Reciprocal overflow always reports a positive infinity · case 01

Reciprocal overflow always reports a positive infinity.

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

ROOT CAUSE

Reciprocal overflow always reports a positive infinity. The faulty expression is return '+infinity'.

THE FAILURE

Reciprocal overflow always reports a positive infinity. The faulty expression is return '+infinity'.

Unsuccessful approach: The attempted local correction return '-infinity' still violates the explicit regression fixtures.

Case contract

Compute the reciprocal of finite binary64 x using exponent decomposition. Signed zeros return signed infinity; overflow returns signed infinity and representable subnormal reciprocals are retained. 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 '-infinity' if math.copysign(1.0,x)<0 else '+infinity'
        m,e=math.frexp(abs(x))
        fraction=1/m
        try:
            result=math.ldexp(fraction,-e)
        except OverflowError:
            return '+infinity'
        return render(math.copysign(result,x))
    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('positive ordinary', solve(float(N)), render(1/N))
check('negative ordinary', solve(-float(N)), render(-1/N))
check('huge', solve(1e308), render(1e-308))
check('negative huge', solve(-1e308), render(-1e-308))
check('tiny overflow', solve(math.ldexp(1.0,-1074)), "+infinity")
check('negative tiny', solve(-math.ldexp(1.0,-1074)), "-infinity")
check('positive zero', solve(0.0), "+infinity")
check('negative zero', solve(-0.0), "-infinity")
check('fraction', solve(0.125), "8")
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
positive ordinary11Passed
negative ordinary-1-1Passed
huge1e-3081e-308Passed
negative huge-1e-308-1e-308Passed
tiny overflow+infinity+infinityPassed
negative tiny+infinity-infinityFailed
positive zero+infinity+infinityPassed
negative zero-infinity-infinityPassed
fraction88Passed

SHA-256 / 9e629f10f27fa5a6f5e9c9bedfe3d77d5a03676f9002a8f04603fe0c94068aa0

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 '-infinity' if math.copysign(1.0,x)<0 else '+infinity'
        m,e=math.frexp(abs(x))
        fraction=1/m
        try:
            result=math.ldexp(fraction,-e)
        except OverflowError:
            return '-infinity'
        return render(math.copysign(result,x))
    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('positive ordinary', solve(float(N)), render(1/N))
check('negative ordinary', solve(-float(N)), render(-1/N))
check('huge', solve(1e308), render(1e-308))
check('negative huge', solve(-1e308), render(-1e-308))
check('tiny overflow', solve(math.ldexp(1.0,-1074)), "+infinity")
check('negative tiny', solve(-math.ldexp(1.0,-1074)), "-infinity")
check('positive zero', solve(0.0), "+infinity")
check('negative zero', solve(-0.0), "-infinity")
check('fraction', solve(0.125), "8")
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
positive ordinary11Passed
negative ordinary-1-1Passed
huge1e-3081e-308Passed
negative huge-1e-308-1e-308Passed
tiny overflow-infinity+infinityFailed
negative tiny-infinity-infinityPassed
positive zero+infinity+infinityPassed
negative zero-infinity-infinityPassed
fraction88Passed

SHA-256 / 0caf2d8781dbaaa9301cd3f41dc8eaa16c413c4e3eb8d18b75c5ea4fbe3bddbb

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

Case digest / 0d58a3483ae57cc7789f11b0134e35e54f48d9851b386f1df80b41477476141d