{"abstract":"ULP distance leaves the first negative encoding unsigned.","category":"Floating-point arithmetic","checks":9,"contract":"Distance between finite binary64 values in representable steps, treating the two zeros as a single position; NaN or infinity yields null. Negative and positive subnormals are adjacent through zero.","evaluation_group":"s3-float-ulp-distance","failed_approach":"The attempted local correction a_index=~ab if ab>>63 else ab still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-ulp-distance-negative-index-a","id":"FA-16091","implementations":{"attempt":{"sha256":"181ec215dae198f111437e685433ee1e080194cdf0909470b3f8fd02001ecfa3","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\nN = 1\nobservations = []\ndef solve(a,b):\n    if not math.isfinite(a) or not math.isfinite(b): return None\n    ab=int.from_bytes(struct.pack('>d',a),'big')\n    bb=int.from_bytes(struct.pack('>d',b),'big')\n    a_index=~ab if ab>>63 else ab\n    b_index=-(bb&((1<<63)-1)) if bb>>63 else bb\n    return abs(a_index-b_index)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('same', solve(float(N),float(N)), 0)\ncheck('zero signs', solve(-0.0,0.0), 0)\ncheck('negative adjacent', solve(-float(N),math.nextafter(-float(N),-math.inf)), 1)\ncheck('positive adjacent', solve(float(N),math.nextafter(float(N),math.inf)), 1)\ncheck('cross zero', solve(-math.ldexp(float(N),-1074),math.ldexp(float(N),-1074)), 2*N)\ncheck('reverse cross', solve(math.ldexp(float(N),-1074),-math.ldexp(float(N),-1074)), 2*N)\ncheck('nan left', solve(float(\"nan\"),1.0), None)\ncheck('nan right', solve(1.0,float(\"nan\")), None)\ncheck('infinity', solve(math.inf,math.inf), None)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"da781445cc325f5cadfd5449062ae17898807930bc2a9415eabb060e76ea1cc3","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\nN = 1\nobservations = []\ndef solve(a,b):\n    if not math.isfinite(a) or not math.isfinite(b): return None\n    ab=int.from_bytes(struct.pack('>d',a),'big')\n    bb=int.from_bytes(struct.pack('>d',b),'big')\n    a_index=ab\n    b_index=-(bb&((1<<63)-1)) if bb>>63 else bb\n    return abs(a_index-b_index)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('same', solve(float(N),float(N)), 0)\ncheck('zero signs', solve(-0.0,0.0), 0)\ncheck('negative adjacent', solve(-float(N),math.nextafter(-float(N),-math.inf)), 1)\ncheck('positive adjacent', solve(float(N),math.nextafter(float(N),math.inf)), 1)\ncheck('cross zero', solve(-math.ldexp(float(N),-1074),math.ldexp(float(N),-1074)), 2*N)\ncheck('reverse cross', solve(math.ldexp(float(N),-1074),-math.ldexp(float(N),-1074)), 2*N)\ncheck('nan left', solve(float(\"nan\"),1.0), None)\ncheck('nan right', solve(1.0,float(\"nan\")), None)\ncheck('infinity', solve(math.inf,math.inf), None)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"b4444a40538d6b1c2937a3fd331d44cb409920423aaa46f429612d1c2911aa1c","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\nN = 1\nobservations = []\ndef solve(a,b):\n    if not math.isfinite(a) or not math.isfinite(b): return None\n    ab=int.from_bytes(struct.pack('>d',a),'big')\n    bb=int.from_bytes(struct.pack('>d',b),'big')\n    a_index=-(ab&((1<<63)-1)) if ab>>63 else ab\n    b_index=-(bb&((1<<63)-1)) if bb>>63 else bb\n    return abs(a_index-b_index)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('same', solve(float(N),float(N)), 0)\ncheck('zero signs', solve(-0.0,0.0), 0)\ncheck('negative adjacent', solve(-float(N),math.nextafter(-float(N),-math.inf)), 1)\ncheck('positive adjacent', solve(float(N),math.nextafter(float(N),math.inf)), 1)\ncheck('cross zero', solve(-math.ldexp(float(N),-1074),math.ldexp(float(N),-1074)), 2*N)\ncheck('reverse cross', solve(math.ldexp(float(N),-1074),-math.ldexp(float(N),-1074)), 2*N)\ncheck('nan left', solve(float(\"nan\"),1.0), None)\ncheck('nan right', solve(1.0,float(\"nan\")), None)\ncheck('infinity', solve(math.inf,math.inf), None)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"s3-floating_point_arithmetic-ulp-distance-negative-index-a","generated_at":"2026-09-29T14:39:33.037979+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"An offline floating representation model isolates a reproducible arithmetic fault.","repair":"Apply the contract at this fault site using a_index=-(ab&((1<<63)-1)) if ab>>63 else ab.","root_cause":"ULP distance leaves the first negative encoding unsigned. The faulty expression is a_index=ab.","sha256":"9c6c751df3e0f6a40652a3e3602861d7ad21e396cb560a4e1d0fbdf89a9a8217","title":"ULP distance leaves the first negative encoding unsigned · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.176,"exit_code":1,"observations":[{"actual":0,"check":"same","expected":0,"passed":true},{"actual":9223372036854775809,"check":"zero signs","expected":0,"passed":false},{"actual":9223372036854775808,"check":"negative adjacent","expected":1,"passed":false},{"actual":1,"check":"positive adjacent","expected":1,"passed":true},{"actual":9223372036854775811,"check":"cross zero","expected":2,"passed":false},{"actual":2,"check":"reverse cross","expected":2,"passed":true},{"actual":null,"check":"nan left","expected":null,"passed":true},{"actual":null,"check":"nan right","expected":null,"passed":true},{"actual":null,"check":"infinity","expected":null,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"same\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"zero signs\", \"actual\": 9223372036854775809, \"expected\": 0, \"passed\": false}, {\"check\": \"negative adjacent\", \"actual\": 9223372036854775808, \"expected\": 1, \"passed\": false}, {\"check\": \"positive adjacent\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"cross zero\", \"actual\": 9223372036854775811, \"expected\": 2, \"passed\": false}, {\"check\": \"reverse cross\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"nan left\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"nan right\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"infinity\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.957,"exit_code":1,"observations":[{"actual":0,"check":"same","expected":0,"passed":true},{"actual":9223372036854775808,"check":"zero signs","expected":0,"passed":false},{"actual":18437736874454810625,"check":"negative adjacent","expected":1,"passed":false},{"actual":1,"check":"positive adjacent","expected":1,"passed":true},{"actual":9223372036854775808,"check":"cross zero","expected":2,"passed":false},{"actual":2,"check":"reverse cross","expected":2,"passed":true},{"actual":null,"check":"nan left","expected":null,"passed":true},{"actual":null,"check":"nan right","expected":null,"passed":true},{"actual":null,"check":"infinity","expected":null,"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"same\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"zero signs\", \"actual\": 9223372036854775808, \"expected\": 0, \"passed\": false}, {\"check\": \"negative adjacent\", \"actual\": 18437736874454810625, \"expected\": 1, \"passed\": false}, {\"check\": \"positive adjacent\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"cross zero\", \"actual\": 9223372036854775808, \"expected\": 2, \"passed\": false}, {\"check\": \"reverse cross\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"nan left\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"nan right\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"infinity\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.233,"exit_code":0,"observations":[{"actual":0,"check":"same","expected":0,"passed":true},{"actual":0,"check":"zero signs","expected":0,"passed":true},{"actual":1,"check":"negative adjacent","expected":1,"passed":true},{"actual":1,"check":"positive adjacent","expected":1,"passed":true},{"actual":2,"check":"cross zero","expected":2,"passed":true},{"actual":2,"check":"reverse cross","expected":2,"passed":true},{"actual":null,"check":"nan left","expected":null,"passed":true},{"actual":null,"check":"nan right","expected":null,"passed":true},{"actual":null,"check":"infinity","expected":null,"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"same\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"zero signs\", \"actual\": 0, \"expected\": 0, \"passed\": true}, {\"check\": \"negative adjacent\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"positive adjacent\", \"actual\": 1, \"expected\": 1, \"passed\": true}, {\"check\": \"cross zero\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"reverse cross\", \"actual\": 2, \"expected\": 2, \"passed\": true}, {\"check\": \"nan left\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"nan right\", \"actual\": null, \"expected\": null, \"passed\": true}, {\"check\": \"infinity\", \"actual\": null, \"expected\": null, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}