FAILURE MAP
← Case archive

FA-16296 / Floating-point arithmetic / Open access

Exponential relative increment uses its logarithmic inverse · case 01

Exponential relative increment uses its logarithmic inverse.

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

ROOT CAUSE

Exponential relative increment uses its logarithmic inverse. The faulty expression is result=math.log1p(x)/x.

THE FAILURE

Exponential relative increment uses its logarithmic inverse. The faulty expression is result=math.log1p(x)/x.

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

Case contract

Evaluate expm1(x)/x with continuous value one at zero. Inputs are finite and have magnitude at most five. 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):
    try:
        if x==0: return '1'
        if abs(x)<1e-8:
            result=1+x/2+x*x/6
        else:
            result=math.log1p(x)/x
        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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('tiny', solve(N*1e-9), render(1+N*1e-9/2))
check('negative tiny', solve(-N*1e-9), render(1-N*1e-9/2))
check('moderate', solve(float(N)), render(math.expm1(N)/N))
check('negative', solve(-float(N)), render(math.expm1(-N)/(-N)))
check('transition', solve(1e-7), render(math.expm1(1e-7)/1e-7))
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
zero11Passed
negative zero11Passed
tiny1.00000000051.0000000005Passed
negative tiny0.99999999950.9999999995Passed
moderate0.693147180561.7182818285Failed
negativearithmetic-error0.63212055883Failed
transition0.999999951.00000005Failed

SHA-256 / c5dea34eae6ae57db4f31ee3477d0cb4657fb40b5fd23779ff4bc48845d7156c

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):
    try:
        if x==0: return '1'
        if abs(x)<1e-8:
            result=1+x/2+x*x/6
        else:
            result=math.log1p(abs(x))/abs(x)
        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('zero', solve(0.0), "1")
check('negative zero', solve(-0.0), "1")
check('tiny', solve(N*1e-9), render(1+N*1e-9/2))
check('negative tiny', solve(-N*1e-9), render(1-N*1e-9/2))
check('moderate', solve(float(N)), render(math.expm1(N)/N))
check('negative', solve(-float(N)), render(math.expm1(-N)/(-N)))
check('transition', solve(1e-7), render(math.expm1(1e-7)/1e-7))
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
zero11Passed
negative zero11Passed
tiny1.00000000051.0000000005Passed
negative tiny0.99999999950.9999999995Passed
moderate0.693147180561.7182818285Failed
negative0.693147180560.63212055883Failed
transition0.999999951.00000005Failed

SHA-256 / 2aa9ea87da3f5f6f77a7f0760a8a2987d7184f70848ed3e61168b1c37c9d0ed8

HELD IN THE MEMBER ARCHIVE

The verified repair and its recorded checks are member-only.

This mechanism has 7 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.

Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.

Member access is invitation-based. Sign in with your invited account to inspect the repair.

Sign in to the archive ↗

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

Case digest / 74addc2d88ed37ddee9029f9929f1e943c2ed6b2afdbbb4ce4e95af63fd01d7a