FAILURE MAP
← Case archive

FA-16966 / Floating-point arithmetic / Open access

Power increment drops the sign of its exponent · case 01

Power increment drops the sign of its exponent.

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

ROOT CAUSE

Power increment drops the sign of its exponent. The faulty expression is exponent=abs(y)*math.log1p(x).

VERIFIED REPAIR

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

Unsuccessful approach: The attempted local correction exponent=-y*math.log1p(x) 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=abs(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 power20.5Failed
zero exponent11Passed
zero increment11Passed
invalid basedomaindomainPassed

SHA-256 / 032700c3f200ab347b73a971db49737c2a62488de8e3ad4400e930d80540cd1e

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=-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 amplified0.367879441172.7182818285Failed
negative amplified2.71828182850.36787944117Failed
normal0.52Failed
negative power20.5Failed
zero exponent11Passed
zero increment11Passed
invalid basedomaindomainPassed

SHA-256 / 4f00317b6354f00696bd379219116c120a6f7227283fedfd2410d775e1652ae9

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

Case digest / 3d8c83513c5b69afaffa1a0813ec5e6a539e1fc807d1a10c8f56b07dd2454901