FAILURE MAP
← Case archive

FA-16586 / Floating-point arithmetic / Open access

Floating total order sorts raw unsigned encodings · case 01

Floating total order sorts raw unsigned encodings.

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

ROOT CAUSE

Floating total order sorts raw unsigned encodings. The faulty expression is return bits.

THE FAILURE

Floating total order sorts raw unsigned encodings. The faulty expression is return bits.

Unsuccessful approach: The attempted local correction return bits&((1<<63)-1) still violates the explicit regression fixtures.

Case contract

Sort unsigned binary64 encodings by the stipulated IEEE-style total encoding order: negative NaNs, negative infinity, negative finite, negative zero, positive zero, positive finite, positive infinity, positive NaNs. Within signed NaNs, reversing bits on negatives reverses quietness and payload ordering. Preserve all encodings.

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(values):
    def order(bits):
        return bits
    return sorted(values,key=order)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero order', solve([0,1<<63]), [1<<63,0])
check('negative magnitudes', solve([0xbff0000000000000,0xc000000000000000]), [0xc000000000000000,0xbff0000000000000])
check('positive magnitudes', solve([0x4000000000000000,0x3ff0000000000000]), [0x3ff0000000000000,0x4000000000000000])
check('infinity and nan', solve([0x7ff8000000000000|N,0x7ff0000000000000]), [0x7ff0000000000000,0x7ff8000000000000|N])
check('negative nan order', solve([0xfff0000000000000|N,0xfff8000000000000|N]), [0xfff8000000000000|N,0xfff0000000000000|N])
check('positive payloads', solve([0x7ff8000000000064,0x7ff8000000000000|N]), [0x7ff8000000000000|N,0x7ff8000000000064])
check('negative payloads', solve([0xfff8000000000000|N,0xfff8000000000064]), [0xfff8000000000064,0xfff8000000000000|N])
check('mixed signs', solve([N,(1<<63)|N]), [(1<<63)|N,N])
check('duplicates', solve([N,N]), [N,N])
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
zero order[0, 9223372036854775808][9223372036854775808, 0]Failed
negative magnitudes[13830554455654793216, 13835058055282163712][13835058055282163712, 13830554455654793216]Failed
positive magnitudes[4607182418800017408, 4611686018427387904][4607182418800017408, 4611686018427387904]Passed
infinity and nan[9218868437227405312, 9221120237041090561][9218868437227405312, 9221120237041090561]Passed
negative nan order[18442240474082181121, 18444492273895866369][18444492273895866369, 18442240474082181121]Failed
positive payloads[9221120237041090561, 9221120237041090660][9221120237041090561, 9221120237041090660]Passed
negative payloads[18444492273895866369, 18444492273895866468][18444492273895866468, 18444492273895866369]Failed
mixed signs[1, 9223372036854775809][9223372036854775809, 1]Failed
duplicates[1, 1][1, 1]Passed

SHA-256 / 3455a4d65f8ff9ebc0d3ba6924904a8a87a60261152fc35ea7bfcc9a06d82aef

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(values):
    def order(bits):
        return bits&((1<<63)-1)
    return sorted(values,key=order)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('zero order', solve([0,1<<63]), [1<<63,0])
check('negative magnitudes', solve([0xbff0000000000000,0xc000000000000000]), [0xc000000000000000,0xbff0000000000000])
check('positive magnitudes', solve([0x4000000000000000,0x3ff0000000000000]), [0x3ff0000000000000,0x4000000000000000])
check('infinity and nan', solve([0x7ff8000000000000|N,0x7ff0000000000000]), [0x7ff0000000000000,0x7ff8000000000000|N])
check('negative nan order', solve([0xfff0000000000000|N,0xfff8000000000000|N]), [0xfff8000000000000|N,0xfff0000000000000|N])
check('positive payloads', solve([0x7ff8000000000064,0x7ff8000000000000|N]), [0x7ff8000000000000|N,0x7ff8000000000064])
check('negative payloads', solve([0xfff8000000000000|N,0xfff8000000000064]), [0xfff8000000000064,0xfff8000000000000|N])
check('mixed signs', solve([N,(1<<63)|N]), [(1<<63)|N,N])
check('duplicates', solve([N,N]), [N,N])
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
zero order[0, 9223372036854775808][9223372036854775808, 0]Failed
negative magnitudes[13830554455654793216, 13835058055282163712][13835058055282163712, 13830554455654793216]Failed
positive magnitudes[4607182418800017408, 4611686018427387904][4607182418800017408, 4611686018427387904]Passed
infinity and nan[9218868437227405312, 9221120237041090561][9218868437227405312, 9221120237041090561]Passed
negative nan order[18442240474082181121, 18444492273895866369][18444492273895866369, 18442240474082181121]Failed
positive payloads[9221120237041090561, 9221120237041090660][9221120237041090561, 9221120237041090660]Passed
negative payloads[18444492273895866369, 18444492273895866468][18444492273895866468, 18444492273895866369]Failed
mixed signs[1, 9223372036854775809][9223372036854775809, 1]Failed
duplicates[1, 1][1, 1]Passed

SHA-256 / 267a9d75d9058320206cf8c7f161aac2ce7ebf0dad151780a8b7a3a115db789e

HELD IN THE MEMBER ARCHIVE

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

This mechanism has 9 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:38.026243+00:00.

Case digest / 20a43b36ffca1b76d94107cc1fcdef5237e2a633af47c8fb21768ef22e830030