FAILURE MAP
← Case archive

FA-16686 / Floating-point arithmetic / Open access

Same-sign interpolation adds endpoints before weighting · case 01

Same-sign interpolation adds endpoints before weighting.

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

ROOT CAUSE

Same-sign interpolation adds endpoints before weighting. The faulty expression is result=((1-t)*(a+b)+t*(a+b))/2.

VERIFIED REPAIR

Apply the contract at this fault site using result=a+t*(b-a).

Unsuccessful approach: The attempted local correction result=(a+b)/2 still violates the explicit regression fixtures.

Case contract

Interpolate finite a and b at t in [0,1], preserving endpoints and avoiding overflow in a difference or an endpoint sum. Return domain marker outside the interval. 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,t):
    try:
        if not 0<=t<=1: return 'domain'
        if t==0: return render(a)
        if t==1: return render(b)
        if (a<=0<=b) or (b<=0<=a):
            result=(1-t)*a+t*b
        else:
            result=((1-t)*(a+b)+t*(a+b))/2
        result=min(max(a,b),max(min(a,b),result))
        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('opposite asymmetric', solve(-float(N),float(N),0.25), render(-N/2))
check('opposite extremes', solve(-1e308,1e308,0.5), "0")
check('same extremes', solve(1e308,1.5e308,0.5), render(1.25e308))
check('first endpoint', solve(-0.0,float(N),0.0), "-0")
check('last endpoint', solve(float(N),-0.0,1.0), "-0")
check('increasing', solve(float(N),float(N+8),0.25), render(N+2))
check('decreasing', solve(float(N+8),float(N),0.25), render(N+6))
check('negative same sign', solve(-float(N+8),-float(N),0.25), render(-N-6))
check('outside', solve(float(N),float(N+8),1.5), "domain")
check('tiny blend', solve(N*1e-300,3*N*1e-300,0.5), render(2*N*1e-300))
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
opposite asymmetric-0.5-0.5Passed
opposite extremes00Passed
same extremes1.5e+3081.25e+308Failed
first endpoint-0-0Passed
last endpoint-0-0Passed
increasing53Failed
decreasing57Failed
negative same sign-5-7Failed
outsidedomaindomainPassed
tiny blend2e-3002e-300Passed

SHA-256 / 43ba177ba0be34b6688d498fe46dc97d2f3ee59ad7069b25bf57e8a0f8c896e3

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,t):
    try:
        if not 0<=t<=1: return 'domain'
        if t==0: return render(a)
        if t==1: return render(b)
        if (a<=0<=b) or (b<=0<=a):
            result=(1-t)*a+t*b
        else:
            result=(a+b)/2
        result=min(max(a,b),max(min(a,b),result))
        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('opposite asymmetric', solve(-float(N),float(N),0.25), render(-N/2))
check('opposite extremes', solve(-1e308,1e308,0.5), "0")
check('same extremes', solve(1e308,1.5e308,0.5), render(1.25e308))
check('first endpoint', solve(-0.0,float(N),0.0), "-0")
check('last endpoint', solve(float(N),-0.0,1.0), "-0")
check('increasing', solve(float(N),float(N+8),0.25), render(N+2))
check('decreasing', solve(float(N+8),float(N),0.25), render(N+6))
check('negative same sign', solve(-float(N+8),-float(N),0.25), render(-N-6))
check('outside', solve(float(N),float(N+8),1.5), "domain")
check('tiny blend', solve(N*1e-300,3*N*1e-300,0.5), render(2*N*1e-300))
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
opposite asymmetric-0.5-0.5Passed
opposite extremes00Passed
same extremes1.5e+3081.25e+308Failed
first endpoint-0-0Passed
last endpoint-0-0Passed
increasing53Failed
decreasing57Failed
negative same sign-5-7Failed
outsidedomaindomainPassed
tiny blend2e-3002e-300Passed

SHA-256 / 203587bfda8095e867e958126de1cef4d3ac732260416dd589d21f1b9c5bcc94

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,t):
    try:
        if not 0<=t<=1: return 'domain'
        if t==0: return render(a)
        if t==1: return render(b)
        if (a<=0<=b) or (b<=0<=a):
            result=(1-t)*a+t*b
        else:
            result=a+t*(b-a)
        result=min(max(a,b),max(min(a,b),result))
        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('opposite asymmetric', solve(-float(N),float(N),0.25), render(-N/2))
check('opposite extremes', solve(-1e308,1e308,0.5), "0")
check('same extremes', solve(1e308,1.5e308,0.5), render(1.25e308))
check('first endpoint', solve(-0.0,float(N),0.0), "-0")
check('last endpoint', solve(float(N),-0.0,1.0), "-0")
check('increasing', solve(float(N),float(N+8),0.25), render(N+2))
check('decreasing', solve(float(N+8),float(N),0.25), render(N+6))
check('negative same sign', solve(-float(N+8),-float(N),0.25), render(-N-6))
check('outside', solve(float(N),float(N+8),1.5), "domain")
check('tiny blend', solve(N*1e-300,3*N*1e-300,0.5), render(2*N*1e-300))
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
opposite asymmetric-0.5-0.5Passed
opposite extremes00Passed
same extremes1.25e+3081.25e+308Passed
first endpoint-0-0Passed
last endpoint-0-0Passed
increasing33Passed
decreasing77Passed
negative same sign-7-7Passed
outsidedomaindomainPassed
tiny blend2e-3002e-300Passed

SHA-256 / 7bba9214b3973ac4980ab464b751f476a070ab000f3d7b17449065c0764f5c1b

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

Case digest / c56fa48a70725b586a5cd1daf200ab6ff5e50654b2faed483c14580a4fa977d1