FAILURE MAP
← Case archive

FA-17016 / Floating-point arithmetic / Open access

Log divided difference normalizes its increment by the destination · case 01

Log divided difference normalizes its increment by the destination.

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

ROOT CAUSE

Log divided difference normalizes its increment by the destination. The faulty expression is r=d/b.

VERIFIED REPAIR

Apply the contract at this fault site using r=d/a.

Unsuccessful approach: The attempted local correction r=d/max(a,b) still violates the explicit regression fixtures.

Case contract

Evaluate (log(b)-log(a))/(b-a) for positive finite endpoints with continuous limit 1/a. Close ratios use log1p; fixtures have finite outputs. 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<=0 or b<=0: return 'domain'
        if a==b: return render(1/a)
        d=b-a
        r=d/b
        if abs(r)<0.5:
            result=math.log1p(r)/d
        else:
            result=(math.log(b)-math.log(a))/d
        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(1/N))
check('close', solve(1.0,1.0+N*2.0**-50), render(math.log1p(N*2.0**-50)/(N*2.0**-50)))
check('moderate close', solve(1.0,1.125), render(math.log(1.125)/0.125))
check('far reverse', solve(1e300,1e-300), render((math.log(1e-300)-math.log(1e300))/(1e-300-1e300)))
check('close large', solve(1e100,math.nextafter(1e100,math.inf)), render(1e-100))
check('forward', solve(1.0,float(N+1)), render(math.log(N+1)/N))
check('reverse', solve(float(N+1),1.0), render(math.log(N+1)/N))
check('far', solve(1e-100,1e100), render((200*math.log(10))/(1e100-1e-100)))
check('zero', solve(0.0,float(N)), "domain")
check('negative', solve(float(N),-1.0), "domain")
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
coincident11Passed
close11Passed
moderate close0.842884125260.94226428525Failed
far reverse1.3815510558e-2971.3815510558e-297Passed
close large1e-1001e-100Passed
forward0.693147180560.69314718056Passed
reverse0.693147180560.69314718056Passed
far4.605170186e-984.605170186e-98Passed
zerodomaindomainPassed
negativedomaindomainPassed

SHA-256 / ee85c8003aa3e99e4edea986dc74e3f5bdccebdd6988fb9cb6a44b9e7fc9a245

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<=0 or b<=0: return 'domain'
        if a==b: return render(1/a)
        d=b-a
        r=d/max(a,b)
        if abs(r)<0.5:
            result=math.log1p(r)/d
        else:
            result=(math.log(b)-math.log(a))/d
        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(1/N))
check('close', solve(1.0,1.0+N*2.0**-50), render(math.log1p(N*2.0**-50)/(N*2.0**-50)))
check('moderate close', solve(1.0,1.125), render(math.log(1.125)/0.125))
check('far reverse', solve(1e300,1e-300), render((math.log(1e-300)-math.log(1e300))/(1e-300-1e300)))
check('close large', solve(1e100,math.nextafter(1e100,math.inf)), render(1e-100))
check('forward', solve(1.0,float(N+1)), render(math.log(N+1)/N))
check('reverse', solve(float(N+1),1.0), render(math.log(N+1)/N))
check('far', solve(1e-100,1e100), render((200*math.log(10))/(1e100-1e-100)))
check('zero', solve(0.0,float(N)), "domain")
check('negative', solve(float(N),-1.0), "domain")
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
coincident11Passed
close11Passed
moderate close0.842884125260.94226428525Failed
far reverse1.3815510558e-2971.3815510558e-297Passed
close large1e-1001e-100Passed
forward0.693147180560.69314718056Passed
reverse0.693147180560.69314718056Passed
far4.605170186e-984.605170186e-98Passed
zerodomaindomainPassed
negativedomaindomainPassed

SHA-256 / 352bae7811f4db6be438a4f4462d20284ebb3319da9e4f605856091657e88968

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<=0 or b<=0: return 'domain'
        if a==b: return render(1/a)
        d=b-a
        r=d/a
        if abs(r)<0.5:
            result=math.log1p(r)/d
        else:
            result=(math.log(b)-math.log(a))/d
        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(1/N))
check('close', solve(1.0,1.0+N*2.0**-50), render(math.log1p(N*2.0**-50)/(N*2.0**-50)))
check('moderate close', solve(1.0,1.125), render(math.log(1.125)/0.125))
check('far reverse', solve(1e300,1e-300), render((math.log(1e-300)-math.log(1e300))/(1e-300-1e300)))
check('close large', solve(1e100,math.nextafter(1e100,math.inf)), render(1e-100))
check('forward', solve(1.0,float(N+1)), render(math.log(N+1)/N))
check('reverse', solve(float(N+1),1.0), render(math.log(N+1)/N))
check('far', solve(1e-100,1e100), render((200*math.log(10))/(1e100-1e-100)))
check('zero', solve(0.0,float(N)), "domain")
check('negative', solve(float(N),-1.0), "domain")
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
coincident11Passed
close11Passed
moderate close0.942264285250.94226428525Passed
far reverse1.3815510558e-2971.3815510558e-297Passed
close large1e-1001e-100Passed
forward0.693147180560.69314718056Passed
reverse0.693147180560.69314718056Passed
far4.605170186e-984.605170186e-98Passed
zerodomaindomainPassed
negativedomaindomainPassed

SHA-256 / a97aaddcaa925c3330a498b31615cfa8bd305982c79104056d771e2f26ebce80

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

Case digest / ce35ffd9f6aadc7aad64307bc5c5d90000e80e4100f36581393a2606608a0639