Average Error: 52.2 → 0.2
Time: 15.5s
Precision: 64
Internal Precision: 2368
\[\log \left(x + \sqrt{x \cdot x + 1}\right)\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.037471742873375:\\ \;\;\;\;\left(\frac{\frac{3}{32}}{{x}^{4}} + \log \frac{1}{2}\right) + \left(\log \left(\frac{-1}{x}\right) - \frac{\frac{1}{4}}{x \cdot x}\right)\\ \mathbf{elif}\;x \le 0.007521848352309558:\\ \;\;\;\;\left({x}^{5} \cdot \frac{3}{40} + x\right) - {x}^{3} \cdot \frac{1}{6}\\ \mathbf{else}:\\ \;\;\;\;\log \left(\sqrt{1^2 + x^2}^* + x\right)\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original52.2
Target44.7
Herbie0.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

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

    1. Initial program 61.8

      \[\log \left(x + \sqrt{x \cdot x + 1}\right)\]
    2. Initial simplification61.0

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

      \[\leadsto \color{blue}{\left(\log \left(\frac{-1}{x}\right) + \left(\log \frac{1}{2} + \frac{3}{32} \cdot \frac{1}{{x}^{4}}\right)\right) - \frac{1}{4} \cdot \frac{1}{{x}^{2}}}\]
    4. Simplified0.4

      \[\leadsto \color{blue}{\left(\log \frac{1}{2} + \frac{\frac{3}{32}}{{x}^{4}}\right) + \left(\log \left(\frac{-1}{x}\right) - \frac{\frac{1}{4}}{x \cdot x}\right)}\]

    if -1.037471742873375 < x < 0.007521848352309558

    1. Initial program 58.9

      \[\log \left(x + \sqrt{x \cdot x + 1}\right)\]
    2. Initial simplification58.9

      \[\leadsto \log \left(x + \sqrt{1^2 + x^2}^*\right)\]
    3. Taylor expanded around 0 0.1

      \[\leadsto \color{blue}{\left(x + \frac{3}{40} \cdot {x}^{5}\right) - \frac{1}{6} \cdot {x}^{3}}\]

    if 0.007521848352309558 < x

    1. Initial program 30.6

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

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

      \[\leadsto \log \left(x + \color{blue}{\sqrt{\sqrt{1^2 + x^2}^*} \cdot \sqrt{\sqrt{1^2 + x^2}^*}}\right)\]
    5. Using strategy rm
    6. Applied rem-square-sqrt0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.037471742873375:\\ \;\;\;\;\left(\frac{\frac{3}{32}}{{x}^{4}} + \log \frac{1}{2}\right) + \left(\log \left(\frac{-1}{x}\right) - \frac{\frac{1}{4}}{x \cdot x}\right)\\ \mathbf{elif}\;x \le 0.007521848352309558:\\ \;\;\;\;\left({x}^{5} \cdot \frac{3}{40} + x\right) - {x}^{3} \cdot \frac{1}{6}\\ \mathbf{else}:\\ \;\;\;\;\log \left(\sqrt{1^2 + x^2}^* + x\right)\\ \end{array}\]

Runtime

Time bar (total: 15.5s)Debug logProfile

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