\log \left(x + \sqrt{x \cdot x + 1}\right)\begin{array}{l}
\mathbf{if}\;x \leq -1.345236605992239 \cdot 10^{+154}:\\
\;\;\;\;\log \left(\frac{-1}{x}\right)\\
\mathbf{elif}\;x \leq -3.43856601333689 \cdot 10^{-08}:\\
\;\;\;\;\log \left(\frac{-1}{x - \sqrt{x \cdot x + 1}}\right)\\
\mathbf{elif}\;x \leq 1.345072362821146 \cdot 10^{+154}:\\
\;\;\;\;\log \left(x + \left|\sqrt[3]{x \cdot x + 1}\right| \cdot \sqrt{\sqrt[3]{x \cdot x + 1}}\right)\\
\mathbf{else}:\\
\;\;\;\;\log x\\
\end{array}(FPCore (x) :precision binary64 (log (+ x (sqrt (+ (* x x) 1.0)))))
(FPCore (x)
:precision binary64
(if (<= x -1.345236605992239e+154)
(log (/ -1.0 x))
(if (<= x -3.43856601333689e-08)
(log (/ -1.0 (- x (sqrt (+ (* x x) 1.0)))))
(if (<= x 1.345072362821146e+154)
(log
(+ x (* (fabs (cbrt (+ (* x x) 1.0))) (sqrt (cbrt (+ (* x x) 1.0))))))
(log x)))))double code(double x) {
return log(x + sqrt((x * x) + 1.0));
}
double code(double x) {
double tmp;
if (x <= -1.345236605992239e+154) {
tmp = log(-1.0 / x);
} else if (x <= -3.43856601333689e-08) {
tmp = log(-1.0 / (x - sqrt((x * x) + 1.0)));
} else if (x <= 1.345072362821146e+154) {
tmp = log(x + (fabs(cbrt((x * x) + 1.0)) * sqrt(cbrt((x * x) + 1.0))));
} else {
tmp = log(x);
}
return tmp;
}




Bits error versus x
Results
| Original | 53.4 |
|---|---|
| Target | 45.6 |
| Herbie | 40.2 |
if x < -1.345236605992239e154Initial program 64.0
rmApplied flip-+_binary6464.0
Simplified64.0
Taylor expanded around 0 42.9
if -1.345236605992239e154 < x < -3.43856601333689028e-8Initial program 59.0
rmApplied flip-+_binary6458.5
Simplified0.6
if -3.43856601333689028e-8 < x < 1.3450723628211461e154Initial program 47.8
rmApplied add-cube-cbrt_binary6447.8
Applied sqrt-prod_binary6447.8
Simplified47.8
if 1.3450723628211461e154 < x Initial program 64.0
Taylor expanded around 0 42.9
Final simplification40.2
herbie shell --seed 2020288
(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)))))