FAILURE MAP
← Case archive

FA-17161 / Floating-point arithmetic / Open access

Split base-two exponential uses an unconverted natural exponential · case 01

Split base-two exponential uses an unconverted natural exponential.

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

ROOT CAUSE

Split base-two exponential uses an unconverted natural exponential. The faulty expression is mantissa=math.exp(f).

VERIFIED REPAIR

Apply the contract at this fault site using mantissa=2.0**f.

Unsuccessful approach: The attempted local correction mantissa=math.exp(f/math.log(2)) still violates the explicit regression fixtures.

Case contract

Compute 2**x for finite x by separating its integer exponent from a bounded fractional exponential. Values x>=1024 return positive infinity; x<=-1075 return positive zero under nearest-even rounding. 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>=1024: return '+infinity'
        if x<=-1075: return '0'
        k=math.floor(x)
        f=x-k
        mantissa=math.exp(f)
        result=math.ldexp(mantissa,k)
        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('integer', solve(float(N)), render(2.0**N))
check('negative integer', solve(-float(N)), render(2.0**(-N)))
check('fraction', solve(N+0.5), render(2.0**(N+0.5)))
check('large finite', solve(1023.0), render(2.0**1023))
check('small subnormal', solve(-1074.0), render(math.ldexp(1.0,-1074)))
check('subnormal half above', solve(-1074.5), render(math.ldexp(1.0,-1074)))
check('underflow midpoint', solve(-1075.0), "0")
check('overflow', solve(1024.0), "+infinity")
check('negative fraction', solve(-N-0.5), render(2.0**(-N-0.5)))
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
integer22Passed
negative integer0.50.5Passed
fraction3.29744254142.8284271247Failed
large finite8.9884656743e+3078.9884656743e+307Passed
small subnormal4.9406564584e-3244.9406564584e-324Passed
subnormal half above4.9406564584e-3244.9406564584e-324Passed
underflow midpoint00Passed
overflow+infinity+infinityPassed
negative fraction0.412180317680.35355339059Failed

SHA-256 / ae82e39852397052e5e90125510eca39b07787d257dae21344516ee9cb95c20a

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>=1024: return '+infinity'
        if x<=-1075: return '0'
        k=math.floor(x)
        f=x-k
        mantissa=math.exp(f/math.log(2))
        result=math.ldexp(mantissa,k)
        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('integer', solve(float(N)), render(2.0**N))
check('negative integer', solve(-float(N)), render(2.0**(-N)))
check('fraction', solve(N+0.5), render(2.0**(N+0.5)))
check('large finite', solve(1023.0), render(2.0**1023))
check('small subnormal', solve(-1074.0), render(math.ldexp(1.0,-1074)))
check('subnormal half above', solve(-1074.5), render(math.ldexp(1.0,-1074)))
check('underflow midpoint', solve(-1075.0), "0")
check('overflow', solve(1024.0), "+infinity")
check('negative fraction', solve(-N-0.5), render(2.0**(-N-0.5)))
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
integer22Passed
negative integer0.50.5Passed
fraction4.11440693492.8284271247Failed
large finite8.9884656743e+3078.9884656743e+307Passed
small subnormal4.9406564584e-3244.9406564584e-324Passed
subnormal half above4.9406564584e-3244.9406564584e-324Passed
underflow midpoint00Passed
overflow+infinity+infinityPassed
negative fraction0.514300866870.35355339059Failed

SHA-256 / 0a2c685e58b0067165804c83c90649aa606254fe497a31b089a6fcfb6236101e

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):
    try:
        if x>=1024: return '+infinity'
        if x<=-1075: return '0'
        k=math.floor(x)
        f=x-k
        mantissa=2.0**f
        result=math.ldexp(mantissa,k)
        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('integer', solve(float(N)), render(2.0**N))
check('negative integer', solve(-float(N)), render(2.0**(-N)))
check('fraction', solve(N+0.5), render(2.0**(N+0.5)))
check('large finite', solve(1023.0), render(2.0**1023))
check('small subnormal', solve(-1074.0), render(math.ldexp(1.0,-1074)))
check('subnormal half above', solve(-1074.5), render(math.ldexp(1.0,-1074)))
check('underflow midpoint', solve(-1075.0), "0")
check('overflow', solve(1024.0), "+infinity")
check('negative fraction', solve(-N-0.5), render(2.0**(-N-0.5)))
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
integer22Passed
negative integer0.50.5Passed
fraction2.82842712472.8284271247Passed
large finite8.9884656743e+3078.9884656743e+307Passed
small subnormal4.9406564584e-3244.9406564584e-324Passed
subnormal half above4.9406564584e-3244.9406564584e-324Passed
underflow midpoint00Passed
overflow+infinity+infinityPassed
negative fraction0.353553390590.35355339059Passed

SHA-256 / 5749caa6ea68773b1a6004b0e04f393a13b630b1f8743461d05d60296d737bfc

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

Case digest / 0028d3d6e1610d72dbf1a2de71ed6791b37025684c8df04c27eec395362cbe92