FAILURE MAP
← Case archive

FA-16271 / Floating-point arithmetic / Open access

Inverse cosine rejects its finite branch point · case 01

Inverse cosine rejects its finite branch point.

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

ROOT CAUSE

Inverse cosine rejects its finite branch point. The faulty expression is if x==1: return 'domain'.

VERIFIED REPAIR

Apply the contract at this fault site using if x==1: return '0'.

Unsuccessful approach: The attempted local correction if x==1: return '-infinity' still violates the explicit regression fixtures.

Case contract

Evaluate inverse hyperbolic cosine for finite x>=1. Use logarithmic scaling for huge inputs and a log1p expression near one. 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<1: return 'domain'
        if x==1: return 'domain'
        if x>1e150:
            result=math.log(x)+math.log(2)
        else:
            t=x-1
            result=math.log1p(t+math.sqrt(t*(x+1)))
        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('fixed near one', solve(1+2.0**-50), render(math.acosh(1+2.0**-50)))
check('near one', solve(1+N*2.0**-50), render(math.acosh(1+N*2.0**-50)))
check('huge', solve(N*1e300), render(math.acosh(N*1e300)))
check('normal', solve(1.0+N), render(math.acosh(1.0+N)))
check('endpoint', solve(1.0), "0")
check('invalid', solve(0.0), "domain")
check('negative', solve(-float(N)), "domain")
check('mid', solve(1.5), render(math.acosh(1.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
fixed near one4.2146848511e-084.2146848511e-08Passed
near one4.2146848511e-084.2146848511e-08Passed
huge691.46867508691.46867508Passed
normal1.31695789691.3169578969Passed
endpointdomain0Failed
invaliddomaindomainPassed
negativedomaindomainPassed
mid0.962423650120.96242365012Passed

SHA-256 / d4e15751ff69925cbb95edf06e471f420493d8f0088e7ac67c020ba0cce94d2b

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<1: return 'domain'
        if x==1: return '-infinity'
        if x>1e150:
            result=math.log(x)+math.log(2)
        else:
            t=x-1
            result=math.log1p(t+math.sqrt(t*(x+1)))
        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('fixed near one', solve(1+2.0**-50), render(math.acosh(1+2.0**-50)))
check('near one', solve(1+N*2.0**-50), render(math.acosh(1+N*2.0**-50)))
check('huge', solve(N*1e300), render(math.acosh(N*1e300)))
check('normal', solve(1.0+N), render(math.acosh(1.0+N)))
check('endpoint', solve(1.0), "0")
check('invalid', solve(0.0), "domain")
check('negative', solve(-float(N)), "domain")
check('mid', solve(1.5), render(math.acosh(1.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
fixed near one4.2146848511e-084.2146848511e-08Passed
near one4.2146848511e-084.2146848511e-08Passed
huge691.46867508691.46867508Passed
normal1.31695789691.3169578969Passed
endpoint-infinity0Failed
invaliddomaindomainPassed
negativedomaindomainPassed
mid0.962423650120.96242365012Passed

SHA-256 / 06c84f86693ccd84216fcbc33e8b8944d49e6872b1d0d2f955db2e3d0831cfd5

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<1: return 'domain'
        if x==1: return '0'
        if x>1e150:
            result=math.log(x)+math.log(2)
        else:
            t=x-1
            result=math.log1p(t+math.sqrt(t*(x+1)))
        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('fixed near one', solve(1+2.0**-50), render(math.acosh(1+2.0**-50)))
check('near one', solve(1+N*2.0**-50), render(math.acosh(1+N*2.0**-50)))
check('huge', solve(N*1e300), render(math.acosh(N*1e300)))
check('normal', solve(1.0+N), render(math.acosh(1.0+N)))
check('endpoint', solve(1.0), "0")
check('invalid', solve(0.0), "domain")
check('negative', solve(-float(N)), "domain")
check('mid', solve(1.5), render(math.acosh(1.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
fixed near one4.2146848511e-084.2146848511e-08Passed
near one4.2146848511e-084.2146848511e-08Passed
huge691.46867508691.46867508Passed
normal1.31695789691.3169578969Passed
endpoint00Passed
invaliddomaindomainPassed
negativedomaindomainPassed
mid0.962423650120.96242365012Passed

SHA-256 / 137bdac84d7b5baab52f9454e9710a9b859cddef10da835f53f1c155ed9692c1

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

Case digest / 78f99a1123fdcafe1acc0c1266bdd7a34cce579484f0d667dfb18875ef1410b4