FA-16956 / Floating-point arithmetic / Open access
Power of one plus a small increment rounds the base before amplification · case 01
Power of one plus a small increment rounds the base before amplification.
ROOT CAUSE
Power of one plus a small increment rounds the base before amplification. The faulty expression is exponent=y*math.log(1+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.log(max(1+x,1e-300)) 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=y*math.log(1+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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| tiny amplified | 1 | 2.7182818285 | Failed |
| negative amplified | 1 | 0.36787944117 | Failed |
| normal | 2 | 2 | Passed |
| negative power | 0.5 | 0.5 | Passed |
| zero exponent | 1 | 1 | Passed |
| zero increment | 1 | 1 | Passed |
| invalid base | domain | domain | Passed |
SHA-256 / 4f3c09e020c3551e24d12f589174b2c57915cc3c192e3e2c82cf73b67dc1e598
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.log(max(1+x,1e-300))
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| tiny amplified | 1 | 2.7182818285 | Failed |
| negative amplified | 1 | 0.36787944117 | Failed |
| normal | 2 | 2 | Passed |
| negative power | 0.5 | 0.5 | Passed |
| zero exponent | 1 | 1 | Passed |
| zero increment | 1 | 1 | Passed |
| invalid base | domain | domain | Passed |
SHA-256 / 3c2cea1f30efa25274eee0b0c56456146f5cb07036595ce91e393a64e2eaedb5
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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| tiny amplified | 2.7182818285 | 2.7182818285 | Passed |
| negative amplified | 0.36787944117 | 0.36787944117 | Passed |
| normal | 2 | 2 | Passed |
| negative power | 0.5 | 0.5 | Passed |
| zero exponent | 1 | 1 | Passed |
| zero increment | 1 | 1 | Passed |
| invalid base | domain | domain | Passed |
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.646897+00:00.
Case digest / d708ec1e3f076730a7ac1813d8ef5a9e3e299e1567e70c53aedc8f3c1673781f