FA-16221 / Floating-point arithmetic / Open access
Inverse tangent assigns the wrong sign at its negative pole · case 01
Inverse tangent assigns the wrong sign at its negative pole.
ROOT CAUSE
Inverse tangent assigns the wrong sign at its negative pole. The faulty expression is if x==-1: return '+infinity'.
VERIFIED REPAIR
Apply the contract at this fault site using if x==-1: return '-infinity'.
Unsuccessful approach: The attempted local correction if x==-1: return 'domain' still violates the explicit regression fixtures.
Case contract
Evaluate inverse hyperbolic tangent on [-1,1], with signed infinite endpoints and a domain marker outside. 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 abs(x)>1: return 'domain'
if x==1: return '+infinity'
if x==-1: return '+infinity'
if x==0: return render(x)
a=abs(x)
result=0.5*math.log1p(2*a/(1-a))
return render(math.copysign(result,x))
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 positive', solve(N*2.0**-60), render(N*2.0**-60))
check('tiny negative', solve(-N*2.0**-60), render(-N*2.0**-60))
check('normal', solve(0.125*N), render(math.atanh(0.125*N)))
check('negative normal', solve(-0.125*N), render(math.atanh(-0.125*N)))
check('positive endpoint', solve(1.0), "+infinity")
check('negative endpoint', solve(-1.0), "-infinity")
check('invalid', solve(1.0+N), "domain")
check('negative zero', solve(-0.0), "-0")
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 positive | 8.6736173799e-19 | 8.6736173799e-19 | Passed |
| tiny negative | -8.6736173799e-19 | -8.6736173799e-19 | Passed |
| normal | 0.12565721414 | 0.12565721414 | Passed |
| negative normal | -0.12565721414 | -0.12565721414 | Passed |
| positive endpoint | +infinity | +infinity | Passed |
| negative endpoint | +infinity | -infinity | Failed |
| invalid | domain | domain | Passed |
| negative zero | -0 | -0 | Passed |
SHA-256 / 1702ee63ed88ddefcbda03006a6a43601fa13b641783b7196c5205b34188a075
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 abs(x)>1: return 'domain'
if x==1: return '+infinity'
if x==-1: return 'domain'
if x==0: return render(x)
a=abs(x)
result=0.5*math.log1p(2*a/(1-a))
return render(math.copysign(result,x))
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 positive', solve(N*2.0**-60), render(N*2.0**-60))
check('tiny negative', solve(-N*2.0**-60), render(-N*2.0**-60))
check('normal', solve(0.125*N), render(math.atanh(0.125*N)))
check('negative normal', solve(-0.125*N), render(math.atanh(-0.125*N)))
check('positive endpoint', solve(1.0), "+infinity")
check('negative endpoint', solve(-1.0), "-infinity")
check('invalid', solve(1.0+N), "domain")
check('negative zero', solve(-0.0), "-0")
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 positive | 8.6736173799e-19 | 8.6736173799e-19 | Passed |
| tiny negative | -8.6736173799e-19 | -8.6736173799e-19 | Passed |
| normal | 0.12565721414 | 0.12565721414 | Passed |
| negative normal | -0.12565721414 | -0.12565721414 | Passed |
| positive endpoint | +infinity | +infinity | Passed |
| negative endpoint | domain | -infinity | Failed |
| invalid | domain | domain | Passed |
| negative zero | -0 | -0 | Passed |
SHA-256 / 3a6573a42283adf8c3d1359565cd8fe1fa4d799b4b9eb13de869a89a0f853777
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 abs(x)>1: return 'domain'
if x==1: return '+infinity'
if x==-1: return '-infinity'
if x==0: return render(x)
a=abs(x)
result=0.5*math.log1p(2*a/(1-a))
return render(math.copysign(result,x))
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 positive', solve(N*2.0**-60), render(N*2.0**-60))
check('tiny negative', solve(-N*2.0**-60), render(-N*2.0**-60))
check('normal', solve(0.125*N), render(math.atanh(0.125*N)))
check('negative normal', solve(-0.125*N), render(math.atanh(-0.125*N)))
check('positive endpoint', solve(1.0), "+infinity")
check('negative endpoint', solve(-1.0), "-infinity")
check('invalid', solve(1.0+N), "domain")
check('negative zero', solve(-0.0), "-0")
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 positive | 8.6736173799e-19 | 8.6736173799e-19 | Passed |
| tiny negative | -8.6736173799e-19 | -8.6736173799e-19 | Passed |
| normal | 0.12565721414 | 0.12565721414 | Passed |
| negative normal | -0.12565721414 | -0.12565721414 | Passed |
| positive endpoint | +infinity | +infinity | Passed |
| negative endpoint | -infinity | -infinity | Passed |
| invalid | domain | domain | Passed |
| negative zero | -0 | -0 | Passed |
SHA-256 / a09958c68ceb529aadf5c8ff07b6328951ccdd723403737abd521529a5a576d4
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.176477+00:00.
Case digest / db56f1f99a5e0802d324d4f9c09e2fba855cbe63c04ccb80c5796f283de46957