{"abstract":"Complementary logarithm reflects positive input into its domain.","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: return 'nan' still violates the explicit regression fixtures.","family":"s3-floating_point_arithmetic-log1mexp-invalid-reflection","id":"FA-16151","implementations":{"attempt":{"sha256":"ff84127c8f20fe2b8d6236698dfd28950b020f57eb7f051279760a58d70b0649","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 'nan'\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"},"broken":{"sha256":"f8540951121f03267cf3b8efd374832c55aa0b6126a7e811aa6586b2fa65916d","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: x=-x\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-invalid-reflection","generated_at":"2026-09-29T14:39:33.526510+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 'domain'.","root_cause":"Complementary logarithm reflects positive input into its domain. The faulty expression is if x>0: x=-x.","sha256":"8b668c9e6aae38e9c3162c845a9cb51c837a68389518377e700524f6823d66f8","title":"Complementary logarithm reflects positive input into its domain · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":41.303,"exit_code":1,"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":"nan","check":"invalid","expected":"domain","passed":false},{"actual":"-infinity","check":"negative zero","expected":"-infinity","passed":true}],"passed":false,"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\": \"nan\", \"expected\": \"domain\", \"passed\": false}, {\"check\": \"negative zero\", \"actual\": \"-infinity\", \"expected\": \"-infinity\", \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":43.182,"exit_code":1,"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":"-0.45867514539","check":"invalid","expected":"domain","passed":false},{"actual":"-infinity","check":"negative zero","expected":"-infinity","passed":true}],"passed":false,"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\": \"-0.45867514539\", \"expected\": \"domain\", \"passed\": false}, {\"check\": \"negative zero\", \"actual\": \"-infinity\", \"expected\": \"-infinity\", \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":44.93,"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"}