{"abstract":"Complex logarithm reverses the atan2 arguments.","category":"Floating-point arithmetic","checks":9,"contract":"Principal logarithm of nonzero finite complex x+iy, using hypot and atan2; zero returns a pole marker. Inputs keep hypot finite. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.","evaluation_group":"s3-float-complex-log","failed_approach":"The attempted local correction imag=math.atan2(abs(y),abs(x)) still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-complex-log-argument-order","id":"FA-16486","implementations":{"attempt":{"sha256":"8e9a80125476f9158d85cffd9c5104be8499aed05b410344863ecef246cd897e","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,y):\n    try:\n        if x==0 and y==0: return 'pole'\n        a=abs(x); b=abs(y)\n        hi=max(a,b); lo=min(a,b)\n        ratio=lo/hi\n        real=math.log(hi)+0.5*math.log1p(ratio*ratio)\n        imag=math.atan2(abs(y),abs(x))\n        return [render(real),render(imag)]\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('unequal components', solve(3.0,4.0), [render(math.log(5)),render(math.atan2(4,3))])\ncheck('huge', solve(N*1e200,1e200), [render(math.log(math.hypot(N*1e200,1e200))),render(math.atan2(1,N))])\ncheck('tiny', solve(N*1e-200,-1e-200), [render(math.log(math.hypot(N*1e-200,1e-200))),render(math.atan2(-1,N))])\ncheck('negative real above', solve(-float(N),0.0), [render(math.log(N)),render(math.pi)])\ncheck('negative real below', solve(-float(N),-0.0), [render(math.log(N)),render(-math.pi)])\ncheck('imaginary axis', solve(0.0,float(N)), [render(math.log(N)),render(math.pi/2)])\ncheck('real axis', solve(float(N),0.0), [render(math.log(N)),\"0\"])\ncheck('origin', solve(0.0,0.0), \"pole\")\ncheck('quadrant three', solve(-float(N),-float(N)), [render(math.log(math.hypot(N,N))),render(-3*math.pi/4)])\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":"0e470930b7368c6adbb73e7daa1d418c5d03f3d4e2d46c1c321c142d2aabc0e6","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,y):\n    try:\n        if x==0 and y==0: return 'pole'\n        a=abs(x); b=abs(y)\n        hi=max(a,b); lo=min(a,b)\n        ratio=lo/hi\n        real=math.log(hi)+0.5*math.log1p(ratio*ratio)\n        imag=math.atan2(x,y)\n        return [render(real),render(imag)]\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('unequal components', solve(3.0,4.0), [render(math.log(5)),render(math.atan2(4,3))])\ncheck('huge', solve(N*1e200,1e200), [render(math.log(math.hypot(N*1e200,1e200))),render(math.atan2(1,N))])\ncheck('tiny', solve(N*1e-200,-1e-200), [render(math.log(math.hypot(N*1e-200,1e-200))),render(math.atan2(-1,N))])\ncheck('negative real above', solve(-float(N),0.0), [render(math.log(N)),render(math.pi)])\ncheck('negative real below', solve(-float(N),-0.0), [render(math.log(N)),render(-math.pi)])\ncheck('imaginary axis', solve(0.0,float(N)), [render(math.log(N)),render(math.pi/2)])\ncheck('real axis', solve(float(N),0.0), [render(math.log(N)),\"0\"])\ncheck('origin', solve(0.0,0.0), \"pole\")\ncheck('quadrant three', solve(-float(N),-float(N)), [render(math.log(math.hypot(N,N))),render(-3*math.pi/4)])\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":"90d110e005a3f3aab59f9617726bd5a7fe057ca8740394bba91ace8bbd714e39","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,y):\n    try:\n        if x==0 and y==0: return 'pole'\n        a=abs(x); b=abs(y)\n        hi=max(a,b); lo=min(a,b)\n        ratio=lo/hi\n        real=math.log(hi)+0.5*math.log1p(ratio*ratio)\n        imag=math.atan2(y,x)\n        return [render(real),render(imag)]\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('unequal components', solve(3.0,4.0), [render(math.log(5)),render(math.atan2(4,3))])\ncheck('huge', solve(N*1e200,1e200), [render(math.log(math.hypot(N*1e200,1e200))),render(math.atan2(1,N))])\ncheck('tiny', solve(N*1e-200,-1e-200), [render(math.log(math.hypot(N*1e-200,1e-200))),render(math.atan2(-1,N))])\ncheck('negative real above', solve(-float(N),0.0), [render(math.log(N)),render(math.pi)])\ncheck('negative real below', solve(-float(N),-0.0), [render(math.log(N)),render(-math.pi)])\ncheck('imaginary axis', solve(0.0,float(N)), [render(math.log(N)),render(math.pi/2)])\ncheck('real axis', solve(float(N),0.0), [render(math.log(N)),\"0\"])\ncheck('origin', solve(0.0,0.0), \"pole\")\ncheck('quadrant three', solve(-float(N),-float(N)), [render(math.log(math.hypot(N,N))),render(-3*math.pi/4)])\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-complex-log-argument-order","generated_at":"2026-09-29T14:39:36.692463+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 imag=math.atan2(y,x).","root_cause":"Complex logarithm reverses the atan2 arguments. The faulty expression is imag=math.atan2(x,y).","sha256":"2891a4307111787be7594d075c808de7f2c462245beb4573f2b9dbd630dd15ec","title":"Complex logarithm reverses the atan2 arguments · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.867,"exit_code":1,"observations":[{"actual":["1.6094379124","0.927295218"],"check":"unequal components","expected":["1.6094379124","0.927295218"],"passed":true},{"actual":["460.86359219","0.7853981634"],"check":"huge","expected":["460.86359219","0.7853981634"],"passed":true},{"actual":["-460.17044501","0.7853981634"],"check":"tiny","expected":["-460.17044501","-0.7853981634"],"passed":false},{"actual":["0","0"],"check":"negative real above","expected":["0","3.1415926536"],"passed":false},{"actual":["0","0"],"check":"negative real below","expected":["0","-3.1415926536"],"passed":false},{"actual":["0","1.5707963268"],"check":"imaginary axis","expected":["0","1.5707963268"],"passed":true},{"actual":["0","0"],"check":"real axis","expected":["0","0"],"passed":true},{"actual":"pole","check":"origin","expected":"pole","passed":true},{"actual":["0.34657359028","0.7853981634"],"check":"quadrant three","expected":["0.34657359028","-2.3561944902"],"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unequal components\", \"actual\": [\"1.6094379124\", \"0.927295218\"], \"expected\": [\"1.6094379124\", \"0.927295218\"], \"passed\": true}, {\"check\": \"huge\", \"actual\": [\"460.86359219\", \"0.7853981634\"], \"expected\": [\"460.86359219\", \"0.7853981634\"], \"passed\": true}, {\"check\": \"tiny\", \"actual\": [\"-460.17044501\", \"0.7853981634\"], \"expected\": [\"-460.17044501\", \"-0.7853981634\"], \"passed\": false}, {\"check\": \"negative real above\", \"actual\": [\"0\", \"0\"], \"expected\": [\"0\", \"3.1415926536\"], \"passed\": false}, {\"check\": \"negative real below\", \"actual\": [\"0\", \"0\"], \"expected\": [\"0\", \"-3.1415926536\"], \"passed\": false}, {\"check\": \"imaginary axis\", \"actual\": [\"0\", \"1.5707963268\"], \"expected\": [\"0\", \"1.5707963268\"], \"passed\": true}, {\"check\": \"real axis\", \"actual\": [\"0\", \"0\"], \"expected\": [\"0\", \"0\"], \"passed\": true}, {\"check\": \"origin\", \"actual\": \"pole\", \"expected\": \"pole\", \"passed\": true}, {\"check\": \"quadrant three\", \"actual\": [\"0.34657359028\", \"0.7853981634\"], \"expected\": [\"0.34657359028\", \"-2.3561944902\"], \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.798,"exit_code":1,"observations":[{"actual":["1.6094379124","0.64350110879"],"check":"unequal components","expected":["1.6094379124","0.927295218"],"passed":false},{"actual":["460.86359219","0.7853981634"],"check":"huge","expected":["460.86359219","0.7853981634"],"passed":true},{"actual":["-460.17044501","2.3561944902"],"check":"tiny","expected":["-460.17044501","-0.7853981634"],"passed":false},{"actual":["0","-1.5707963268"],"check":"negative real above","expected":["0","3.1415926536"],"passed":false},{"actual":["0","-1.5707963268"],"check":"negative real below","expected":["0","-3.1415926536"],"passed":false},{"actual":["0","0"],"check":"imaginary axis","expected":["0","1.5707963268"],"passed":false},{"actual":["0","1.5707963268"],"check":"real axis","expected":["0","0"],"passed":false},{"actual":"pole","check":"origin","expected":"pole","passed":true},{"actual":["0.34657359028","-2.3561944902"],"check":"quadrant three","expected":["0.34657359028","-2.3561944902"],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unequal components\", \"actual\": [\"1.6094379124\", \"0.64350110879\"], \"expected\": [\"1.6094379124\", \"0.927295218\"], \"passed\": false}, {\"check\": \"huge\", \"actual\": [\"460.86359219\", \"0.7853981634\"], \"expected\": [\"460.86359219\", \"0.7853981634\"], \"passed\": true}, {\"check\": \"tiny\", \"actual\": [\"-460.17044501\", \"2.3561944902\"], \"expected\": [\"-460.17044501\", \"-0.7853981634\"], \"passed\": false}, {\"check\": \"negative real above\", \"actual\": [\"0\", \"-1.5707963268\"], \"expected\": [\"0\", \"3.1415926536\"], \"passed\": false}, {\"check\": \"negative real below\", \"actual\": [\"0\", \"-1.5707963268\"], \"expected\": [\"0\", \"-3.1415926536\"], \"passed\": false}, {\"check\": \"imaginary axis\", \"actual\": [\"0\", \"0\"], \"expected\": [\"0\", \"1.5707963268\"], \"passed\": false}, {\"check\": \"real axis\", \"actual\": [\"0\", \"1.5707963268\"], \"expected\": [\"0\", \"0\"], \"passed\": false}, {\"check\": \"origin\", \"actual\": \"pole\", \"expected\": \"pole\", \"passed\": true}, {\"check\": \"quadrant three\", \"actual\": [\"0.34657359028\", \"-2.3561944902\"], \"expected\": [\"0.34657359028\", \"-2.3561944902\"], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.965,"exit_code":0,"observations":[{"actual":["1.6094379124","0.927295218"],"check":"unequal components","expected":["1.6094379124","0.927295218"],"passed":true},{"actual":["460.86359219","0.7853981634"],"check":"huge","expected":["460.86359219","0.7853981634"],"passed":true},{"actual":["-460.17044501","-0.7853981634"],"check":"tiny","expected":["-460.17044501","-0.7853981634"],"passed":true},{"actual":["0","3.1415926536"],"check":"negative real above","expected":["0","3.1415926536"],"passed":true},{"actual":["0","-3.1415926536"],"check":"negative real below","expected":["0","-3.1415926536"],"passed":true},{"actual":["0","1.5707963268"],"check":"imaginary axis","expected":["0","1.5707963268"],"passed":true},{"actual":["0","0"],"check":"real axis","expected":["0","0"],"passed":true},{"actual":"pole","check":"origin","expected":"pole","passed":true},{"actual":["0.34657359028","-2.3561944902"],"check":"quadrant three","expected":["0.34657359028","-2.3561944902"],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"unequal components\", \"actual\": [\"1.6094379124\", \"0.927295218\"], \"expected\": [\"1.6094379124\", \"0.927295218\"], \"passed\": true}, {\"check\": \"huge\", \"actual\": [\"460.86359219\", \"0.7853981634\"], \"expected\": [\"460.86359219\", \"0.7853981634\"], \"passed\": true}, {\"check\": \"tiny\", \"actual\": [\"-460.17044501\", \"-0.7853981634\"], \"expected\": [\"-460.17044501\", \"-0.7853981634\"], \"passed\": true}, {\"check\": \"negative real above\", \"actual\": [\"0\", \"3.1415926536\"], \"expected\": [\"0\", \"3.1415926536\"], \"passed\": true}, {\"check\": \"negative real below\", \"actual\": [\"0\", \"-3.1415926536\"], \"expected\": [\"0\", \"-3.1415926536\"], \"passed\": true}, {\"check\": \"imaginary axis\", \"actual\": [\"0\", \"1.5707963268\"], \"expected\": [\"0\", \"1.5707963268\"], \"passed\": true}, {\"check\": \"real axis\", \"actual\": [\"0\", \"0\"], \"expected\": [\"0\", \"0\"], \"passed\": true}, {\"check\": \"origin\", \"actual\": \"pole\", \"expected\": \"pole\", \"passed\": true}, {\"check\": \"quadrant three\", \"actual\": [\"0.34657359028\", \"-2.3561944902\"], \"expected\": [\"0.34657359028\", \"-2.3561944902\"], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}