\log \left(x + \sqrt{x \cdot x + 1}\right)\begin{array}{l}
\mathbf{if}\;x \leq -1.3376046051696085 \cdot 10^{+154}:\\
\;\;\;\;\log \left(\frac{-1}{x}\right)\\
\mathbf{elif}\;x \leq -7.433249191736301 \cdot 10^{-06}:\\
\;\;\;\;\log \left(\frac{-1}{x - \sqrt{x \cdot x + 1}}\right)\\
\mathbf{elif}\;x \leq 1.119329551643299 \cdot 10^{-05}:\\
\;\;\;\;x + \log 1\\
\mathbf{elif}\;x \leq 1.3218907971973426 \cdot 10^{+154}:\\
\;\;\;\;\log \left(x + \sqrt{\sqrt{x \cdot x + 1}} \cdot \sqrt{\sqrt{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.3376046051696085e+154)
(log (/ -1.0 x))
(if (<= x -7.433249191736301e-06)
(log (/ -1.0 (- x (sqrt (+ (* x x) 1.0)))))
(if (<= x 1.119329551643299e-05)
(+ x (log 1.0))
(if (<= x 1.3218907971973426e+154)
(log
(+
x
(* (sqrt (sqrt (+ (* x x) 1.0))) (sqrt (sqrt (+ (* 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.3376046051696085e+154) {
tmp = log(-1.0 / x);
} else if (x <= -7.433249191736301e-06) {
tmp = log(-1.0 / (x - sqrt((x * x) + 1.0)));
} else if (x <= 1.119329551643299e-05) {
tmp = x + log(1.0);
} else if (x <= 1.3218907971973426e+154) {
tmp = log(x + (sqrt(sqrt((x * x) + 1.0)) * sqrt(sqrt((x * x) + 1.0))));
} else {
tmp = log(x);
}
return tmp;
}




Bits error versus x
Results
| Original | 53.4 |
|---|---|
| Target | 45.4 |
| Herbie | 11.1 |
if x < -1.3376046051696085e154Initial program 64.0
rmApplied flip-+_binary6464.0
Simplified64.0
Taylor expanded around inf 42.9
if -1.3376046051696085e154 < x < -7.43324919173630083e-6Initial program 60.3
rmApplied flip-+_binary6459.8
Simplified0.2
if -7.43324919173630083e-6 < x < 1.11932955164329908e-5Initial program 59.6
Taylor expanded around 0 0.1
Simplified0.1
if 1.11932955164329908e-5 < x < 1.3218907971973426e154Initial program 0.2
rmApplied add-sqr-sqrt_binary640.3
if 1.3218907971973426e154 < x Initial program 64.0
Taylor expanded around inf 42.9
Final simplification11.1
herbie shell --seed 2020277
(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)))))