FAILURE MAP
← Case archive

FA-16086 / Floating-point arithmetic / Open access

ULP distance validates only its left operand · case 01

ULP distance validates only its left operand.

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

ROOT CAUSE

ULP distance validates only its left operand. The faulty expression is if not math.isfinite(a): return None.

THE FAILURE

ULP distance validates only its left operand. The faulty expression is if not math.isfinite(a): return None.

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

Case contract

Distance between finite binary64 values in representable steps, treating the two zeros as a single position; NaN or infinity yields null. Negative and positive subnormals are adjacent through zero.

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):
    if not math.isfinite(a): return None
    ab=int.from_bytes(struct.pack('>d',a),'big')
    bb=int.from_bytes(struct.pack('>d',b),'big')
    a_index=-(ab&((1<<63)-1)) if ab>>63 else ab
    b_index=-(bb&((1<<63)-1)) if bb>>63 else bb
    return abs(a_index-b_index)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('same', solve(float(N),float(N)), 0)
check('zero signs', solve(-0.0,0.0), 0)
check('negative adjacent', solve(-float(N),math.nextafter(-float(N),-math.inf)), 1)
check('positive adjacent', solve(float(N),math.nextafter(float(N),math.inf)), 1)
check('cross zero', solve(-math.ldexp(float(N),-1074),math.ldexp(float(N),-1074)), 2*N)
check('reverse cross', solve(math.ldexp(float(N),-1074),-math.ldexp(float(N),-1074)), 2*N)
check('nan left', solve(float("nan"),1.0), None)
check('nan right', solve(1.0,float("nan")), None)
check('infinity', solve(math.inf,math.inf), None)
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
same00Passed
zero signs00Passed
negative adjacent11Passed
positive adjacent11Passed
cross zero22Passed
reverse cross22Passed
nan leftNoneNonePassed
nan right4613937818241073152NoneFailed
infinityNoneNonePassed

SHA-256 / 75cc95054f78389fc2b56cd56037cb8858a086498fd53b1e33603dbabaa21fed

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):
    if not math.isfinite(a) or math.isinf(b): return None
    ab=int.from_bytes(struct.pack('>d',a),'big')
    bb=int.from_bytes(struct.pack('>d',b),'big')
    a_index=-(ab&((1<<63)-1)) if ab>>63 else ab
    b_index=-(bb&((1<<63)-1)) if bb>>63 else bb
    return abs(a_index-b_index)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('same', solve(float(N),float(N)), 0)
check('zero signs', solve(-0.0,0.0), 0)
check('negative adjacent', solve(-float(N),math.nextafter(-float(N),-math.inf)), 1)
check('positive adjacent', solve(float(N),math.nextafter(float(N),math.inf)), 1)
check('cross zero', solve(-math.ldexp(float(N),-1074),math.ldexp(float(N),-1074)), 2*N)
check('reverse cross', solve(math.ldexp(float(N),-1074),-math.ldexp(float(N),-1074)), 2*N)
check('nan left', solve(float("nan"),1.0), None)
check('nan right', solve(1.0,float("nan")), None)
check('infinity', solve(math.inf,math.inf), None)
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
same00Passed
zero signs00Passed
negative adjacent11Passed
positive adjacent11Passed
cross zero22Passed
reverse cross22Passed
nan leftNoneNonePassed
nan right4613937818241073152NoneFailed
infinityNoneNonePassed

SHA-256 / c1f004bcf525bff7e7b008d20dd61b4b269de8caa8fa513661b86ceb112f762d

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

Case digest / 4eaaa1d9386b7fa8a95cb9049e9d57d719a0d3cb4db619e18ecd495b3bcbb3a6