FA-16071 / Floating-point arithmetic / Open access
Exponent adjustment flushes representable subnormals · case 01
Exponent adjustment flushes representable subnormals.
ROOT CAUSE
Exponent adjustment flushes representable subnormals. The faulty expression is result=math.copysign(0.0,m) if target < -1021 else math.ldexp(m,target).
THE FAILURE
Exponent adjustment flushes representable subnormals. The faulty expression is result=math.copysign(0.0,m) if target < -1021 else math.ldexp(m,target).
Unsuccessful approach: The attempted local correction result=math.copysign(2.0**-1022,m) if target < -1021 else math.ldexp(m,target) still violates the explicit regression fixtures.
Case contract
Recompose finite binary64 x after changing its exponent by integer shift. Return hex value, or signed overflow marker. Scaling preserves negative zero and gradual underflow. Inputs exclude NaN and infinity.
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(x, shift):
if x == 0.0: return x.hex()
m,e=math.frexp(x)
target=e+shift
if target>1024: return '-overflow' if x<0 else '+overflow'
try:
result=math.copysign(0.0,m) if target < -1021 else math.ldexp(m,target)
except OverflowError:
return '-overflow' if x<0 else '+overflow'
return result.hex()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('scale up', solve(1.5,N), math.ldexp(1.5,N).hex())
check('scale down', solve(-1.5,-N), math.ldexp(-1.5,-N).hex())
check('negative zero', solve(-0.0,N), '-0x0.0p+0')
check('positive zero', solve(0.0,-N), '0x0.0p+0')
check('subnormal input', solve(float.fromhex("0x0.0000000000001p-1022"),N), math.ldexp(1.0,N-1074).hex())
check('subnormal output', solve(float.fromhex("0x1p-1022"),-N), math.ldexp(1.0,-1022-N).hex())
check('max finite shift zero', solve(float.fromhex("0x1.fffffffffffffp+1023"),0), '0x1.fffffffffffffp+1023')
check('positive overflow', solve(float.fromhex("0x1p+1023"),N), '+overflow')
check('negative overflow', solve(-float.fromhex("0x1p+1023"),N), '-overflow')
check('negative underflow', solve(-float.fromhex("0x0.0000000000001p-1022"),-N), '-0x0.0p+0')
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 |
|---|---|---|---|
| scale up | 0x1.8000000000000p+1 | 0x1.8000000000000p+1 | Passed |
| scale down | -0x1.8000000000000p-1 | -0x1.8000000000000p-1 | Passed |
| negative zero | -0x0.0p+0 | -0x0.0p+0 | Passed |
| positive zero | 0x0.0p+0 | 0x0.0p+0 | Passed |
| subnormal input | 0x0.0p+0 | 0x0.0000000000002p-1022 | Failed |
| subnormal output | 0x0.0p+0 | 0x0.8000000000000p-1022 | Failed |
| max finite shift zero | 0x1.fffffffffffffp+1023 | 0x1.fffffffffffffp+1023 | Passed |
| positive overflow | +overflow | +overflow | Passed |
| negative overflow | -overflow | -overflow | Passed |
| negative underflow | -0x0.0p+0 | -0x0.0p+0 | Passed |
SHA-256 / d4adb2eb78019ee69872a3d0833f13191b271b0e05c621c19fbde9f39997cfa1
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(x, shift):
if x == 0.0: return x.hex()
m,e=math.frexp(x)
target=e+shift
if target>1024: return '-overflow' if x<0 else '+overflow'
try:
result=math.copysign(2.0**-1022,m) if target < -1021 else math.ldexp(m,target)
except OverflowError:
return '-overflow' if x<0 else '+overflow'
return result.hex()
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('scale up', solve(1.5,N), math.ldexp(1.5,N).hex())
check('scale down', solve(-1.5,-N), math.ldexp(-1.5,-N).hex())
check('negative zero', solve(-0.0,N), '-0x0.0p+0')
check('positive zero', solve(0.0,-N), '0x0.0p+0')
check('subnormal input', solve(float.fromhex("0x0.0000000000001p-1022"),N), math.ldexp(1.0,N-1074).hex())
check('subnormal output', solve(float.fromhex("0x1p-1022"),-N), math.ldexp(1.0,-1022-N).hex())
check('max finite shift zero', solve(float.fromhex("0x1.fffffffffffffp+1023"),0), '0x1.fffffffffffffp+1023')
check('positive overflow', solve(float.fromhex("0x1p+1023"),N), '+overflow')
check('negative overflow', solve(-float.fromhex("0x1p+1023"),N), '-overflow')
check('negative underflow', solve(-float.fromhex("0x0.0000000000001p-1022"),-N), '-0x0.0p+0')
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 |
|---|---|---|---|
| scale up | 0x1.8000000000000p+1 | 0x1.8000000000000p+1 | Passed |
| scale down | -0x1.8000000000000p-1 | -0x1.8000000000000p-1 | Passed |
| negative zero | -0x0.0p+0 | -0x0.0p+0 | Passed |
| positive zero | 0x0.0p+0 | 0x0.0p+0 | Passed |
| subnormal input | 0x1.0000000000000p-1022 | 0x0.0000000000002p-1022 | Failed |
| subnormal output | 0x1.0000000000000p-1022 | 0x0.8000000000000p-1022 | Failed |
| max finite shift zero | 0x1.fffffffffffffp+1023 | 0x1.fffffffffffffp+1023 | Passed |
| positive overflow | +overflow | +overflow | Passed |
| negative overflow | -overflow | -overflow | Passed |
| negative underflow | -0x1.0000000000000p-1022 | -0x0.0p+0 | Failed |
SHA-256 / 773b72feffd2967342f25e669914c005bc5d29dab14ca65f5d6747e487422424
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 10 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:32.778300+00:00.
Case digest / 338e3d99458e454f772302ececa59527c4d0465a76314c48066da8e9d9ac1855