FAILURE MAP
← Case archive

FA-16986 / Floating-point arithmetic / Open access

Exponential divided difference subtracts close endpoint exponentials · case 01

Exponential divided difference subtracts close endpoint exponentials.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

Exponential divided difference subtracts close endpoint exponentials. The faulty expression is ratio=(math.exp(b)-math.exp(a))/(d*math.exp(a)).

VERIFIED REPAIR

Apply the contract at this fault site using ratio=1+d/2+d*d/6.

Unsuccessful approach: The attempted local correction ratio=(math.exp(d)-1)/d still violates the explicit regression fixtures.

Case contract

Evaluate (exp(b)-exp(a))/(b-a) with continuous value exp(a) when a=b. Fixture exponents are bounded; use expm1 for close endpoints. 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(a,b):
    try:
        if a==b: return render(math.exp(a))
        d=b-a
        if abs(d)<1e-8:
            ratio=(math.exp(b)-math.exp(a))/(d*math.exp(a))
        else:
            ratio=math.expm1(d)/d
        result=math.exp(a)*ratio
        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('coincident', solve(float(N),float(N)), render(math.exp(N)))
check('near endpoints', solve(0.0,N*2.0**-60), "1")
check('shifted near', solve(1.0,1.0+N*2.0**-50), render(math.exp(1)*(1+N*2.0**-50/2)))
check('forward', solve(0.0,float(N)), render(math.expm1(N)/N))
check('reverse', solve(float(N),0.0), render(math.expm1(N)/N))
check('negative interval', solve(-float(N),0.0), render(-math.expm1(-N)/N))
check('separated', solve(-1.0,1.0), render((math.exp(1)-math.exp(-1))/2))
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 fixtureActualExpectedOutcome
coincident2.71828182852.7182818285Passed
near endpoints01Failed
shifted near32.7182818285Failed
forward1.71828182851.7182818285Passed
reverse1.71828182851.7182818285Passed
negative interval0.632120558830.63212055883Passed
separated1.17520119361.1752011936Passed

SHA-256 / 2d5cb6343954b4dfe287de302671c0f4fb4d41cc3538703eedd35feecf8c8988

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(a,b):
    try:
        if a==b: return render(math.exp(a))
        d=b-a
        if abs(d)<1e-8:
            ratio=(math.exp(d)-1)/d
        else:
            ratio=math.expm1(d)/d
        result=math.exp(a)*ratio
        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('coincident', solve(float(N),float(N)), render(math.exp(N)))
check('near endpoints', solve(0.0,N*2.0**-60), "1")
check('shifted near', solve(1.0,1.0+N*2.0**-50), render(math.exp(1)*(1+N*2.0**-50/2)))
check('forward', solve(0.0,float(N)), render(math.expm1(N)/N))
check('reverse', solve(float(N),0.0), render(math.expm1(N)/N))
check('negative interval', solve(-float(N),0.0), render(-math.expm1(-N)/N))
check('separated', solve(-1.0,1.0), render((math.exp(1)-math.exp(-1))/2))
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 fixtureActualExpectedOutcome
coincident2.71828182852.7182818285Passed
near endpoints01Failed
shifted near2.71828182852.7182818285Passed
forward1.71828182851.7182818285Passed
reverse1.71828182851.7182818285Passed
negative interval0.632120558830.63212055883Passed
separated1.17520119361.1752011936Passed

SHA-256 / d3fac0ba3c1f67258aff8fd3af9bc8565da9bbdf92a535ee84fabb7a847bc94a

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(a,b):
    try:
        if a==b: return render(math.exp(a))
        d=b-a
        if abs(d)<1e-8:
            ratio=1+d/2+d*d/6
        else:
            ratio=math.expm1(d)/d
        result=math.exp(a)*ratio
        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('coincident', solve(float(N),float(N)), render(math.exp(N)))
check('near endpoints', solve(0.0,N*2.0**-60), "1")
check('shifted near', solve(1.0,1.0+N*2.0**-50), render(math.exp(1)*(1+N*2.0**-50/2)))
check('forward', solve(0.0,float(N)), render(math.expm1(N)/N))
check('reverse', solve(float(N),0.0), render(math.expm1(N)/N))
check('negative interval', solve(-float(N),0.0), render(-math.expm1(-N)/N))
check('separated', solve(-1.0,1.0), render((math.exp(1)-math.exp(-1))/2))
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 fixtureActualExpectedOutcome
coincident2.71828182852.7182818285Passed
near endpoints11Passed
shifted near2.71828182852.7182818285Passed
forward1.71828182851.7182818285Passed
reverse1.71828182851.7182818285Passed
negative interval0.632120558830.63212055883Passed
separated1.17520119361.1752011936Passed

SHA-256 / d0aa9a6aaee7990745f7de88a4a7e7cc71bf1a0d09d5984b2b42c6414c39b116

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:41.750884+00:00.

Case digest / ebb234755eee86445f8585ec9b2778ef61131ad0db9e73755628a951802baf40