FA-16231 / Floating-point arithmetic / Open access
Inverse sine uses a cancellation-prone logarithm for tiny inputs · case 01
Inverse sine uses a cancellation-prone logarithm for tiny inputs.
ROOT CAUSE
Inverse sine uses a cancellation-prone logarithm for tiny inputs. The faulty expression is if a<1e-8: return render(math.log(x+math.sqrt(1+x*x))).
THE FAILURE
Inverse sine uses a cancellation-prone logarithm for tiny inputs. The faulty expression is if a<1e-8: return render(math.log(x+math.sqrt(1+x*x))).
Unsuccessful approach: The attempted local correction if a<1e-8: return "0" still violates the explicit regression fixtures.
Case contract
Evaluate inverse hyperbolic sine for finite binary64 values with tiny-value preservation and a large-value logarithmic branch. 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:
a=abs(x)
if a<1e-8: return render(math.log(x+math.sqrt(1+x*x)))
if a>1e150:
result=math.log(a)+math.log(2)
else:
result=math.log1p(a+a*a/(1+math.sqrt(1+a*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', solve(N*2.0**-60), render(N*2.0**-60))
check('negative tiny', solve(-N*2.0**-60), render(-N*2.0**-60))
check('large', solve(N*1e300), render(math.asinh(N*1e300)))
check('negative large', solve(-N*1e300), render(math.asinh(-N*1e300)))
check('normal', solve(float(N)), render(math.asinh(N)))
check('negative normal', solve(-float(N)), render(math.asinh(-N)))
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 | 0 | 8.6736173799e-19 | Failed |
| negative tiny | 0 | -8.6736173799e-19 | Failed |
| large | 691.46867508 | 691.46867508 | Passed |
| negative large | -691.46867508 | -691.46867508 | Passed |
| normal | 0.88137358702 | 0.88137358702 | Passed |
| negative normal | -0.88137358702 | -0.88137358702 | Passed |
| negative zero | 0 | -0 | Failed |
SHA-256 / 08c7b161a1b2c88c125ce1a879e61aeaecebccd61842c17a7ff1183a9b98733f
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:
a=abs(x)
if a<1e-8: return "0"
if a>1e150:
result=math.log(a)+math.log(2)
else:
result=math.log1p(a+a*a/(1+math.sqrt(1+a*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', solve(N*2.0**-60), render(N*2.0**-60))
check('negative tiny', solve(-N*2.0**-60), render(-N*2.0**-60))
check('large', solve(N*1e300), render(math.asinh(N*1e300)))
check('negative large', solve(-N*1e300), render(math.asinh(-N*1e300)))
check('normal', solve(float(N)), render(math.asinh(N)))
check('negative normal', solve(-float(N)), render(math.asinh(-N)))
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 | 0 | 8.6736173799e-19 | Failed |
| negative tiny | 0 | -8.6736173799e-19 | Failed |
| large | 691.46867508 | 691.46867508 | Passed |
| negative large | -691.46867508 | -691.46867508 | Passed |
| normal | 0.88137358702 | 0.88137358702 | Passed |
| negative normal | -0.88137358702 | -0.88137358702 | Passed |
| negative zero | 0 | -0 | Failed |
SHA-256 / 66932e9669ce4d685524d026572b63c3c1a2986095a8bc3c2dde56127ab01048
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:34.705045+00:00.
Case digest / 7a1619c284a63f3160153308e88ed3a1b1a8585008be7e84222636f5c083f53b