FAILURE MAP
← Case archive

FA-16961 / Floating-point arithmetic / Open access

Power increment moves the exponent inside log1p · case 01

Power increment moves the exponent inside log1p.

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

ROOT CAUSE

Power increment moves the exponent inside log1p. The faulty expression is exponent=math.log1p(y*x).

VERIFIED REPAIR

Apply the contract at this fault site using exponent=y*math.log1p(x).

Unsuccessful approach: The attempted local correction exponent=math.log1p(x)/y still violates the explicit regression fixtures.

Case contract

Evaluate (1+x)**y without first rounding a small increment into unity. Domain requires x>-1; y is finite, and fixtures have finite results. 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,y):
    try:
        if x<=-1: return 'domain'
        if y==0 or x==0: return '1'
        exponent=math.log1p(y*x)
        result=math.exp(exponent)
        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('tiny amplified', solve(N*2.0**-60,2.0**60), render(math.exp(N)))
check('negative amplified', solve(-N*2.0**-60,2.0**60), render(math.exp(-N)))
check('normal', solve(1.0,float(N)), render(2.0**N))
check('negative power', solve(1.0,-float(N)), render(2.0**(-N)))
check('zero exponent', solve(0.5,0.0), "1")
check('zero increment', solve(0.0,float(N)), "1")
check('invalid base', solve(-2.0,float(N)), "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
tiny amplified22.7182818285Failed
negative amplifiedarithmetic-error0.36787944117Failed
normal22Passed
negative powerarithmetic-error0.5Failed
zero exponent11Passed
zero increment11Passed
invalid basedomaindomainPassed

SHA-256 / c3c990ef51d23f22d057ead288899282e28bf8aa8f49dff500a973c27ee7f4a9

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,y):
    try:
        if x<=-1: return 'domain'
        if y==0 or x==0: return '1'
        exponent=math.log1p(x)/y
        result=math.exp(exponent)
        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('tiny amplified', solve(N*2.0**-60,2.0**60), render(math.exp(N)))
check('negative amplified', solve(-N*2.0**-60,2.0**60), render(math.exp(-N)))
check('normal', solve(1.0,float(N)), render(2.0**N))
check('negative power', solve(1.0,-float(N)), render(2.0**(-N)))
check('zero exponent', solve(0.5,0.0), "1")
check('zero increment', solve(0.0,float(N)), "1")
check('invalid base', solve(-2.0,float(N)), "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
tiny amplified12.7182818285Failed
negative amplified10.36787944117Failed
normal22Passed
negative power0.50.5Passed
zero exponent11Passed
zero increment11Passed
invalid basedomaindomainPassed

SHA-256 / 134de62bf87a0101263523888930f048b34dcce97ce49f323253f27306068275

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,y):
    try:
        if x<=-1: return 'domain'
        if y==0 or x==0: return '1'
        exponent=y*math.log1p(x)
        result=math.exp(exponent)
        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('tiny amplified', solve(N*2.0**-60,2.0**60), render(math.exp(N)))
check('negative amplified', solve(-N*2.0**-60,2.0**60), render(math.exp(-N)))
check('normal', solve(1.0,float(N)), render(2.0**N))
check('negative power', solve(1.0,-float(N)), render(2.0**(-N)))
check('zero exponent', solve(0.5,0.0), "1")
check('zero increment', solve(0.0,float(N)), "1")
check('invalid base', solve(-2.0,float(N)), "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
tiny amplified2.71828182852.7182818285Passed
negative amplified0.367879441170.36787944117Passed
normal22Passed
negative power0.50.5Passed
zero exponent11Passed
zero increment11Passed
invalid basedomaindomainPassed

SHA-256 / c4b47d9a689e667e8fe276dbfd388973a6af1c5fd37c142044212b14d63fbbf6

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

Case digest / 5f66c3ebe5b79068517c6064ccb65ddb072045e34fd8125e7688b3b569836bc0