FAILURE MAP
← Case archive

FA-16256 / Floating-point arithmetic / Open access

Inverse cosine forms x squared minus one near its branch point · case 01

Inverse cosine forms x squared minus one near its branch point.

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

ROOT CAUSE

Inverse cosine forms x squared minus one near its branch point. The faulty expression is result=math.log(x+math.sqrt(x*x-1)).

VERIFIED REPAIR

Apply the contract at this fault site using result=math.log1p(t+math.sqrt(t*(x+1))).

Unsuccessful approach: The attempted local correction result=math.log(x+math.sqrt(max(x*x-1,0))) 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 '0'
        if x>1e150:
            result=math.log(x)+math.log(2)
        else:
            t=x-1
            result=math.log(x+math.sqrt(x*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.2146848456e-084.2146848511e-08Failed
near one4.2146848456e-084.2146848511e-08Failed
huge691.46867508691.46867508Passed
normal1.31695789691.3169578969Passed
endpoint00Passed
invaliddomaindomainPassed
negativedomaindomainPassed
mid0.962423650120.96242365012Passed

SHA-256 / 4afe4760fc7d856dd07b3fe41eb4ddb6eef2e3e275f06233824b7ab26f2bc718

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 '0'
        if x>1e150:
            result=math.log(x)+math.log(2)
        else:
            t=x-1
            result=math.log(x+math.sqrt(max(x*x-1,0)))
        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.2146848456e-084.2146848511e-08Failed
near one4.2146848456e-084.2146848511e-08Failed
huge691.46867508691.46867508Passed
normal1.31695789691.3169578969Passed
endpoint00Passed
invaliddomaindomainPassed
negativedomaindomainPassed
mid0.962423650120.96242365012Passed

SHA-256 / cd2e03be792f8e00fdc8d417d5648fb567045c8990f05b46bc1dfc873837b087

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

Case digest / 0fcd653666445fcb781351ba3f5e3a1a93edda6945a2ffab5e7c0296fca251a7