Average Error: 52.8 → 0.1
Time: 46.1s
Precision: 64
Internal Precision: 2368
\[\log \left(x + \sqrt{x \cdot x + 1}\right)\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.0578922685264147:\\ \;\;\;\;\log \left((\left(\frac{1}{x}\right) \cdot \left((\left(\frac{1}{x}\right) \cdot \left(\frac{\frac{1}{8}}{x}\right) + \left(-\frac{1}{2}\right))_*\right) + \left(\frac{-\frac{1}{16}}{{x}^{5}}\right))_*\right)\\ \mathbf{if}\;x \le 0.00759904585050588:\\ \;\;\;\;\left(\frac{3}{40} \cdot {x}^{5} + x\right) - \frac{1}{6} \cdot {x}^{3}\\ \mathbf{else}:\\ \;\;\;\;\log \left(\sqrt{\sqrt{1^2 + x^2}^* + x}\right) + \frac{1}{2} \cdot \log \left(\sqrt{1^2 + x^2}^* + x\right)\\ \end{array}\]

Error

Bits error versus x

Target

Original52.8
Target45.1
Herbie0.1
\[\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

  1. Split input into 3 regimes
  2. if x < -1.0578922685264147

    1. Initial program 61.9

      \[\log \left(x + \sqrt{x \cdot x + 1}\right)\]
    2. Applied simplify61.1

      \[\leadsto \color{blue}{\log \left(\sqrt{1^2 + x^2}^* + x\right)}\]
    3. Taylor expanded around -inf 0.2

      \[\leadsto \log \color{blue}{\left(\frac{1}{8} \cdot \frac{1}{{x}^{3}} - \left(\frac{1}{16} \cdot \frac{1}{{x}^{5}} + \frac{1}{2} \cdot \frac{1}{x}\right)\right)}\]
    4. Applied simplify0.2

      \[\leadsto \color{blue}{\log \left((\left(\frac{1}{x}\right) \cdot \left((\left(\frac{1}{x}\right) \cdot \left(\frac{\frac{1}{8}}{x}\right) + \left(-\frac{1}{2}\right))_*\right) + \left(\frac{-\frac{1}{16}}{{x}^{5}}\right))_*\right)}\]

    if -1.0578922685264147 < x < 0.00759904585050588

    1. Initial program 58.7

      \[\log \left(x + \sqrt{x \cdot x + 1}\right)\]
    2. Applied simplify58.7

      \[\leadsto \color{blue}{\log \left(\sqrt{1^2 + x^2}^* + x\right)}\]
    3. 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.00759904585050588 < x

    1. Initial program 31.4

      \[\log \left(x + \sqrt{x \cdot x + 1}\right)\]
    2. Applied simplify0.1

      \[\leadsto \color{blue}{\log \left(\sqrt{1^2 + x^2}^* + x\right)}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt0.1

      \[\leadsto \log \color{blue}{\left(\sqrt{\sqrt{1^2 + x^2}^* + x} \cdot \sqrt{\sqrt{1^2 + x^2}^* + x}\right)}\]
    5. Applied log-prod0.1

      \[\leadsto \color{blue}{\log \left(\sqrt{\sqrt{1^2 + x^2}^* + x}\right) + \log \left(\sqrt{\sqrt{1^2 + x^2}^* + x}\right)}\]
    6. Using strategy rm
    7. Applied pow1/20.1

      \[\leadsto \log \left(\sqrt{\sqrt{1^2 + x^2}^* + x}\right) + \log \color{blue}{\left({\left(\sqrt{1^2 + x^2}^* + x\right)}^{\frac{1}{2}}\right)}\]
    8. Applied log-pow0.1

      \[\leadsto \log \left(\sqrt{\sqrt{1^2 + x^2}^* + x}\right) + \color{blue}{\frac{1}{2} \cdot \log \left(\sqrt{1^2 + x^2}^* + x\right)}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 46.1s)Debug logProfile

herbie shell --seed 2018195 +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)))))