{"abstract":"Sigmoid exponentiates the large magnitude of a negative input.","category":"Floating-point arithmetic","checks":7,"contract":"Evaluate 1/(1+exp(-x)) using a stable branch for negative x. Return a nonnegative probability. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.","evaluation_group":"s3-float-sigmoid","failed_approach":"The attempted local correction z=math.exp(min(-x,700)) still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-sigmoid-negative-overflow","id":"FA-16181","implementations":{"attempt":{"sha256":"c7021a919b653606eaf1f52479863b7b9add2725b64d7d6b5abea003e70ab07a","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:\n            z=math.exp(-x)\n            result=1/(1+z)\n        else:\n            z=math.exp(min(-x,700))\n            result=z/(1+z)\n        return render(result)\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('negative huge', solve(-1000.0*N), \"0\")\ncheck('positive huge', solve(1000.0*N), \"1\")\ncheck('negative tail', solve(-50.0-N), render(math.exp(-50.0-N)))\ncheck('zero', solve(0.0), \"0.5\")\ncheck('positive moderate', solve(float(N)), render(1/(1+math.exp(-N))))\ncheck('negative moderate', solve(-float(N)), render(1/(1+math.exp(N))))\ncheck('small', solve(N*1e-8), render(1/(1+math.exp(-N*1e-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":"5ede44ccf2ea3f765c3f68ded8aafc42d994e0b7561f68a5bf01388d2b01c5cd","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:\n            z=math.exp(-x)\n            result=1/(1+z)\n        else:\n            z=math.exp(-x)\n            result=z/(1+z)\n        return render(result)\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('negative huge', solve(-1000.0*N), \"0\")\ncheck('positive huge', solve(1000.0*N), \"1\")\ncheck('negative tail', solve(-50.0-N), render(math.exp(-50.0-N)))\ncheck('zero', solve(0.0), \"0.5\")\ncheck('positive moderate', solve(float(N)), render(1/(1+math.exp(-N))))\ncheck('negative moderate', solve(-float(N)), render(1/(1+math.exp(N))))\ncheck('small', solve(N*1e-8), render(1/(1+math.exp(-N*1e-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":"c9a5a17cf9866855ffaceed533977c925032502789c904cb13ea4d0c423043b6","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:\n            z=math.exp(-x)\n            result=1/(1+z)\n        else:\n            z=math.exp(x)\n            result=z/(1+z)\n        return render(result)\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('negative huge', solve(-1000.0*N), \"0\")\ncheck('positive huge', solve(1000.0*N), \"1\")\ncheck('negative tail', solve(-50.0-N), render(math.exp(-50.0-N)))\ncheck('zero', solve(0.0), \"0.5\")\ncheck('positive moderate', solve(float(N)), render(1/(1+math.exp(-N))))\ncheck('negative moderate', solve(-float(N)), render(1/(1+math.exp(N))))\ncheck('small', solve(N*1e-8), render(1/(1+math.exp(-N*1e-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-sigmoid-negative-overflow","generated_at":"2026-09-29T14:39:34.047418+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 z=math.exp(x).","root_cause":"Sigmoid exponentiates the large magnitude of a negative input. The faulty expression is z=math.exp(-x).","sha256":"a3dd8462d95e6dfa5d78643fd225d8ed708b8c3c11109a4047a13f9554a8905d","title":"Sigmoid exponentiates the large magnitude of a negative input · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":42.164,"exit_code":1,"observations":[{"actual":"1","check":"negative huge","expected":"0","passed":false},{"actual":"1","check":"positive huge","expected":"1","passed":true},{"actual":"1","check":"negative tail","expected":"7.0954741623e-23","passed":false},{"actual":"0.5","check":"zero","expected":"0.5","passed":true},{"actual":"0.73105857863","check":"positive moderate","expected":"0.73105857863","passed":true},{"actual":"0.73105857863","check":"negative moderate","expected":"0.26894142137","passed":false},{"actual":"0.5000000025","check":"small","expected":"0.5000000025","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"negative huge\", \"actual\": \"1\", \"expected\": \"0\", \"passed\": false}, {\"check\": \"positive huge\", \"actual\": \"1\", \"expected\": \"1\", \"passed\": true}, {\"check\": \"negative tail\", \"actual\": \"1\", \"expected\": \"7.0954741623e-23\", \"passed\": false}, {\"check\": \"zero\", \"actual\": \"0.5\", \"expected\": \"0.5\", \"passed\": true}, {\"check\": \"positive moderate\", \"actual\": \"0.73105857863\", \"expected\": \"0.73105857863\", \"passed\": true}, {\"check\": \"negative moderate\", \"actual\": \"0.73105857863\", \"expected\": \"0.26894142137\", \"passed\": false}, {\"check\": \"small\", \"actual\": \"0.5000000025\", \"expected\": \"0.5000000025\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.109,"exit_code":1,"observations":[{"actual":"arithmetic-error","check":"negative huge","expected":"0","passed":false},{"actual":"1","check":"positive huge","expected":"1","passed":true},{"actual":"1","check":"negative tail","expected":"7.0954741623e-23","passed":false},{"actual":"0.5","check":"zero","expected":"0.5","passed":true},{"actual":"0.73105857863","check":"positive moderate","expected":"0.73105857863","passed":true},{"actual":"0.73105857863","check":"negative moderate","expected":"0.26894142137","passed":false},{"actual":"0.5000000025","check":"small","expected":"0.5000000025","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"negative huge\", \"actual\": \"arithmetic-error\", \"expected\": \"0\", \"passed\": false}, {\"check\": \"positive huge\", \"actual\": \"1\", \"expected\": \"1\", \"passed\": true}, {\"check\": \"negative tail\", \"actual\": \"1\", \"expected\": \"7.0954741623e-23\", \"passed\": false}, {\"check\": \"zero\", \"actual\": \"0.5\", \"expected\": \"0.5\", \"passed\": true}, {\"check\": \"positive moderate\", \"actual\": \"0.73105857863\", \"expected\": \"0.73105857863\", \"passed\": true}, {\"check\": \"negative moderate\", \"actual\": \"0.73105857863\", \"expected\": \"0.26894142137\", \"passed\": false}, {\"check\": \"small\", \"actual\": \"0.5000000025\", \"expected\": \"0.5000000025\", \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":42.146,"exit_code":0,"observations":[{"actual":"0","check":"negative huge","expected":"0","passed":true},{"actual":"1","check":"positive huge","expected":"1","passed":true},{"actual":"7.0954741623e-23","check":"negative tail","expected":"7.0954741623e-23","passed":true},{"actual":"0.5","check":"zero","expected":"0.5","passed":true},{"actual":"0.73105857863","check":"positive moderate","expected":"0.73105857863","passed":true},{"actual":"0.26894142137","check":"negative moderate","expected":"0.26894142137","passed":true},{"actual":"0.5000000025","check":"small","expected":"0.5000000025","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"negative huge\", \"actual\": \"0\", \"expected\": \"0\", \"passed\": true}, {\"check\": \"positive huge\", \"actual\": \"1\", \"expected\": \"1\", \"passed\": true}, {\"check\": \"negative tail\", \"actual\": \"7.0954741623e-23\", \"expected\": \"7.0954741623e-23\", \"passed\": true}, {\"check\": \"zero\", \"actual\": \"0.5\", \"expected\": \"0.5\", \"passed\": true}, {\"check\": \"positive moderate\", \"actual\": \"0.73105857863\", \"expected\": \"0.73105857863\", \"passed\": true}, {\"check\": \"negative moderate\", \"actual\": \"0.26894142137\", \"expected\": \"0.26894142137\", \"passed\": true}, {\"check\": \"small\", \"actual\": \"0.5000000025\", \"expected\": \"0.5000000025\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}