FAILURE MAP
← Case archive

FA-17056 / Floating-point arithmetic / Open access

Closeness rejects equal infinities before checking exact equality · case 01

Closeness rejects equal infinities before checking exact equality.

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

ROOT CAUSE

Closeness rejects equal infinities before checking exact equality. The faulty expression is if a==b: return math.isfinite(a).

THE FAILURE

Closeness rejects equal infinities before checking exact equality. The faulty expression is if a==b: return math.isfinite(a).

Unsuccessful approach: The attempted local correction if a==b: return not math.isinf(a) still violates the explicit regression fixtures.

Case contract

Symmetric binary64 closeness: equal values including like-signed infinities are close; remaining nonfinite pairs are not. For finite a,b require abs(a-b)<=max(abs_tol,rel_tol*max(abs(a),abs(b))). Negative tolerances return invalid.

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
N = 1
observations = []
def solve(a,b,rel_tol,abs_tol):
    if rel_tol<0 or abs_tol<0: return 'invalid'
    if a==b: return math.isfinite(a)
    if not math.isfinite(a) or not math.isfinite(b): return False
    difference=abs(a-b)
    relative=rel_tol*max(abs(a),abs(b))
    return difference<=max(abs_tol,relative)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('equal infinity', solve(math.inf,math.inf,1e-9,0.0), True)
check('opposite infinity', solve(math.inf,-math.inf,1e-9,0.0), False)
check('nan', solve(math.nan,math.nan,1.0,1.0), False)
check('absolute zero', solve(0.0,N*1e-9,0.0,N*1e-9), True)
check('relative boundary', solve(float(N),float(N*2),0.5,0.0), True)
check('reverse relative', solve(float(N*2),float(N),0.5,0.0), True)
check('negative values', solve(-float(N),-float(N*2),0.5,0.0), True)
check('disjoint tolerances', solve(0.0,1.5,0.5,1.0), False)
check('ordinary apart', solve(float(N),float(N+1),1e-6,0.0), False)
check('bad relative', solve(1.0,1.0,-1.0,0.0), "invalid")
check('bad absolute', solve(1.0,1.0,0.0,-1.0), "invalid")
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
equal infinityFalseTrueFailed
opposite infinityFalseFalsePassed
nanFalseFalsePassed
absolute zeroTrueTruePassed
relative boundaryTrueTruePassed
reverse relativeTrueTruePassed
negative valuesTrueTruePassed
disjoint tolerancesFalseFalsePassed
ordinary apartFalseFalsePassed
bad relativeinvalidinvalidPassed
bad absoluteinvalidinvalidPassed

SHA-256 / 30bca89a5196463feb72d9192d5aa024cb13722851aa2b12c5952d14baa68fbd

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
N = 1
observations = []
def solve(a,b,rel_tol,abs_tol):
    if rel_tol<0 or abs_tol<0: return 'invalid'
    if a==b: return not math.isinf(a)
    if not math.isfinite(a) or not math.isfinite(b): return False
    difference=abs(a-b)
    relative=rel_tol*max(abs(a),abs(b))
    return difference<=max(abs_tol,relative)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('equal infinity', solve(math.inf,math.inf,1e-9,0.0), True)
check('opposite infinity', solve(math.inf,-math.inf,1e-9,0.0), False)
check('nan', solve(math.nan,math.nan,1.0,1.0), False)
check('absolute zero', solve(0.0,N*1e-9,0.0,N*1e-9), True)
check('relative boundary', solve(float(N),float(N*2),0.5,0.0), True)
check('reverse relative', solve(float(N*2),float(N),0.5,0.0), True)
check('negative values', solve(-float(N),-float(N*2),0.5,0.0), True)
check('disjoint tolerances', solve(0.0,1.5,0.5,1.0), False)
check('ordinary apart', solve(float(N),float(N+1),1e-6,0.0), False)
check('bad relative', solve(1.0,1.0,-1.0,0.0), "invalid")
check('bad absolute', solve(1.0,1.0,0.0,-1.0), "invalid")
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
equal infinityFalseTrueFailed
opposite infinityFalseFalsePassed
nanFalseFalsePassed
absolute zeroTrueTruePassed
relative boundaryTrueTruePassed
reverse relativeTrueTruePassed
negative valuesTrueTruePassed
disjoint tolerancesFalseFalsePassed
ordinary apartFalseFalsePassed
bad relativeinvalidinvalidPassed
bad absoluteinvalidinvalidPassed

SHA-256 / 453a3cdbd6db66e0d79a7a2ca6d21bab002d02c0782129f28f99258d1cf622b5

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 11 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:42.977273+00:00.

Case digest / 91f0febcdeba4daa009e55b12bb6638dd8d1b24710f529a0a35c3d0d7f55fd04