{"abstract":"Complementary log exponentials select unstable branches.","category":"Floating-point arithmetic","checks":7,"contract":"Evaluate log(1-exp(x)) for x <= 0; zero maps to negative infinity. Choose a cancellation-safe formula on either side of -log(2). Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.","evaluation_group":"s3-float-log1mexp","failed_approach":"The attempted local correction if x < 0: still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-log1mexp-partition-inverted","id":"FA-16141","implementations":{"attempt":{"sha256":"54da1280ed9d22d75c82d72c299a76e7deebcd7aa5b522fa5b1f3baf52e0ba76","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 'domain'\n        if x==0: return '-infinity'\n        if x < 0:\n            result=math.log1p(-math.exp(x))\n        else:\n            result=math.log(-math.expm1(x))\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('near zero', solve(-N*2.0**-60), render(math.log(N*2.0**-60)))\ncheck('far tail', solve(-50.0-N), render(-math.exp(-50.0-N)))\ncheck('midpoint', solve(-math.log(2)), render(math.log(0.5)))\ncheck('moderate', solve(-1.0), render(math.log1p(-math.exp(-1))))\ncheck('boundary', solve(0.0), \"-infinity\")\ncheck('invalid', solve(float(N)), \"domain\")\ncheck('negative zero', solve(-0.0), \"-infinity\")\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":"2d83a78823ffc33fd9ef89a03026a664e4b1fe24746517c926eb7bcd7c278288","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 'domain'\n        if x==0: return '-infinity'\n        if x > -math.log(2):\n            result=math.log1p(-math.exp(x))\n        else:\n            result=math.log(-math.expm1(x))\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('near zero', solve(-N*2.0**-60), render(math.log(N*2.0**-60)))\ncheck('far tail', solve(-50.0-N), render(-math.exp(-50.0-N)))\ncheck('midpoint', solve(-math.log(2)), render(math.log(0.5)))\ncheck('moderate', solve(-1.0), render(math.log1p(-math.exp(-1))))\ncheck('boundary', solve(0.0), \"-infinity\")\ncheck('invalid', solve(float(N)), \"domain\")\ncheck('negative zero', solve(-0.0), \"-infinity\")\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":"9e8c3385fce009a483a0721ec097c0bbf8027e9adedc27f92b435b5d6d83082d","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 'domain'\n        if x==0: return '-infinity'\n        if x < -math.log(2):\n            result=math.log1p(-math.exp(x))\n        else:\n            result=math.log(-math.expm1(x))\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('near zero', solve(-N*2.0**-60), render(math.log(N*2.0**-60)))\ncheck('far tail', solve(-50.0-N), render(-math.exp(-50.0-N)))\ncheck('midpoint', solve(-math.log(2)), render(math.log(0.5)))\ncheck('moderate', solve(-1.0), render(math.log1p(-math.exp(-1))))\ncheck('boundary', solve(0.0), \"-infinity\")\ncheck('invalid', solve(float(N)), \"domain\")\ncheck('negative zero', solve(-0.0), \"-infinity\")\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-log1mexp-partition-inverted","generated_at":"2026-09-29T14:39:33.434911+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 < -math.log(2):.","root_cause":"Complementary log exponentials select unstable branches. The faulty expression is if x > -math.log(2):.","sha256":"b0fb1b5b1c992be3f7e01e6db94f98fdbbcbdb778f46a6aa25fdb6cb40bccb3d","title":"Complementary log exponentials select unstable branches · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":43.332,"exit_code":1,"observations":[{"actual":"arithmetic-error","check":"near zero","expected":"-41.588830834","passed":false},{"actual":"-7.0954741623e-23","check":"far tail","expected":"-7.0954741623e-23","passed":true},{"actual":"-0.69314718056","check":"midpoint","expected":"-0.69314718056","passed":true},{"actual":"-0.45867514539","check":"moderate","expected":"-0.45867514539","passed":true},{"actual":"-infinity","check":"boundary","expected":"-infinity","passed":true},{"actual":"domain","check":"invalid","expected":"domain","passed":true},{"actual":"-infinity","check":"negative zero","expected":"-infinity","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"near zero\", \"actual\": \"arithmetic-error\", \"expected\": \"-41.588830834\", \"passed\": false}, {\"check\": \"far tail\", \"actual\": \"-7.0954741623e-23\", \"expected\": \"-7.0954741623e-23\", \"passed\": true}, {\"check\": \"midpoint\", \"actual\": \"-0.69314718056\", \"expected\": \"-0.69314718056\", \"passed\": true}, {\"check\": \"moderate\", \"actual\": \"-0.45867514539\", \"expected\": \"-0.45867514539\", \"passed\": true}, {\"check\": \"boundary\", \"actual\": \"-infinity\", \"expected\": \"-infinity\", \"passed\": true}, {\"check\": \"invalid\", \"actual\": \"domain\", \"expected\": \"domain\", \"passed\": true}, {\"check\": \"negative zero\", \"actual\": \"-infinity\", \"expected\": \"-infinity\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":41.502,"exit_code":1,"observations":[{"actual":"arithmetic-error","check":"near zero","expected":"-41.588830834","passed":false},{"actual":"0","check":"far tail","expected":"-7.0954741623e-23","passed":false},{"actual":"-0.69314718056","check":"midpoint","expected":"-0.69314718056","passed":true},{"actual":"-0.45867514539","check":"moderate","expected":"-0.45867514539","passed":true},{"actual":"-infinity","check":"boundary","expected":"-infinity","passed":true},{"actual":"domain","check":"invalid","expected":"domain","passed":true},{"actual":"-infinity","check":"negative zero","expected":"-infinity","passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"near zero\", \"actual\": \"arithmetic-error\", \"expected\": \"-41.588830834\", \"passed\": false}, {\"check\": \"far tail\", \"actual\": \"0\", \"expected\": \"-7.0954741623e-23\", \"passed\": false}, {\"check\": \"midpoint\", \"actual\": \"-0.69314718056\", \"expected\": \"-0.69314718056\", \"passed\": true}, {\"check\": \"moderate\", \"actual\": \"-0.45867514539\", \"expected\": \"-0.45867514539\", \"passed\": true}, {\"check\": \"boundary\", \"actual\": \"-infinity\", \"expected\": \"-infinity\", \"passed\": true}, {\"check\": \"invalid\", \"actual\": \"domain\", \"expected\": \"domain\", \"passed\": true}, {\"check\": \"negative zero\", \"actual\": \"-infinity\", \"expected\": \"-infinity\", \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":44.441,"exit_code":0,"observations":[{"actual":"-41.588830834","check":"near zero","expected":"-41.588830834","passed":true},{"actual":"-7.0954741623e-23","check":"far tail","expected":"-7.0954741623e-23","passed":true},{"actual":"-0.69314718056","check":"midpoint","expected":"-0.69314718056","passed":true},{"actual":"-0.45867514539","check":"moderate","expected":"-0.45867514539","passed":true},{"actual":"-infinity","check":"boundary","expected":"-infinity","passed":true},{"actual":"domain","check":"invalid","expected":"domain","passed":true},{"actual":"-infinity","check":"negative zero","expected":"-infinity","passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"near zero\", \"actual\": \"-41.588830834\", \"expected\": \"-41.588830834\", \"passed\": true}, {\"check\": \"far tail\", \"actual\": \"-7.0954741623e-23\", \"expected\": \"-7.0954741623e-23\", \"passed\": true}, {\"check\": \"midpoint\", \"actual\": \"-0.69314718056\", \"expected\": \"-0.69314718056\", \"passed\": true}, {\"check\": \"moderate\", \"actual\": \"-0.45867514539\", \"expected\": \"-0.45867514539\", \"passed\": true}, {\"check\": \"boundary\", \"actual\": \"-infinity\", \"expected\": \"-infinity\", \"passed\": true}, {\"check\": \"invalid\", \"actual\": \"domain\", \"expected\": \"domain\", \"passed\": true}, {\"check\": \"negative zero\", \"actual\": \"-infinity\", \"expected\": \"-infinity\", \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}