\log \left(x + \sqrt{x \cdot x + 1}\right)
\begin{array}{l}
\mathbf{if}\;x \leq -8058.760018329849:\\
\;\;\;\;\log \left(\frac{-0.5}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{fma}\left(1, x, \mathsf{hypot}\left(1, x\right) + -1\right)\right)\\
\end{array}
(FPCore (x) :precision binary64 (log (+ x (sqrt (+ (* x x) 1.0)))))
(FPCore (x) :precision binary64 (if (<= x -8058.760018329849) (log (/ -0.5 x)) (log1p (fma 1.0 x (+ (hypot 1.0 x) -1.0)))))
double code(double x) {
return log((x + sqrt(((x * x) + 1.0))));
}
double code(double x) {
double tmp;
if (x <= -8058.760018329849) {
tmp = log((-0.5 / x));
} else {
tmp = log1p(fma(1.0, x, (hypot(1.0, x) + -1.0)));
}
return tmp;
}




Bits error versus x
| Original | 53.0 |
|---|---|
| Target | 44.9 |
| Herbie | 0.4 |
if x < -8058.7600183298491Initial program 63.6
Simplified63.6
Taylor expanded in x around -inf 0.1
if -8058.7600183298491 < x Initial program 49.4
Simplified38.9
Applied egg-rr38.9
Applied egg-rr0.4
Final simplification0.4
herbie shell --seed 2022130
(FPCore (x)
:name "Hyperbolic arcsine"
:precision binary64
:herbie-target
(if (< x 0.0) (log (/ -1.0 (- x (sqrt (+ (* x x) 1.0))))) (log (+ x (sqrt (+ (* x x) 1.0)))))
(log (+ x (sqrt (+ (* x x) 1.0)))))