{"abstract":"Atan2 ignores the x sign for a doubly infinite direction.","category":"Floating-point arithmetic","checks":16,"contract":"Evaluate atan2(y,x) including signed zero and infinite directions; NaN produces nan. Finite nonzero coordinates use ratio of smaller magnitude and quadrant reconstruction. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.","evaluation_group":"s3-float-atan2-special","failed_approach":"The attempted local correction angle=3*math.pi/4 still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-atan2-special-infinite-quadrant","id":"FA-16841","implementations":{"attempt":{"sha256":"430d7d473f8e8de6695f4ed02bc42feeeb673a4dcce77b5d462eb6d34f271f8b","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(y,x):\n    try:\n        if math.isnan(x) or math.isnan(y): return 'nan'\n        if math.isinf(x) and math.isinf(y):\n            angle=3*math.pi/4\n            return render(math.copysign(angle,y))\n        if y==0:\n            return render(math.copysign(math.pi if math.copysign(1.0,x)<0 else 0.0,y))\n        if x==0: return render(math.copysign(math.pi/2,y))\n        a=abs(x); b=abs(y)\n        if b<=a: angle=math.atan(b/a)\n        else: angle=math.pi/2-math.atan(a/b)\n        if x<0: angle=math.pi-angle\n        return render(math.copysign(angle,y))\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 zero axis', solve(0.0,float(N)), \"0\")\ncheck('negative zero axis', solve(-0.0,float(N)), \"-0\")\ncheck('branch above', solve(0.0,-float(N)), render(math.pi))\ncheck('branch below', solve(-0.0,-float(N)), render(-math.pi))\ncheck('positive origin', solve(0.0,0.0), \"0\")\ncheck('positive vertical', solve(float(N),0.0), render(math.pi/2))\ncheck('steep slope', solve(10.0*N,1.0), render(math.atan2(10*N,1)))\ncheck('signed origin', solve(0.0,-0.0), render(math.pi))\ncheck('vertical negative', solve(-float(N),0.0), render(-math.pi/2))\ncheck('quadrant one', solve(float(N),2.0), render(math.atan2(N,2)))\ncheck('quadrant two', solve(float(N),-2.0), render(math.atan2(N,-2)))\ncheck('quadrant three', solve(-float(N),-2.0), render(math.atan2(-N,-2)))\ncheck('tiny slope', solve(N*1e-300,1e300), \"0\")\ncheck('both infinite', solve(math.inf,math.inf), render(math.pi/4))\ncheck('negative infinite', solve(-math.inf,-math.inf), render(-3*math.pi/4))\ncheck('nan coordinate', solve(float(\"nan\"),float(N)), \"nan\")\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":"baea5b564a355c6fb719e0af3b43b001d386b18a2e199c29bdac16aad5857b37","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(y,x):\n    try:\n        if math.isnan(x) or math.isnan(y): return 'nan'\n        if math.isinf(x) and math.isinf(y):\n            angle=math.pi/4\n            return render(math.copysign(angle,y))\n        if y==0:\n            return render(math.copysign(math.pi if math.copysign(1.0,x)<0 else 0.0,y))\n        if x==0: return render(math.copysign(math.pi/2,y))\n        a=abs(x); b=abs(y)\n        if b<=a: angle=math.atan(b/a)\n        else: angle=math.pi/2-math.atan(a/b)\n        if x<0: angle=math.pi-angle\n        return render(math.copysign(angle,y))\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 zero axis', solve(0.0,float(N)), \"0\")\ncheck('negative zero axis', solve(-0.0,float(N)), \"-0\")\ncheck('branch above', solve(0.0,-float(N)), render(math.pi))\ncheck('branch below', solve(-0.0,-float(N)), render(-math.pi))\ncheck('positive origin', solve(0.0,0.0), \"0\")\ncheck('positive vertical', solve(float(N),0.0), render(math.pi/2))\ncheck('steep slope', solve(10.0*N,1.0), render(math.atan2(10*N,1)))\ncheck('signed origin', solve(0.0,-0.0), render(math.pi))\ncheck('vertical negative', solve(-float(N),0.0), render(-math.pi/2))\ncheck('quadrant one', solve(float(N),2.0), render(math.atan2(N,2)))\ncheck('quadrant two', solve(float(N),-2.0), render(math.atan2(N,-2)))\ncheck('quadrant three', solve(-float(N),-2.0), render(math.atan2(-N,-2)))\ncheck('tiny slope', solve(N*1e-300,1e300), \"0\")\ncheck('both infinite', solve(math.inf,math.inf), render(math.pi/4))\ncheck('negative infinite', solve(-math.inf,-math.inf), render(-3*math.pi/4))\ncheck('nan coordinate', solve(float(\"nan\"),float(N)), \"nan\")\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":"f929e4baf91e56cf334bd90146c05b96a4ac1227a21cea2c3278c0336055dc75","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(y,x):\n    try:\n        if math.isnan(x) or math.isnan(y): return 'nan'\n        if math.isinf(x) and math.isinf(y):\n            angle=math.pi/4 if x>0 else 3*math.pi/4\n            return render(math.copysign(angle,y))\n        if y==0:\n            return render(math.copysign(math.pi if math.copysign(1.0,x)<0 else 0.0,y))\n        if x==0: return render(math.copysign(math.pi/2,y))\n        a=abs(x); b=abs(y)\n        if b<=a: angle=math.atan(b/a)\n        else: angle=math.pi/2-math.atan(a/b)\n        if x<0: angle=math.pi-angle\n        return render(math.copysign(angle,y))\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 zero axis', solve(0.0,float(N)), \"0\")\ncheck('negative zero axis', solve(-0.0,float(N)), \"-0\")\ncheck('branch above', solve(0.0,-float(N)), render(math.pi))\ncheck('branch below', solve(-0.0,-float(N)), render(-math.pi))\ncheck('positive origin', solve(0.0,0.0), \"0\")\ncheck('positive vertical', solve(float(N),0.0), render(math.pi/2))\ncheck('steep slope', solve(10.0*N,1.0), render(math.atan2(10*N,1)))\ncheck('signed origin', solve(0.0,-0.0), render(math.pi))\ncheck('vertical negative', solve(-float(N),0.0), render(-math.pi/2))\ncheck('quadrant one', solve(float(N),2.0), render(math.atan2(N,2)))\ncheck('quadrant two', solve(float(N),-2.0), render(math.atan2(N,-2)))\ncheck('quadrant three', solve(-float(N),-2.0), render(math.atan2(-N,-2)))\ncheck('tiny slope', solve(N*1e-300,1e300), \"0\")\ncheck('both infinite', solve(math.inf,math.inf), render(math.pi/4))\ncheck('negative infinite', solve(-math.inf,-math.inf), render(-3*math.pi/4))\ncheck('nan coordinate', solve(float(\"nan\"),float(N)), \"nan\")\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-atan2-special-infinite-quadrant","generated_at":"2026-09-29T14:39:40.359874+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 angle=math.pi/4 if x>0 else 3*math.pi/4.","root_cause":"Atan2 ignores the x sign for a doubly infinite direction. The faulty expression is angle=math.pi/4.","sha256":"fa100a1623cb1bdb2b1dd580ed3f54e747b3a5476fc52b01332c18139c67383b","title":"Atan2 ignores the x sign for a doubly infinite direction · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":43.239,"exit_code":1,"observations":[{"actual":"0","check":"positive zero axis","expected":"0","passed":true},{"actual":"-0","check":"negative zero axis","expected":"-0","passed":true},{"actual":"3.1415926536","check":"branch above","expected":"3.1415926536","passed":true},{"actual":"-3.1415926536","check":"branch below","expected":"-3.1415926536","passed":true},{"actual":"0","check":"positive origin","expected":"0","passed":true},{"actual":"1.5707963268","check":"positive vertical","expected":"1.5707963268","passed":true},{"actual":"1.4711276743","check":"steep slope","expected":"1.4711276743","passed":true},{"actual":"3.1415926536","check":"signed origin","expected":"3.1415926536","passed":true},{"actual":"-1.5707963268","check":"vertical negative","expected":"-1.5707963268","passed":true},{"actual":"0.463647609","check":"quadrant one","expected":"0.463647609","passed":true},{"actual":"2.6779450446","check":"quadrant two","expected":"2.6779450446","passed":true},{"actual":"-2.6779450446","check":"quadrant three","expected":"-2.6779450446","passed":true},{"actual":"0","check":"tiny slope","expected":"0","passed":true},{"actual":"2.3561944902","check":"both infinite","expected":"0.7853981634","passed":false},{"actual":"-2.3561944902","check":"negative infinite","expected":"-2.3561944902","passed":true},{"actual":"nan","check":"nan coordinate","expected":"nan","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"positive zero axis\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"negative zero axis\", \"actual\": \"-0\", \"expected\": \"-0\", \"passed\": true}, {\"check\": \"branch above\", \"actual\": \"3.1415926536\", \"expected\": \"3.1415926536\", \"passed\": true}, {\"check\": \"branch below\", \"actual\": \"-3.1415926536\", \"expected\": \"-3.1415926536\", \"passed\": true}, {\"check\": \"positive origin\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"positive vertical\", \"actual\": \"1.5707963268\", \"expected\": \"1.5707963268\", \"passed\": true}, {\"check\": \"steep slope\", \"actual\": \"1.4711276743\", \"expected\": \"1.4711276743\", \"passed\": true}, {\"check\": \"signed origin\", \"actual\": \"3.1415926536\", \"expected\": \"3.1415926536\", \"passed\": true}, {\"check\": \"vertical negative\", \"actual\": \"-1.5707963268\", \"expected\": \"-1.5707963268\", \"passed\": true}, {\"check\": \"quadrant one\", \"actual\": \"0.463647609\", \"expected\": \"0.463647609\", \"passed\": true}, {\"check\": \"quadrant two\", \"actual\": \"2.6779450446\", \"expected\": \"2.6779450446\", \"passed\": true}, {\"check\": \"quadrant three\", \"actual\": \"-2.6779450446\", \"expected\": \"-2.6779450446\", \"passed\": true}, {\"check\": \"tiny slope\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"both infinite\", \"actual\": \"2.3561944902\", \"expected\": \"0.7853981634\", \"passed\": false}, {\"check\": \"negative infinite\", \"actual\": \"-2.3561944902\", \"expected\": \"-2.3561944902\", \"passed\": true}, {\"check\": \"nan coordinate\", \"actual\": \"nan\", \"expected\": \"nan\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.573,"exit_code":1,"observations":[{"actual":"0","check":"positive zero axis","expected":"0","passed":true},{"actual":"-0","check":"negative zero axis","expected":"-0","passed":true},{"actual":"3.1415926536","check":"branch above","expected":"3.1415926536","passed":true},{"actual":"-3.1415926536","check":"branch below","expected":"-3.1415926536","passed":true},{"actual":"0","check":"positive origin","expected":"0","passed":true},{"actual":"1.5707963268","check":"positive vertical","expected":"1.5707963268","passed":true},{"actual":"1.4711276743","check":"steep slope","expected":"1.4711276743","passed":true},{"actual":"3.1415926536","check":"signed origin","expected":"3.1415926536","passed":true},{"actual":"-1.5707963268","check":"vertical negative","expected":"-1.5707963268","passed":true},{"actual":"0.463647609","check":"quadrant one","expected":"0.463647609","passed":true},{"actual":"2.6779450446","check":"quadrant two","expected":"2.6779450446","passed":true},{"actual":"-2.6779450446","check":"quadrant three","expected":"-2.6779450446","passed":true},{"actual":"0","check":"tiny slope","expected":"0","passed":true},{"actual":"0.7853981634","check":"both infinite","expected":"0.7853981634","passed":true},{"actual":"-0.7853981634","check":"negative infinite","expected":"-2.3561944902","passed":false},{"actual":"nan","check":"nan coordinate","expected":"nan","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"positive zero axis\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"negative zero axis\", \"actual\": \"-0\", \"expected\": \"-0\", \"passed\": true}, {\"check\": \"branch above\", \"actual\": \"3.1415926536\", \"expected\": \"3.1415926536\", \"passed\": true}, {\"check\": \"branch below\", \"actual\": \"-3.1415926536\", \"expected\": \"-3.1415926536\", \"passed\": true}, {\"check\": \"positive origin\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"positive vertical\", \"actual\": \"1.5707963268\", \"expected\": \"1.5707963268\", \"passed\": true}, {\"check\": \"steep slope\", \"actual\": \"1.4711276743\", \"expected\": \"1.4711276743\", \"passed\": true}, {\"check\": \"signed origin\", \"actual\": \"3.1415926536\", \"expected\": \"3.1415926536\", \"passed\": true}, {\"check\": \"vertical negative\", \"actual\": \"-1.5707963268\", \"expected\": \"-1.5707963268\", \"passed\": true}, {\"check\": \"quadrant one\", \"actual\": \"0.463647609\", \"expected\": \"0.463647609\", \"passed\": true}, {\"check\": \"quadrant two\", \"actual\": \"2.6779450446\", \"expected\": \"2.6779450446\", \"passed\": true}, {\"check\": \"quadrant three\", \"actual\": \"-2.6779450446\", \"expected\": \"-2.6779450446\", \"passed\": true}, {\"check\": \"tiny slope\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"both infinite\", \"actual\": \"0.7853981634\", \"expected\": \"0.7853981634\", \"passed\": true}, {\"check\": \"negative infinite\", \"actual\": \"-0.7853981634\", \"expected\": \"-2.3561944902\", \"passed\": false}, {\"check\": \"nan coordinate\", \"actual\": \"nan\", \"expected\": \"nan\", \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.887,"exit_code":0,"observations":[{"actual":"0","check":"positive zero axis","expected":"0","passed":true},{"actual":"-0","check":"negative zero axis","expected":"-0","passed":true},{"actual":"3.1415926536","check":"branch above","expected":"3.1415926536","passed":true},{"actual":"-3.1415926536","check":"branch below","expected":"-3.1415926536","passed":true},{"actual":"0","check":"positive origin","expected":"0","passed":true},{"actual":"1.5707963268","check":"positive vertical","expected":"1.5707963268","passed":true},{"actual":"1.4711276743","check":"steep slope","expected":"1.4711276743","passed":true},{"actual":"3.1415926536","check":"signed origin","expected":"3.1415926536","passed":true},{"actual":"-1.5707963268","check":"vertical negative","expected":"-1.5707963268","passed":true},{"actual":"0.463647609","check":"quadrant one","expected":"0.463647609","passed":true},{"actual":"2.6779450446","check":"quadrant two","expected":"2.6779450446","passed":true},{"actual":"-2.6779450446","check":"quadrant three","expected":"-2.6779450446","passed":true},{"actual":"0","check":"tiny slope","expected":"0","passed":true},{"actual":"0.7853981634","check":"both infinite","expected":"0.7853981634","passed":true},{"actual":"-2.3561944902","check":"negative infinite","expected":"-2.3561944902","passed":true},{"actual":"nan","check":"nan coordinate","expected":"nan","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"positive zero axis\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"negative zero axis\", \"actual\": \"-0\", \"expected\": \"-0\", \"passed\": true}, {\"check\": \"branch above\", \"actual\": \"3.1415926536\", \"expected\": \"3.1415926536\", \"passed\": true}, {\"check\": \"branch below\", \"actual\": \"-3.1415926536\", \"expected\": \"-3.1415926536\", \"passed\": true}, {\"check\": \"positive origin\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"positive vertical\", \"actual\": \"1.5707963268\", \"expected\": \"1.5707963268\", \"passed\": true}, {\"check\": \"steep slope\", \"actual\": \"1.4711276743\", \"expected\": \"1.4711276743\", \"passed\": true}, {\"check\": \"signed origin\", \"actual\": \"3.1415926536\", \"expected\": \"3.1415926536\", \"passed\": true}, {\"check\": \"vertical negative\", \"actual\": \"-1.5707963268\", \"expected\": \"-1.5707963268\", \"passed\": true}, {\"check\": \"quadrant one\", \"actual\": \"0.463647609\", \"expected\": \"0.463647609\", \"passed\": true}, {\"check\": \"quadrant two\", \"actual\": \"2.6779450446\", \"expected\": \"2.6779450446\", \"passed\": true}, {\"check\": \"quadrant three\", \"actual\": \"-2.6779450446\", \"expected\": \"-2.6779450446\", \"passed\": true}, {\"check\": \"tiny slope\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"both infinite\", \"actual\": \"0.7853981634\", \"expected\": \"0.7853981634\", \"passed\": true}, {\"check\": \"negative infinite\", \"actual\": \"-2.3561944902\", \"expected\": \"-2.3561944902\", \"passed\": true}, {\"check\": \"nan coordinate\", \"actual\": \"nan\", \"expected\": \"nan\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}