FA-16076 / Floating-point arithmetic / Open access
Exponent adjustment strips the sign after underflow · case 01
Exponent adjustment strips the sign after underflow.
ROOT CAUSE
Exponent adjustment strips the sign after underflow. The faulty expression is return (0.0 if result==0 else result).hex().
THE FAILURE
Exponent adjustment strips the sign after underflow. The faulty expression is return (0.0 if result==0 else result).hex().
Unsuccessful approach: The attempted local correction return abs(result).hex() 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.ldexp(m,target)
except OverflowError:
return '-overflow' if x<0 else '+overflow'
return (0.0 if result==0 else 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.0000000000002p-1022 | 0x0.0000000000002p-1022 | Passed |
| subnormal output | 0x0.8000000000000p-1022 | 0x0.8000000000000p-1022 | Passed |
| 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 | Failed |
SHA-256 / 06fe86b8874254f810ac08b93e9762158fe1a59c6bc91dd1930c305203ff3b5d
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.ldexp(m,target)
except OverflowError:
return '-overflow' if x<0 else '+overflow'
return abs(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 | Failed |
| negative zero | -0x0.0p+0 | -0x0.0p+0 | Passed |
| positive zero | 0x0.0p+0 | 0x0.0p+0 | Passed |
| subnormal input | 0x0.0000000000002p-1022 | 0x0.0000000000002p-1022 | Passed |
| subnormal output | 0x0.8000000000000p-1022 | 0x0.8000000000000p-1022 | Passed |
| 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 | Failed |
SHA-256 / eac31d6194b9f1b71bbc47dc9721a8d8d46de4ce90f57f76e92f89111a6fda88
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 / e86bcca8d179881d7b798c0e8aa23bf30e1ee9ee8b069bdd65a1a663edb32657