Average Error: 52.7 → 0.2
Time: 36.3s
Precision: 64
Internal Precision: 2432
\[\log \left(x + \sqrt{x \cdot x + 1}\right)\]
↓
\[\begin{array}{l}
\mathbf{if}\;x \le -1.1475234879609486:\\
\;\;\;\;\log \left(\frac{\frac{\frac{1}{8}}{x}}{x \cdot x} - \frac{\frac{1}{2}}{x}\right)\\
\mathbf{if}\;x \le 0.008550673838983983:\\
\;\;\;\;\left(\frac{3}{40} \cdot {x}^{5} + x\right) - \frac{1}{6} \cdot {x}^{3}\\
\mathbf{else}:\\
\;\;\;\;\log \left(\left(\sqrt[3]{\sqrt{1^2 + x^2}^*} \cdot \sqrt[3]{\sqrt{1^2 + x^2}^*}\right) \cdot \sqrt[3]{\sqrt{1^2 + x^2}^*} + x\right)\\
\end{array}\]
Target
| Original | 52.7 |
|---|
| Target | 45.0 |
|---|
| Herbie | 0.2 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \lt 0:\\
\;\;\;\;\log \left(\frac{-1}{x - \sqrt{x \cdot x + 1}}\right)\\
\mathbf{else}:\\
\;\;\;\;\log \left(x + \sqrt{x \cdot x + 1}\right)\\
\end{array}\]
Derivation
- Split input into 3 regimes
if x < -1.1475234879609486
Initial program 61.6
\[\log \left(x + \sqrt{x \cdot x + 1}\right)\]
Applied simplify60.8
\[\leadsto \color{blue}{\log \left(\sqrt{1^2 + x^2}^* + x\right)}\]
Taylor expanded around -inf 61.1
\[\leadsto \log \left(\color{blue}{\left(\frac{1}{8} \cdot \frac{1}{{x}^{3}} - \left(\frac{1}{2} \cdot \frac{1}{x} + x\right)\right)} + x\right)\]
Applied simplify0.3
\[\leadsto \color{blue}{\log \left(\frac{\frac{\frac{1}{8}}{x}}{x \cdot x} - \frac{\frac{1}{2}}{x}\right)}\]
if -1.1475234879609486 < x < 0.008550673838983983
Initial program 59.0
\[\log \left(x + \sqrt{x \cdot x + 1}\right)\]
Applied simplify59.0
\[\leadsto \color{blue}{\log \left(\sqrt{1^2 + x^2}^* + x\right)}\]
Taylor expanded around 0 0.1
\[\leadsto \color{blue}{\left(\frac{3}{40} \cdot {x}^{5} + x\right) - \frac{1}{6} \cdot {x}^{3}}\]
if 0.008550673838983983 < x
Initial program 31.8
\[\log \left(x + \sqrt{x \cdot x + 1}\right)\]
Applied simplify0.2
\[\leadsto \color{blue}{\log \left(\sqrt{1^2 + x^2}^* + x\right)}\]
- Using strategy
rm Applied add-cube-cbrt0.2
\[\leadsto \log \left(\color{blue}{\left(\sqrt[3]{\sqrt{1^2 + x^2}^*} \cdot \sqrt[3]{\sqrt{1^2 + x^2}^*}\right) \cdot \sqrt[3]{\sqrt{1^2 + x^2}^*}} + x\right)\]
- Recombined 3 regimes into one program.
Runtime
herbie shell --seed '#(1070386091 2509006183 1430610344 1025408621 36622005 1425925650)' +o rules:numerics
(FPCore (x)
:name "Hyperbolic arcsine"
:herbie-target
(if (< x 0) (log (/ -1 (- x (sqrt (+ (* x x) 1))))) (log (+ x (sqrt (+ (* x x) 1)))))
(log (+ x (sqrt (+ (* x x) 1)))))