{"abstract":"Midpoint silently sorts reversed endpoints.","category":"Floating-point arithmetic","checks":9,"contract":"Finite ordered binary64 midpoint rendered as hex. Opposite-sign endpoints use half-sums to avoid difference overflow; same-sign endpoints use a difference to preserve subnormal increments. Exact equal endpoints preserve their bits.","evaluation_group":"s3-float-midpoint","failed_approach":"The attempted local correction if a>b: return b.hex() still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-midpoint-midpoint-order","id":"FA-17111","implementations":{"attempt":{"sha256":"785f336a58f4208ae11b69446d2b8a8adb0a47e11388dab452de2c33d03f4f6f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\nN = 1\nobservations = []\ndef solve(a,b):\n    if a>b: return b.hex()\n    if a==b: return a.hex()\n    if a<0<b:\n        midpoint=a/2+b/2\n    else:\n        midpoint=a+(b-a)/2\n    return midpoint.hex()\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('opposite huge', solve(-1e308,1e308), 0.0.hex())\ncheck('positive huge', solve(1e308,1.5e308), (1.25e308).hex())\ncheck('negative huge', solve(-1.5e308,-1e308), (-1.25e308).hex())\ncheck('subnormal midpoint', solve(math.ldexp(1.0,-1074),math.ldexp(5.0,-1074)), math.ldexp(3.0,-1074).hex())\ncheck('subnormal same', solve(math.ldexp(1.0,-1074),math.ldexp(3.0,-1074)), math.ldexp(2.0,-1074).hex())\ncheck('negative subnormal', solve(-math.ldexp(3.0,-1074),-math.ldexp(1.0,-1074)), (-math.ldexp(2.0,-1074)).hex())\ncheck('negative zero equal', solve(-0.0,-0.0), (-0.0).hex())\ncheck('ordinary', solve(float(N),float(N+8)), float(N+4).hex())\ncheck('reverse', solve(float(N+1),float(N)), \"invalid\")\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":"2da63a05ca7f32f507c31d8dc0986e9f026a36420c6879501daf224c771cbb04","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\nN = 1\nobservations = []\ndef solve(a,b):\n    if a>b: a,b=b,a\n    if a==b: return a.hex()\n    if a<0<b:\n        midpoint=a/2+b/2\n    else:\n        midpoint=a+(b-a)/2\n    return midpoint.hex()\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('opposite huge', solve(-1e308,1e308), 0.0.hex())\ncheck('positive huge', solve(1e308,1.5e308), (1.25e308).hex())\ncheck('negative huge', solve(-1.5e308,-1e308), (-1.25e308).hex())\ncheck('subnormal midpoint', solve(math.ldexp(1.0,-1074),math.ldexp(5.0,-1074)), math.ldexp(3.0,-1074).hex())\ncheck('subnormal same', solve(math.ldexp(1.0,-1074),math.ldexp(3.0,-1074)), math.ldexp(2.0,-1074).hex())\ncheck('negative subnormal', solve(-math.ldexp(3.0,-1074),-math.ldexp(1.0,-1074)), (-math.ldexp(2.0,-1074)).hex())\ncheck('negative zero equal', solve(-0.0,-0.0), (-0.0).hex())\ncheck('ordinary', solve(float(N),float(N+8)), float(N+4).hex())\ncheck('reverse', solve(float(N+1),float(N)), \"invalid\")\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":"0012a90273b46b3f5e0d0c84c54b3347f32324dff9ac8f78b39bd3527c153291","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\nN = 1\nobservations = []\ndef solve(a,b):\n    if a>b: return 'invalid'\n    if a==b: return a.hex()\n    if a<0<b:\n        midpoint=a/2+b/2\n    else:\n        midpoint=a+(b-a)/2\n    return midpoint.hex()\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('opposite huge', solve(-1e308,1e308), 0.0.hex())\ncheck('positive huge', solve(1e308,1.5e308), (1.25e308).hex())\ncheck('negative huge', solve(-1.5e308,-1e308), (-1.25e308).hex())\ncheck('subnormal midpoint', solve(math.ldexp(1.0,-1074),math.ldexp(5.0,-1074)), math.ldexp(3.0,-1074).hex())\ncheck('subnormal same', solve(math.ldexp(1.0,-1074),math.ldexp(3.0,-1074)), math.ldexp(2.0,-1074).hex())\ncheck('negative subnormal', solve(-math.ldexp(3.0,-1074),-math.ldexp(1.0,-1074)), (-math.ldexp(2.0,-1074)).hex())\ncheck('negative zero equal', solve(-0.0,-0.0), (-0.0).hex())\ncheck('ordinary', solve(float(N),float(N+8)), float(N+4).hex())\ncheck('reverse', solve(float(N+1),float(N)), \"invalid\")\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-midpoint-midpoint-order","generated_at":"2026-09-29T14:39:43.025443+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 if a>b: return 'invalid'.","root_cause":"Midpoint silently sorts reversed endpoints. The faulty expression is if a>b: a,b=b,a.","sha256":"e7aaf0a51cac25b207e1600d82215ed73241cb00363f36185cb2cd7b8436cfad","title":"Midpoint silently sorts reversed endpoints · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":48.92,"exit_code":1,"observations":[{"actual":"0x0.0p+0","check":"opposite huge","expected":"0x0.0p+0","passed":true},{"actual":"0x1.640306766bac8p+1023","check":"positive huge","expected":"0x1.640306766bac8p+1023","passed":true},{"actual":"-0x1.640306766bac8p+1023","check":"negative huge","expected":"-0x1.640306766bac8p+1023","passed":true},{"actual":"0x0.0000000000003p-1022","check":"subnormal midpoint","expected":"0x0.0000000000003p-1022","passed":true},{"actual":"0x0.0000000000002p-1022","check":"subnormal same","expected":"0x0.0000000000002p-1022","passed":true},{"actual":"-0x0.0000000000002p-1022","check":"negative subnormal","expected":"-0x0.0000000000002p-1022","passed":true},{"actual":"-0x0.0p+0","check":"negative zero equal","expected":"-0x0.0p+0","passed":true},{"actual":"0x1.4000000000000p+2","check":"ordinary","expected":"0x1.4000000000000p+2","passed":true},{"actual":"0x1.0000000000000p+0","check":"reverse","expected":"invalid","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"opposite huge\", \"actual\": \"0x0.0p+0\", \"expected\": \"0x0.0p+0\", \"passed\": true}, {\"check\": \"positive huge\", \"actual\": \"0x1.640306766bac8p+1023\", \"expected\": \"0x1.640306766bac8p+1023\", \"passed\": true}, {\"check\": \"negative huge\", \"actual\": \"-0x1.640306766bac8p+1023\", \"expected\": \"-0x1.640306766bac8p+1023\", \"passed\": true}, {\"check\": \"subnormal midpoint\", \"actual\": \"0x0.0000000000003p-1022\", \"expected\": \"0x0.0000000000003p-1022\", \"passed\": true}, {\"check\": \"subnormal same\", \"actual\": \"0x0.0000000000002p-1022\", \"expected\": \"0x0.0000000000002p-1022\", \"passed\": true}, {\"check\": \"negative subnormal\", \"actual\": \"-0x0.0000000000002p-1022\", \"expected\": \"-0x0.0000000000002p-1022\", \"passed\": true}, {\"check\": \"negative zero equal\", \"actual\": \"-0x0.0p+0\", \"expected\": \"-0x0.0p+0\", \"passed\": true}, {\"check\": \"ordinary\", \"actual\": \"0x1.4000000000000p+2\", \"expected\": \"0x1.4000000000000p+2\", \"passed\": true}, {\"check\": \"reverse\", \"actual\": \"0x1.0000000000000p+0\", \"expected\": \"invalid\", \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":44.743,"exit_code":1,"observations":[{"actual":"0x0.0p+0","check":"opposite huge","expected":"0x0.0p+0","passed":true},{"actual":"0x1.640306766bac8p+1023","check":"positive huge","expected":"0x1.640306766bac8p+1023","passed":true},{"actual":"-0x1.640306766bac8p+1023","check":"negative huge","expected":"-0x1.640306766bac8p+1023","passed":true},{"actual":"0x0.0000000000003p-1022","check":"subnormal midpoint","expected":"0x0.0000000000003p-1022","passed":true},{"actual":"0x0.0000000000002p-1022","check":"subnormal same","expected":"0x0.0000000000002p-1022","passed":true},{"actual":"-0x0.0000000000002p-1022","check":"negative subnormal","expected":"-0x0.0000000000002p-1022","passed":true},{"actual":"-0x0.0p+0","check":"negative zero equal","expected":"-0x0.0p+0","passed":true},{"actual":"0x1.4000000000000p+2","check":"ordinary","expected":"0x1.4000000000000p+2","passed":true},{"actual":"0x1.8000000000000p+0","check":"reverse","expected":"invalid","passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"opposite huge\", \"actual\": \"0x0.0p+0\", \"expected\": \"0x0.0p+0\", \"passed\": true}, {\"check\": \"positive huge\", \"actual\": \"0x1.640306766bac8p+1023\", \"expected\": \"0x1.640306766bac8p+1023\", \"passed\": true}, {\"check\": \"negative huge\", \"actual\": \"-0x1.640306766bac8p+1023\", \"expected\": \"-0x1.640306766bac8p+1023\", \"passed\": true}, {\"check\": \"subnormal midpoint\", \"actual\": \"0x0.0000000000003p-1022\", \"expected\": \"0x0.0000000000003p-1022\", \"passed\": true}, {\"check\": \"subnormal same\", \"actual\": \"0x0.0000000000002p-1022\", \"expected\": \"0x0.0000000000002p-1022\", \"passed\": true}, {\"check\": \"negative subnormal\", \"actual\": \"-0x0.0000000000002p-1022\", \"expected\": \"-0x0.0000000000002p-1022\", \"passed\": true}, {\"check\": \"negative zero equal\", \"actual\": \"-0x0.0p+0\", \"expected\": \"-0x0.0p+0\", \"passed\": true}, {\"check\": \"ordinary\", \"actual\": \"0x1.4000000000000p+2\", \"expected\": \"0x1.4000000000000p+2\", \"passed\": true}, {\"check\": \"reverse\", \"actual\": \"0x1.8000000000000p+0\", \"expected\": \"invalid\", \"passed\": false}], \"passed\": false}\n"},"fixed":{"elapsed_ms":46.537,"exit_code":0,"observations":[{"actual":"0x0.0p+0","check":"opposite huge","expected":"0x0.0p+0","passed":true},{"actual":"0x1.640306766bac8p+1023","check":"positive huge","expected":"0x1.640306766bac8p+1023","passed":true},{"actual":"-0x1.640306766bac8p+1023","check":"negative huge","expected":"-0x1.640306766bac8p+1023","passed":true},{"actual":"0x0.0000000000003p-1022","check":"subnormal midpoint","expected":"0x0.0000000000003p-1022","passed":true},{"actual":"0x0.0000000000002p-1022","check":"subnormal same","expected":"0x0.0000000000002p-1022","passed":true},{"actual":"-0x0.0000000000002p-1022","check":"negative subnormal","expected":"-0x0.0000000000002p-1022","passed":true},{"actual":"-0x0.0p+0","check":"negative zero equal","expected":"-0x0.0p+0","passed":true},{"actual":"0x1.4000000000000p+2","check":"ordinary","expected":"0x1.4000000000000p+2","passed":true},{"actual":"invalid","check":"reverse","expected":"invalid","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"opposite huge\", \"actual\": \"0x0.0p+0\", \"expected\": \"0x0.0p+0\", \"passed\": true}, {\"check\": \"positive huge\", \"actual\": \"0x1.640306766bac8p+1023\", \"expected\": \"0x1.640306766bac8p+1023\", \"passed\": true}, {\"check\": \"negative huge\", \"actual\": \"-0x1.640306766bac8p+1023\", \"expected\": \"-0x1.640306766bac8p+1023\", \"passed\": true}, {\"check\": \"subnormal midpoint\", \"actual\": \"0x0.0000000000003p-1022\", \"expected\": \"0x0.0000000000003p-1022\", \"passed\": true}, {\"check\": \"subnormal same\", \"actual\": \"0x0.0000000000002p-1022\", \"expected\": \"0x0.0000000000002p-1022\", \"passed\": true}, {\"check\": \"negative subnormal\", \"actual\": \"-0x0.0000000000002p-1022\", \"expected\": \"-0x0.0000000000002p-1022\", \"passed\": true}, {\"check\": \"negative zero equal\", \"actual\": \"-0x0.0p+0\", \"expected\": \"-0x0.0p+0\", \"passed\": true}, {\"check\": \"ordinary\", \"actual\": \"0x1.4000000000000p+2\", \"expected\": \"0x1.4000000000000p+2\", \"passed\": true}, {\"check\": \"reverse\", \"actual\": \"invalid\", \"expected\": \"invalid\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}