FAILURE MAP
← Case archive

FA-16066 / Floating-point arithmetic / Open access

Exponent overflow loses its negative sign · case 01

Exponent overflow loses its negative sign.

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

ROOT CAUSE

Exponent overflow loses its negative sign. The faulty expression is if target>1024: return '+overflow'.

VERIFIED REPAIR

Apply the contract at this fault site using if target>1024: return '-overflow' if x<0 else '+overflow'.

Unsuccessful approach: The attempted local correction if target>1024: return '-overflow' 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'
    try:
        result=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 fixtureActualExpectedOutcome
scale up0x1.8000000000000p+10x1.8000000000000p+1Passed
scale down-0x1.8000000000000p-1-0x1.8000000000000p-1Passed
negative zero-0x0.0p+0-0x0.0p+0Passed
positive zero0x0.0p+00x0.0p+0Passed
subnormal input0x0.0000000000002p-10220x0.0000000000002p-1022Passed
subnormal output0x0.8000000000000p-10220x0.8000000000000p-1022Passed
max finite shift zero0x1.fffffffffffffp+10230x1.fffffffffffffp+1023Passed
positive overflow+overflow+overflowPassed
negative overflow+overflow-overflowFailed
negative underflow-0x0.0p+0-0x0.0p+0Passed

SHA-256 / d25eb8ca995a9c8297a3adaca26c17e8b642d5d3be331f039021ded15a16bdb1

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'
    try:
        result=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 fixtureActualExpectedOutcome
scale up0x1.8000000000000p+10x1.8000000000000p+1Passed
scale down-0x1.8000000000000p-1-0x1.8000000000000p-1Passed
negative zero-0x0.0p+0-0x0.0p+0Passed
positive zero0x0.0p+00x0.0p+0Passed
subnormal input0x0.0000000000002p-10220x0.0000000000002p-1022Passed
subnormal output0x0.8000000000000p-10220x0.8000000000000p-1022Passed
max finite shift zero0x1.fffffffffffffp+10230x1.fffffffffffffp+1023Passed
positive overflow-overflow+overflowFailed
negative overflow-overflow-overflowPassed
negative underflow-0x0.0p+0-0x0.0p+0Passed

SHA-256 / 1fdcb08201dd3b250accdaee05775377919b1ce03fd8d25d4fc731c4e7c2621c

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(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 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 fixtureActualExpectedOutcome
scale up0x1.8000000000000p+10x1.8000000000000p+1Passed
scale down-0x1.8000000000000p-1-0x1.8000000000000p-1Passed
negative zero-0x0.0p+0-0x0.0p+0Passed
positive zero0x0.0p+00x0.0p+0Passed
subnormal input0x0.0000000000002p-10220x0.0000000000002p-1022Passed
subnormal output0x0.8000000000000p-10220x0.8000000000000p-1022Passed
max finite shift zero0x1.fffffffffffffp+10230x1.fffffffffffffp+1023Passed
positive overflow+overflow+overflowPassed
negative overflow-overflow-overflowPassed
negative underflow-0x0.0p+0-0x0.0p+0Passed

SHA-256 / 7e4c33c61df5712b8d12f73a8dd7e65f00dde45b83052690218cd8290e26865d

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

Case digest / 10779226a90f935b8081c3086e1d8311b1aa555e0c689ecbe28cc71d710e193e