FA-16196 / Floating-point arithmetic / Open access
Sigmoid omits one from the negative-branch normalizer · case 01
Sigmoid omits one from the negative-branch normalizer.
ROOT CAUSE
Sigmoid omits one from the negative-branch normalizer. The faulty expression is result=z/z.
VERIFIED REPAIR
Apply the contract at this fault site using result=z/(1+z).
Unsuccessful approach: The attempted local correction result=z still violates the explicit regression fixtures.
Case 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.
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:
z=math.exp(-x)
result=1/(1+z)
else:
z=math.exp(x)
result=z/z
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('negative huge', solve(-1000.0*N), "0")
check('positive huge', solve(1000.0*N), "1")
check('negative tail', solve(-50.0-N), render(math.exp(-50.0-N)))
check('zero', solve(0.0), "0.5")
check('positive moderate', solve(float(N)), render(1/(1+math.exp(-N))))
check('negative moderate', solve(-float(N)), render(1/(1+math.exp(N))))
check('small', solve(N*1e-8), render(1/(1+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 |
|---|---|---|---|
| negative huge | arithmetic-error | 0 | Failed |
| positive huge | 1 | 1 | Passed |
| negative tail | 1 | 7.0954741623e-23 | Failed |
| zero | 0.5 | 0.5 | Passed |
| positive moderate | 0.73105857863 | 0.73105857863 | Passed |
| negative moderate | 1 | 0.26894142137 | Failed |
| small | 0.5000000025 | 0.5000000025 | Passed |
SHA-256 / f98a9f320de6b604a0c9a34befacf8c5a77fed335a613cabceda887f91e65dcf
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:
z=math.exp(-x)
result=1/(1+z)
else:
z=math.exp(x)
result=z
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('negative huge', solve(-1000.0*N), "0")
check('positive huge', solve(1000.0*N), "1")
check('negative tail', solve(-50.0-N), render(math.exp(-50.0-N)))
check('zero', solve(0.0), "0.5")
check('positive moderate', solve(float(N)), render(1/(1+math.exp(-N))))
check('negative moderate', solve(-float(N)), render(1/(1+math.exp(N))))
check('small', solve(N*1e-8), render(1/(1+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 |
|---|---|---|---|
| negative huge | 0 | 0 | Passed |
| positive huge | 1 | 1 | Passed |
| negative tail | 7.0954741623e-23 | 7.0954741623e-23 | Passed |
| zero | 0.5 | 0.5 | Passed |
| positive moderate | 0.73105857863 | 0.73105857863 | Passed |
| negative moderate | 0.36787944117 | 0.26894142137 | Failed |
| small | 0.5000000025 | 0.5000000025 | Passed |
SHA-256 / c3f36891f0600dd93273d7f03e6ad2f13ae79d4f16fcf37662c7f80b5a23b9e7
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:
z=math.exp(-x)
result=1/(1+z)
else:
z=math.exp(x)
result=z/(1+z)
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('negative huge', solve(-1000.0*N), "0")
check('positive huge', solve(1000.0*N), "1")
check('negative tail', solve(-50.0-N), render(math.exp(-50.0-N)))
check('zero', solve(0.0), "0.5")
check('positive moderate', solve(float(N)), render(1/(1+math.exp(-N))))
check('negative moderate', solve(-float(N)), render(1/(1+math.exp(N))))
check('small', solve(N*1e-8), render(1/(1+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 |
|---|---|---|---|
| negative huge | 0 | 0 | Passed |
| positive huge | 1 | 1 | Passed |
| negative tail | 7.0954741623e-23 | 7.0954741623e-23 | Passed |
| zero | 0.5 | 0.5 | Passed |
| positive moderate | 0.73105857863 | 0.73105857863 | Passed |
| negative moderate | 0.26894142137 | 0.26894142137 | Passed |
| small | 0.5000000025 | 0.5000000025 | Passed |
SHA-256 / c9a5a17cf9866855ffaceed533977c925032502789c904cb13ea4d0c423043b6
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.048555+00:00.
Case digest / da37a275598e3481fdffbfe296692e0e01d3904402de253092014aa2cbfab3e9