FA-16176 / Floating-point arithmetic / Open access
Negative softplus uses a reflected exponential · case 01
Negative softplus uses a reflected exponential.
ROOT CAUSE
Negative softplus uses a reflected exponential. The faulty expression is result=math.log1p(math.exp(-x)).
VERIFIED REPAIR
Apply the contract at this fault site using result=math.log1p(math.exp(x)).
Unsuccessful approach: The attempted local correction result=math.log1p(math.exp(abs(x))) still violates the explicit regression fixtures.
Case contract
Evaluate log(1+exp(x)) without overflowing or erasing a small positive tail. Finite results are rendered to eleven significant decimal digits; modeled domain violations and arithmetic errors are explicit strings.
Why this case matters
An offline floating representation model isolates a reproducible arithmetic fault.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
def render(x):
if math.isnan(x): return 'nan'
if math.isinf(x): return '-infinity' if x<0 else '+infinity'
return format(x,'.11g')
N = 1
observations = []
def solve(x):
try:
if x>0:
result=x+math.log1p(math.exp(-x))
else:
result=math.log1p(math.exp(-x))
return render(result)
except (ValueError, OverflowError, ZeroDivisionError, TypeError):
return "arithmetic-error"
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive huge', solve(1000.0*N), render(1000.0*N))
check('negative tail', solve(-50.0-N), render(math.exp(-50.0-N)))
check('zero', solve(0.0), render(math.log(2)))
check('positive moderate', solve(float(N)), render(math.log1p(math.exp(float(N)))))
check('negative moderate', solve(-float(N)), render(math.log1p(math.exp(-float(N)))))
check('small positive', solve(N*1e-8), render(math.log1p(math.exp(N*1e-8))))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| positive huge | 1000 | 1000 | Passed |
| negative tail | 51 | 7.0954741623e-23 | Failed |
| zero | 0.69314718056 | 0.69314718056 | Passed |
| positive moderate | 1.3132616875 | 1.3132616875 | Passed |
| negative moderate | 1.3132616875 | 0.31326168752 | Failed |
| small positive | 0.69314718556 | 0.69314718556 | Passed |
SHA-256 / ba5643ce9590bf9cefbe3aedb03b6055496f2d138fad9da212fe14aade733d32
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
def render(x):
if math.isnan(x): return 'nan'
if math.isinf(x): return '-infinity' if x<0 else '+infinity'
return format(x,'.11g')
N = 1
observations = []
def solve(x):
try:
if x>0:
result=x+math.log1p(math.exp(-x))
else:
result=math.log1p(math.exp(abs(x)))
return render(result)
except (ValueError, OverflowError, ZeroDivisionError, TypeError):
return "arithmetic-error"
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive huge', solve(1000.0*N), render(1000.0*N))
check('negative tail', solve(-50.0-N), render(math.exp(-50.0-N)))
check('zero', solve(0.0), render(math.log(2)))
check('positive moderate', solve(float(N)), render(math.log1p(math.exp(float(N)))))
check('negative moderate', solve(-float(N)), render(math.log1p(math.exp(-float(N)))))
check('small positive', solve(N*1e-8), render(math.log1p(math.exp(N*1e-8))))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| positive huge | 1000 | 1000 | Passed |
| negative tail | 51 | 7.0954741623e-23 | Failed |
| zero | 0.69314718056 | 0.69314718056 | Passed |
| positive moderate | 1.3132616875 | 1.3132616875 | Passed |
| negative moderate | 1.3132616875 | 0.31326168752 | Failed |
| small positive | 0.69314718556 | 0.69314718556 | Passed |
SHA-256 / d0110ec3513da59b3c72a29ec237f8be66c3ffaebba7aefa82d225b982e99587
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
import struct
def render(x):
if math.isnan(x): return 'nan'
if math.isinf(x): return '-infinity' if x<0 else '+infinity'
return format(x,'.11g')
N = 1
observations = []
def solve(x):
try:
if x>0:
result=x+math.log1p(math.exp(-x))
else:
result=math.log1p(math.exp(x))
return render(result)
except (ValueError, OverflowError, ZeroDivisionError, TypeError):
return "arithmetic-error"
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('positive huge', solve(1000.0*N), render(1000.0*N))
check('negative tail', solve(-50.0-N), render(math.exp(-50.0-N)))
check('zero', solve(0.0), render(math.log(2)))
check('positive moderate', solve(float(N)), render(math.log1p(math.exp(float(N)))))
check('negative moderate', solve(-float(N)), render(math.log1p(math.exp(-float(N)))))
check('small positive', solve(N*1e-8), render(math.log1p(math.exp(N*1e-8))))
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| positive huge | 1000 | 1000 | Passed |
| negative tail | 7.0954741623e-23 | 7.0954741623e-23 | Passed |
| zero | 0.69314718056 | 0.69314718056 | Passed |
| positive moderate | 1.3132616875 | 1.3132616875 | Passed |
| negative moderate | 0.31326168752 | 0.31326168752 | Passed |
| small positive | 0.69314718556 | 0.69314718556 | Passed |
SHA-256 / b3e0d0ed0bb46c46fb9f2ef65916ed9a364d4676147e96f2f123c6ab89501610
Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:39:34.002663+00:00.
Case digest / 9d7468b04518044cde413c3cfb19bd709e5b120a626738640291724ab79fab96