FA-15926 / Floating-point arithmetic / Open access
Zero ULP is rounded to zero · case 01
Zero ULP is rounded to zero.
ROOT CAUSE
Zero ULP is rounded to zero. The faulty expression is if x == 0: return 0.0.hex().
VERIFIED REPAIR
Apply the contract at this fault site using if x == 0: return float.fromhex('0x0.0000000000001p-1022').hex().
Unsuccessful approach: The attempted local correction if x == 0: return float.fromhex('0x1p-1022').hex() still violates the explicit regression fixtures.
Case contract
Return a finite binary64 ulp as a hex string; NaN maps to nan and either infinity maps to infinity. For subnormals and zero the ulp is the minimum positive subnormal.
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(bits):
x=struct.unpack('>d',bits.to_bytes(8,'big'))[0]
if math.isnan(x): return 'nan'
if math.isinf(x): return 'infinity'
x=abs(x)
if x == 0: return 0.0.hex()
m,e=math.frexp(x)
e=max(e-53,-1074)
return math.ldexp(1.0,e).hex()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero', solve(0), '0x0.0000000000001p-1022')
check('negative zero', solve(1<<63), '0x0.0000000000001p-1022')
check('subnormal', solve(N), '0x0.0000000000001p-1022')
check('power boundary', solve((1023+N)<<52), math.ldexp(1.0,N-52).hex())
check('negative power', solve((1<<63)|((1023+N)<<52)), math.ldexp(1.0,N-52).hex())
check('below power', solve(((1023+N)<<52)-1), math.ldexp(1.0,N-53).hex())
check('infinity', solve(0x7ff0000000000000), 'infinity')
check('nan', solve(0x7ff8000000000000|N), 'nan')
check('maximum', solve(0x7fefffffffffffff), '0x1.0000000000000p+971')
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 |
|---|---|---|---|
| zero | 0x0.0p+0 | 0x0.0000000000001p-1022 | Failed |
| negative zero | 0x0.0p+0 | 0x0.0000000000001p-1022 | Failed |
| subnormal | 0x0.0000000000001p-1022 | 0x0.0000000000001p-1022 | Passed |
| power boundary | 0x1.0000000000000p-51 | 0x1.0000000000000p-51 | Passed |
| negative power | 0x1.0000000000000p-51 | 0x1.0000000000000p-51 | Passed |
| below power | 0x1.0000000000000p-52 | 0x1.0000000000000p-52 | Passed |
| infinity | infinity | infinity | Passed |
| nan | nan | nan | Passed |
| maximum | 0x1.0000000000000p+971 | 0x1.0000000000000p+971 | Passed |
SHA-256 / 987d6fb95b6b5d0c4e4973fa1f2a37d902f49f43ac9e8c54ff9897288502c27a
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(bits):
x=struct.unpack('>d',bits.to_bytes(8,'big'))[0]
if math.isnan(x): return 'nan'
if math.isinf(x): return 'infinity'
x=abs(x)
if x == 0: return float.fromhex('0x1p-1022').hex()
m,e=math.frexp(x)
e=max(e-53,-1074)
return math.ldexp(1.0,e).hex()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero', solve(0), '0x0.0000000000001p-1022')
check('negative zero', solve(1<<63), '0x0.0000000000001p-1022')
check('subnormal', solve(N), '0x0.0000000000001p-1022')
check('power boundary', solve((1023+N)<<52), math.ldexp(1.0,N-52).hex())
check('negative power', solve((1<<63)|((1023+N)<<52)), math.ldexp(1.0,N-52).hex())
check('below power', solve(((1023+N)<<52)-1), math.ldexp(1.0,N-53).hex())
check('infinity', solve(0x7ff0000000000000), 'infinity')
check('nan', solve(0x7ff8000000000000|N), 'nan')
check('maximum', solve(0x7fefffffffffffff), '0x1.0000000000000p+971')
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 |
|---|---|---|---|
| zero | 0x1.0000000000000p-1022 | 0x0.0000000000001p-1022 | Failed |
| negative zero | 0x1.0000000000000p-1022 | 0x0.0000000000001p-1022 | Failed |
| subnormal | 0x0.0000000000001p-1022 | 0x0.0000000000001p-1022 | Passed |
| power boundary | 0x1.0000000000000p-51 | 0x1.0000000000000p-51 | Passed |
| negative power | 0x1.0000000000000p-51 | 0x1.0000000000000p-51 | Passed |
| below power | 0x1.0000000000000p-52 | 0x1.0000000000000p-52 | Passed |
| infinity | infinity | infinity | Passed |
| nan | nan | nan | Passed |
| maximum | 0x1.0000000000000p+971 | 0x1.0000000000000p+971 | Passed |
SHA-256 / bdc041cd76c4b186568495307aede089a326fe97d5888931e92556b460f2e2de
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
N = 1
observations = []
def solve(bits):
x=struct.unpack('>d',bits.to_bytes(8,'big'))[0]
if math.isnan(x): return 'nan'
if math.isinf(x): return 'infinity'
x=abs(x)
if x == 0: return float.fromhex('0x0.0000000000001p-1022').hex()
m,e=math.frexp(x)
e=max(e-53,-1074)
return math.ldexp(1.0,e).hex()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero', solve(0), '0x0.0000000000001p-1022')
check('negative zero', solve(1<<63), '0x0.0000000000001p-1022')
check('subnormal', solve(N), '0x0.0000000000001p-1022')
check('power boundary', solve((1023+N)<<52), math.ldexp(1.0,N-52).hex())
check('negative power', solve((1<<63)|((1023+N)<<52)), math.ldexp(1.0,N-52).hex())
check('below power', solve(((1023+N)<<52)-1), math.ldexp(1.0,N-53).hex())
check('infinity', solve(0x7ff0000000000000), 'infinity')
check('nan', solve(0x7ff8000000000000|N), 'nan')
check('maximum', solve(0x7fefffffffffffff), '0x1.0000000000000p+971')
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 |
|---|---|---|---|
| zero | 0x0.0000000000001p-1022 | 0x0.0000000000001p-1022 | Passed |
| negative zero | 0x0.0000000000001p-1022 | 0x0.0000000000001p-1022 | Passed |
| subnormal | 0x0.0000000000001p-1022 | 0x0.0000000000001p-1022 | Passed |
| power boundary | 0x1.0000000000000p-51 | 0x1.0000000000000p-51 | Passed |
| negative power | 0x1.0000000000000p-51 | 0x1.0000000000000p-51 | Passed |
| below power | 0x1.0000000000000p-52 | 0x1.0000000000000p-52 | Passed |
| infinity | infinity | infinity | Passed |
| nan | nan | nan | Passed |
| maximum | 0x1.0000000000000p+971 | 0x1.0000000000000p+971 | Passed |
SHA-256 / 2d845f1224db3a884bf6208ebd3d50326ec5c32e26c953c914127acaad9dc1f2
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:31.454807+00:00.
Case digest / 7ee8e3e6af5a5e104bb8e492f3247fd553f30aca61d46c54243df3484a0fde2a