FA-16281 / Floating-point arithmetic / Open access
Exponential relative increment uses a zero removable limit · case 01
Exponential relative increment uses a zero removable limit.
ROOT CAUSE
Exponential relative increment uses a zero removable limit. The faulty expression is if x==0: return '0'.
VERIFIED REPAIR
Apply the contract at this fault site using if x==0: return '1'.
Unsuccessful approach: The attempted local correction if x==0: return 'arithmetic-error' still violates the explicit regression fixtures.
Case contract
Evaluate expm1(x)/x with continuous value one at zero. Inputs are finite and have magnitude at most five. 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: return '0'
if abs(x)<1e-8:
result=1+x/2+x*x/6
else:
result=math.expm1(x)/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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('tiny', solve(N*1e-9), render(1+N*1e-9/2))
check('negative tiny', solve(-N*1e-9), render(1-N*1e-9/2))
check('moderate', solve(float(N)), render(math.expm1(N)/N))
check('negative', solve(-float(N)), render(math.expm1(-N)/(-N)))
check('transition', solve(1e-7), render(math.expm1(1e-7)/1e-7))
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 |
|---|---|---|---|
| zero | 0 | 1 | Failed |
| negative zero | 0 | 1 | Failed |
| tiny | 1.0000000005 | 1.0000000005 | Passed |
| negative tiny | 0.9999999995 | 0.9999999995 | Passed |
| moderate | 1.7182818285 | 1.7182818285 | Passed |
| negative | 0.63212055883 | 0.63212055883 | Passed |
| transition | 1.00000005 | 1.00000005 | Passed |
SHA-256 / 9cb305bbf5c12f68026e551a91ddf180cf8784f4dea613155f6daaf5a18ee787
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: return 'arithmetic-error'
if abs(x)<1e-8:
result=1+x/2+x*x/6
else:
result=math.expm1(x)/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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('tiny', solve(N*1e-9), render(1+N*1e-9/2))
check('negative tiny', solve(-N*1e-9), render(1-N*1e-9/2))
check('moderate', solve(float(N)), render(math.expm1(N)/N))
check('negative', solve(-float(N)), render(math.expm1(-N)/(-N)))
check('transition', solve(1e-7), render(math.expm1(1e-7)/1e-7))
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 |
|---|---|---|---|
| zero | arithmetic-error | 1 | Failed |
| negative zero | arithmetic-error | 1 | Failed |
| tiny | 1.0000000005 | 1.0000000005 | Passed |
| negative tiny | 0.9999999995 | 0.9999999995 | Passed |
| moderate | 1.7182818285 | 1.7182818285 | Passed |
| negative | 0.63212055883 | 0.63212055883 | Passed |
| transition | 1.00000005 | 1.00000005 | Passed |
SHA-256 / b8f352d85fd3c587d1181d37706a502220d525d9842b7e7a012d07700def553c
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: return '1'
if abs(x)<1e-8:
result=1+x/2+x*x/6
else:
result=math.expm1(x)/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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('tiny', solve(N*1e-9), render(1+N*1e-9/2))
check('negative tiny', solve(-N*1e-9), render(1-N*1e-9/2))
check('moderate', solve(float(N)), render(math.expm1(N)/N))
check('negative', solve(-float(N)), render(math.expm1(-N)/(-N)))
check('transition', solve(1e-7), render(math.expm1(1e-7)/1e-7))
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 |
|---|---|---|---|
| zero | 1 | 1 | Passed |
| negative zero | 1 | 1 | Passed |
| tiny | 1.0000000005 | 1.0000000005 | Passed |
| negative tiny | 0.9999999995 | 0.9999999995 | Passed |
| moderate | 1.7182818285 | 1.7182818285 | Passed |
| negative | 0.63212055883 | 0.63212055883 | Passed |
| transition | 1.00000005 | 1.00000005 | Passed |
SHA-256 / 9dce028cca6c4133e78c46150381171f6ee740fae281905cee6ddfff09fdbb34
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.743963+00:00.
Case digest / 8b8aaf0253dea42598ab7dde3c8934b98e763df847f1f9c8bf44f12f069f90f4