FA-16311 / Floating-point arithmetic / Open access
Relative logarithm uses the exponential series sign · case 01
Relative logarithm uses the exponential series sign.
ROOT CAUSE
Relative logarithm uses the exponential series sign. The faulty expression is result=1+x/2+x*x/3.
VERIFIED REPAIR
Apply the contract at this fault site using result=1-x/2+x*x/3.
Unsuccessful approach: The attempted local correction result=1.0 still violates the explicit regression fixtures.
Case contract
Evaluate log1p(x)/x on x>-1 with continuous value one at zero. 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<=-1: return 'domain'
if x==0: return '1'
if abs(x)<1e-8:
result=1+x/2+x*x/3
else:
result=math.log1p(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('tiny', solve(N*1e-10), render(1-N*1e-10/2))
check('negative tiny', solve(-N*1e-10), render(1+N*1e-10/2))
check('normal', solve(float(N)), render(math.log1p(N)/N))
check('negative normal', solve(-0.125*N), render(math.log1p(-0.125*N)/(-0.125*N)))
check('domain', solve(-1.0), "domain")
check('transition', solve(1e-7), render(math.log1p(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 |
| tiny | 1.0000000001 | 0.99999999995 | Failed |
| negative tiny | 0.99999999995 | 1.0000000001 | Failed |
| normal | 0.69314718056 | 0.69314718056 | Passed |
| negative normal | 1.068251141 | 1.068251141 | Passed |
| domain | domain | domain | Passed |
| transition | 0.99999995 | 0.99999995 | Passed |
SHA-256 / 7611e77285dba9512ea6d1e756262bbc4e2366b9826adc3866c60367024a0b19
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<=-1: return 'domain'
if x==0: return '1'
if abs(x)<1e-8:
result=1.0
else:
result=math.log1p(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('tiny', solve(N*1e-10), render(1-N*1e-10/2))
check('negative tiny', solve(-N*1e-10), render(1+N*1e-10/2))
check('normal', solve(float(N)), render(math.log1p(N)/N))
check('negative normal', solve(-0.125*N), render(math.log1p(-0.125*N)/(-0.125*N)))
check('domain', solve(-1.0), "domain")
check('transition', solve(1e-7), render(math.log1p(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 |
| tiny | 1 | 0.99999999995 | Failed |
| negative tiny | 1 | 1.0000000001 | Failed |
| normal | 0.69314718056 | 0.69314718056 | Passed |
| negative normal | 1.068251141 | 1.068251141 | Passed |
| domain | domain | domain | Passed |
| transition | 0.99999995 | 0.99999995 | Passed |
SHA-256 / 38e502841c87b2c41ca55c76bd76938f95f40334d7231f6133c611440227eca9
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<=-1: return 'domain'
if x==0: return '1'
if abs(x)<1e-8:
result=1-x/2+x*x/3
else:
result=math.log1p(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('tiny', solve(N*1e-10), render(1-N*1e-10/2))
check('negative tiny', solve(-N*1e-10), render(1+N*1e-10/2))
check('normal', solve(float(N)), render(math.log1p(N)/N))
check('negative normal', solve(-0.125*N), render(math.log1p(-0.125*N)/(-0.125*N)))
check('domain', solve(-1.0), "domain")
check('transition', solve(1e-7), render(math.log1p(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 |
| tiny | 0.99999999995 | 0.99999999995 | Passed |
| negative tiny | 1.0000000001 | 1.0000000001 | Passed |
| normal | 0.69314718056 | 0.69314718056 | Passed |
| negative normal | 1.068251141 | 1.068251141 | Passed |
| domain | domain | domain | Passed |
| transition | 0.99999995 | 0.99999995 | Passed |
SHA-256 / 8cdf294e4d867d3fece3560f491c51db6f01b504f8845db06852eaa3c46a0a40
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:35.223913+00:00.
Case digest / 236efa88b39827c67a07255fbd023fdd55e9b8b00befd06fbaa27168d00e75a3