FAILURE MAP
← Case archive

FA-16566 / Floating-point arithmetic / Open access

Quiet NaN propagation strips its diagnostic sign · case 01

Quiet NaN propagation strips its diagnostic sign.

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

ROOT CAUSE

Quiet NaN propagation strips its diagnostic sign. The faulty expression is return [chosen&((1<<63)-1),False].

THE FAILURE

Quiet NaN propagation strips its diagnostic sign. The faulty expression is return [chosen&((1<<63)-1),False].

Unsuccessful approach: The attempted local correction return [chosen|(1<<63),False] still violates the explicit regression fixtures.

Case contract

Stipulated binary64 addition policy: propagate first signaling NaN, otherwise largest quiet-NaN diagnostic payload (left wins ties); quiet propagated NaNs preserving sign. Opposite infinities produce canonical quiet NaN. Finite values use Python binary64 addition. Return bits and invalid flag.

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(ab,bb):
    mask=(1<<52)-1
    an=(ab>>52)&2047==2047 and bool(ab&mask)
    bn=(bb>>52)&2047==2047 and bool(bb&mask)
    asig=an and not bool(ab&(1<<51))
    bsig=bn and not bool(bb&(1<<51))
    if asig or bsig:
        chosen=ab if asig else bb
        return [chosen|(1<<51),True]
    if an or bn:
        if an and bn:
            chosen=ab if (ab&((1<<51)-1)) >= (bb&((1<<51)-1)) else bb
        else:
            chosen=ab if an else bb
        return [chosen&((1<<63)-1),False]
    a=struct.unpack('>d',ab.to_bytes(8,'big'))[0]
    b=struct.unpack('>d',bb.to_bytes(8,'big'))[0]
    if math.isinf(a) and math.isinf(b) and a!=b:
        return [0x7ff8000000000000,True]
    result=a+b
    return [int.from_bytes(struct.pack('>d',result),'big'),False]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('left signaling', solve(0x7ff0000000000000|N,0x3ff0000000000000), [0x7ff8000000000000|N,True])
check('right signaling', solve(0x3ff0000000000000,0xfff0000000000000|N), [0xfff8000000000000|N,True])
check('signaling precedence', solve(0x7ff8000000000064,0x7ff0000000000000|N), [0x7ff8000000000000|N,True])
check('two signaling', solve(0xfff0000000000000|N,0x7ff0000000000010), [0xfff8000000000000|N,True])
check('larger right payload', solve(0x7ff8000000000000|N,0xfff8000000000064), [0xfff8000000000064,False])
check('larger left payload', solve(0xfff8000000000064,0x7ff8000000000000|N), [0xfff8000000000064,False])
check('equal left wins', solve(0xfff8000000000000|N,0x7ff8000000000000|N), [0xfff8000000000000|N,False])
check('positive quiet', solve(0x7ff8000000000000|N,0x3ff0000000000000), [0x7ff8000000000000|N,False])
check('quiet left only', solve(0xfff8000000000000|N,0x3ff0000000000000), [0xfff8000000000000|N,False])
check('quiet right only', solve(0x3ff0000000000000,0xfff8000000000000|N), [0xfff8000000000000|N,False])
check('opposite infinities', solve(0x7ff0000000000000,0xfff0000000000000), [0x7ff8000000000000,True])
check('same infinity', solve(0xfff0000000000000,0xfff0000000000000), [0xfff0000000000000,False])
check('finite addition', solve(0x3ff0000000000000,0x3ff0000000000000), [0x4000000000000000,False])
check('negative zeros', solve(1<<63,1<<63), [1<<63,False])
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
left signaling[9221120237041090561, True][9221120237041090561, True]Passed
right signaling[18444492273895866369, True][18444492273895866369, True]Passed
signaling precedence[9221120237041090561, True][9221120237041090561, True]Passed
two signaling[18444492273895866369, True][18444492273895866369, True]Passed
larger right payload[9221120237041090660, False][18444492273895866468, False]Failed
larger left payload[9221120237041090660, False][18444492273895866468, False]Failed
equal left wins[9221120237041090561, False][18444492273895866369, False]Failed
positive quiet[9221120237041090561, False][9221120237041090561, False]Passed
quiet left only[9221120237041090561, False][18444492273895866369, False]Failed
quiet right only[9221120237041090561, False][18444492273895866369, False]Failed
opposite infinities[9221120237041090560, True][9221120237041090560, True]Passed
same infinity[18442240474082181120, False][18442240474082181120, False]Passed
finite addition[4611686018427387904, False][4611686018427387904, False]Passed
negative zeros[9223372036854775808, False][9223372036854775808, False]Passed

SHA-256 / f83622f5f52dc3812ed8ad60db85658536de74ef826da442c29d394af6ca2764

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(ab,bb):
    mask=(1<<52)-1
    an=(ab>>52)&2047==2047 and bool(ab&mask)
    bn=(bb>>52)&2047==2047 and bool(bb&mask)
    asig=an and not bool(ab&(1<<51))
    bsig=bn and not bool(bb&(1<<51))
    if asig or bsig:
        chosen=ab if asig else bb
        return [chosen|(1<<51),True]
    if an or bn:
        if an and bn:
            chosen=ab if (ab&((1<<51)-1)) >= (bb&((1<<51)-1)) else bb
        else:
            chosen=ab if an else bb
        return [chosen|(1<<63),False]
    a=struct.unpack('>d',ab.to_bytes(8,'big'))[0]
    b=struct.unpack('>d',bb.to_bytes(8,'big'))[0]
    if math.isinf(a) and math.isinf(b) and a!=b:
        return [0x7ff8000000000000,True]
    result=a+b
    return [int.from_bytes(struct.pack('>d',result),'big'),False]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('left signaling', solve(0x7ff0000000000000|N,0x3ff0000000000000), [0x7ff8000000000000|N,True])
check('right signaling', solve(0x3ff0000000000000,0xfff0000000000000|N), [0xfff8000000000000|N,True])
check('signaling precedence', solve(0x7ff8000000000064,0x7ff0000000000000|N), [0x7ff8000000000000|N,True])
check('two signaling', solve(0xfff0000000000000|N,0x7ff0000000000010), [0xfff8000000000000|N,True])
check('larger right payload', solve(0x7ff8000000000000|N,0xfff8000000000064), [0xfff8000000000064,False])
check('larger left payload', solve(0xfff8000000000064,0x7ff8000000000000|N), [0xfff8000000000064,False])
check('equal left wins', solve(0xfff8000000000000|N,0x7ff8000000000000|N), [0xfff8000000000000|N,False])
check('positive quiet', solve(0x7ff8000000000000|N,0x3ff0000000000000), [0x7ff8000000000000|N,False])
check('quiet left only', solve(0xfff8000000000000|N,0x3ff0000000000000), [0xfff8000000000000|N,False])
check('quiet right only', solve(0x3ff0000000000000,0xfff8000000000000|N), [0xfff8000000000000|N,False])
check('opposite infinities', solve(0x7ff0000000000000,0xfff0000000000000), [0x7ff8000000000000,True])
check('same infinity', solve(0xfff0000000000000,0xfff0000000000000), [0xfff0000000000000,False])
check('finite addition', solve(0x3ff0000000000000,0x3ff0000000000000), [0x4000000000000000,False])
check('negative zeros', solve(1<<63,1<<63), [1<<63,False])
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
left signaling[9221120237041090561, True][9221120237041090561, True]Passed
right signaling[18444492273895866369, True][18444492273895866369, True]Passed
signaling precedence[9221120237041090561, True][9221120237041090561, True]Passed
two signaling[18444492273895866369, True][18444492273895866369, True]Passed
larger right payload[18444492273895866468, False][18444492273895866468, False]Passed
larger left payload[18444492273895866468, False][18444492273895866468, False]Passed
equal left wins[18444492273895866369, False][18444492273895866369, False]Passed
positive quiet[18444492273895866369, False][9221120237041090561, False]Failed
quiet left only[18444492273895866369, False][18444492273895866369, False]Passed
quiet right only[18444492273895866369, False][18444492273895866369, False]Passed
opposite infinities[9221120237041090560, True][9221120237041090560, True]Passed
same infinity[18442240474082181120, False][18442240474082181120, False]Passed
finite addition[4611686018427387904, False][4611686018427387904, False]Passed
negative zeros[9223372036854775808, False][9223372036854775808, False]Passed

SHA-256 / a4fdaed2cef6b1bc475a36e0f539813b7b3a74d5b279a6ebd3bcf95e4c2d7b5d

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 14 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:37.678459+00:00.

Case digest / 901ff164cc94dcaa572635e3a3a3bd0a03c47f36798e87af6a9383a35d29ea9b