{"abstract":"Reciprocal classifies negative zero through numerical comparison.","category":"Floating-point arithmetic","checks":9,"contract":"Compute the reciprocal of finite binary64 x using exponent decomposition. Signed zeros return signed infinity; overflow returns signed infinity and representable subnormal reciprocals are retained. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.","evaluation_group":"s3-float-reciprocal-scaled","failed_approach":"The attempted local correction if x==0: return '+infinity' still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-reciprocal-scaled-zero-reciprocal-sign","id":"FA-17236","implementations":{"attempt":{"sha256":"0292943208f050c2a20f4b48ca1240f0496267bf221f46a64c0d76e24cc3ca47","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\ndef render(x):\n    if math.isnan(x): return 'nan'\n    if math.isinf(x): return '-infinity' if x<0 else '+infinity'\n    return format(x,'.11g')\n\nN = 1\nobservations = []\ndef solve(x):\n    try:\n        if x==0: return '+infinity'\n        m,e=math.frexp(abs(x))\n        fraction=1/m\n        try:\n            result=math.ldexp(fraction,-e)\n        except OverflowError:\n            return '-infinity' if x<0 else '+infinity'\n        return render(math.copysign(result,x))\n    except (ValueError, OverflowError, ZeroDivisionError, TypeError):\n        return \"arithmetic-error\"\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('positive ordinary', solve(float(N)), render(1/N))\ncheck('negative ordinary', solve(-float(N)), render(-1/N))\ncheck('huge', solve(1e308), render(1e-308))\ncheck('negative huge', solve(-1e308), render(-1e-308))\ncheck('tiny overflow', solve(math.ldexp(1.0,-1074)), \"+infinity\")\ncheck('negative tiny', solve(-math.ldexp(1.0,-1074)), \"-infinity\")\ncheck('positive zero', solve(0.0), \"+infinity\")\ncheck('negative zero', solve(-0.0), \"-infinity\")\ncheck('fraction', solve(0.125), \"8\")\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":"219e67f857de16985aeb682f9d1e6d8352b80b44ca5754773fbc969b854a7e65","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\ndef render(x):\n    if math.isnan(x): return 'nan'\n    if math.isinf(x): return '-infinity' if x<0 else '+infinity'\n    return format(x,'.11g')\n\nN = 1\nobservations = []\ndef solve(x):\n    try:\n        if x==0: return '-infinity' if x<0 else '+infinity'\n        m,e=math.frexp(abs(x))\n        fraction=1/m\n        try:\n            result=math.ldexp(fraction,-e)\n        except OverflowError:\n            return '-infinity' if x<0 else '+infinity'\n        return render(math.copysign(result,x))\n    except (ValueError, OverflowError, ZeroDivisionError, TypeError):\n        return \"arithmetic-error\"\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('positive ordinary', solve(float(N)), render(1/N))\ncheck('negative ordinary', solve(-float(N)), render(-1/N))\ncheck('huge', solve(1e308), render(1e-308))\ncheck('negative huge', solve(-1e308), render(-1e-308))\ncheck('tiny overflow', solve(math.ldexp(1.0,-1074)), \"+infinity\")\ncheck('negative tiny', solve(-math.ldexp(1.0,-1074)), \"-infinity\")\ncheck('positive zero', solve(0.0), \"+infinity\")\ncheck('negative zero', solve(-0.0), \"-infinity\")\ncheck('fraction', solve(0.125), \"8\")\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":"82643796da93f08648e3a833d9bd6056f8ef38de0bbe127c8c746d13d50f4515","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport struct\ndef render(x):\n    if math.isnan(x): return 'nan'\n    if math.isinf(x): return '-infinity' if x<0 else '+infinity'\n    return format(x,'.11g')\n\nN = 1\nobservations = []\ndef solve(x):\n    try:\n        if x==0: return '-infinity' if math.copysign(1.0,x)<0 else '+infinity'\n        m,e=math.frexp(abs(x))\n        fraction=1/m\n        try:\n            result=math.ldexp(fraction,-e)\n        except OverflowError:\n            return '-infinity' if x<0 else '+infinity'\n        return render(math.copysign(result,x))\n    except (ValueError, OverflowError, ZeroDivisionError, TypeError):\n        return \"arithmetic-error\"\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('positive ordinary', solve(float(N)), render(1/N))\ncheck('negative ordinary', solve(-float(N)), render(-1/N))\ncheck('huge', solve(1e308), render(1e-308))\ncheck('negative huge', solve(-1e308), render(-1e-308))\ncheck('tiny overflow', solve(math.ldexp(1.0,-1074)), \"+infinity\")\ncheck('negative tiny', solve(-math.ldexp(1.0,-1074)), \"-infinity\")\ncheck('positive zero', solve(0.0), \"+infinity\")\ncheck('negative zero', solve(-0.0), \"-infinity\")\ncheck('fraction', solve(0.125), \"8\")\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-reciprocal-scaled-zero-reciprocal-sign","generated_at":"2026-09-29T14:39:44.365275+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 x==0: return '-infinity' if math.copysign(1.0,x)<0 else '+infinity'.","root_cause":"Reciprocal classifies negative zero through numerical comparison. The faulty expression is if x==0: return '-infinity' if x<0 else '+infinity'.","sha256":"d24c5f048773079b534bfefb95bc1506056fd6f708af6d470ac77e7cf4cfeaca","title":"Reciprocal classifies negative zero through numerical comparison · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":42.269,"exit_code":1,"observations":[{"actual":"1","check":"positive ordinary","expected":"1","passed":true},{"actual":"-1","check":"negative ordinary","expected":"-1","passed":true},{"actual":"1e-308","check":"huge","expected":"1e-308","passed":true},{"actual":"-1e-308","check":"negative huge","expected":"-1e-308","passed":true},{"actual":"+infinity","check":"tiny overflow","expected":"+infinity","passed":true},{"actual":"-infinity","check":"negative tiny","expected":"-infinity","passed":true},{"actual":"+infinity","check":"positive zero","expected":"+infinity","passed":true},{"actual":"+infinity","check":"negative zero","expected":"-infinity","passed":false},{"actual":"8","check":"fraction","expected":"8","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"positive ordinary\", \"actual\": \"1\", \"expected\": \"1\", \"passed\": true}, {\"check\": \"negative ordinary\", \"actual\": \"-1\", \"expected\": \"-1\", \"passed\": true}, {\"check\": \"huge\", \"actual\": \"1e-308\", \"expected\": \"1e-308\", \"passed\": true}, {\"check\": \"negative huge\", \"actual\": \"-1e-308\", \"expected\": \"-1e-308\", \"passed\": true}, {\"check\": \"tiny overflow\", \"actual\": \"+infinity\", \"expected\": \"+infinity\", \"passed\": true}, {\"check\": \"negative tiny\", \"actual\": \"-infinity\", \"expected\": \"-infinity\", \"passed\": true}, {\"check\": \"positive zero\", \"actual\": \"+infinity\", \"expected\": \"+infinity\", \"passed\": true}, {\"check\": \"negative zero\", \"actual\": \"+infinity\", \"expected\": \"-infinity\", \"passed\": false}, {\"check\": \"fraction\", \"actual\": \"8\", \"expected\": \"8\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.137,"exit_code":1,"observations":[{"actual":"1","check":"positive ordinary","expected":"1","passed":true},{"actual":"-1","check":"negative ordinary","expected":"-1","passed":true},{"actual":"1e-308","check":"huge","expected":"1e-308","passed":true},{"actual":"-1e-308","check":"negative huge","expected":"-1e-308","passed":true},{"actual":"+infinity","check":"tiny overflow","expected":"+infinity","passed":true},{"actual":"-infinity","check":"negative tiny","expected":"-infinity","passed":true},{"actual":"+infinity","check":"positive zero","expected":"+infinity","passed":true},{"actual":"+infinity","check":"negative zero","expected":"-infinity","passed":false},{"actual":"8","check":"fraction","expected":"8","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"positive ordinary\", \"actual\": \"1\", \"expected\": \"1\", \"passed\": true}, {\"check\": \"negative ordinary\", \"actual\": \"-1\", \"expected\": \"-1\", \"passed\": true}, {\"check\": \"huge\", \"actual\": \"1e-308\", \"expected\": \"1e-308\", \"passed\": true}, {\"check\": \"negative huge\", \"actual\": \"-1e-308\", \"expected\": \"-1e-308\", \"passed\": true}, {\"check\": \"tiny overflow\", \"actual\": \"+infinity\", \"expected\": \"+infinity\", \"passed\": true}, {\"check\": \"negative tiny\", \"actual\": \"-infinity\", \"expected\": \"-infinity\", \"passed\": true}, {\"check\": \"positive zero\", \"actual\": \"+infinity\", \"expected\": \"+infinity\", \"passed\": true}, {\"check\": \"negative zero\", \"actual\": \"+infinity\", \"expected\": \"-infinity\", \"passed\": false}, {\"check\": \"fraction\", \"actual\": \"8\", \"expected\": \"8\", \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.994,"exit_code":0,"observations":[{"actual":"1","check":"positive ordinary","expected":"1","passed":true},{"actual":"-1","check":"negative ordinary","expected":"-1","passed":true},{"actual":"1e-308","check":"huge","expected":"1e-308","passed":true},{"actual":"-1e-308","check":"negative huge","expected":"-1e-308","passed":true},{"actual":"+infinity","check":"tiny overflow","expected":"+infinity","passed":true},{"actual":"-infinity","check":"negative tiny","expected":"-infinity","passed":true},{"actual":"+infinity","check":"positive zero","expected":"+infinity","passed":true},{"actual":"-infinity","check":"negative zero","expected":"-infinity","passed":true},{"actual":"8","check":"fraction","expected":"8","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"positive ordinary\", \"actual\": \"1\", \"expected\": \"1\", \"passed\": true}, {\"check\": \"negative ordinary\", \"actual\": \"-1\", \"expected\": \"-1\", \"passed\": true}, {\"check\": \"huge\", \"actual\": \"1e-308\", \"expected\": \"1e-308\", \"passed\": true}, {\"check\": \"negative huge\", \"actual\": \"-1e-308\", \"expected\": \"-1e-308\", \"passed\": true}, {\"check\": \"tiny overflow\", \"actual\": \"+infinity\", \"expected\": \"+infinity\", \"passed\": true}, {\"check\": \"negative tiny\", \"actual\": \"-infinity\", \"expected\": \"-infinity\", \"passed\": true}, {\"check\": \"positive zero\", \"actual\": \"+infinity\", \"expected\": \"+infinity\", \"passed\": true}, {\"check\": \"negative zero\", \"actual\": \"-infinity\", \"expected\": \"-infinity\", \"passed\": true}, {\"check\": \"fraction\", \"actual\": \"8\", \"expected\": \"8\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}