Average Error: 7.5 → 0.1
Time: 15.6s
Precision: 64
Internal Precision: 576
\[a + \log \left(\frac{x}{1 + a}\right)\]
\[\begin{array}{l} \mathbf{if}\;x \le -3.61649337106027 \cdot 10^{-310}:\\ \;\;\;\;\left(\left(\frac{\frac{\frac{1}{2}}{a}}{a} - \log \left(\frac{-1}{x}\right)\right) - \left(\frac{1}{a} - \log \left(\frac{-1}{a}\right)\right)\right) + a\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\log x - \log \left(\sqrt{a + 1}\right)\right) - \log \left(\sqrt{a + 1}\right)\right) + a\\ \end{array}\]

Error

Bits error versus a

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -3.61649337106027e-310

    1. Initial program 14.3

      \[a + \log \left(\frac{x}{1 + a}\right)\]
    2. Using strategy rm
    3. Applied log-div63.8

      \[\leadsto a + \color{blue}{\left(\log x - \log \left(1 + a\right)\right)}\]
    4. Taylor expanded around -inf 0.2

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

      \[\leadsto a + \color{blue}{\left(\left(\frac{\frac{\frac{1}{2}}{a}}{a} - \log \left(\frac{-1}{x}\right)\right) - \left(\frac{1}{a} - \log \left(\frac{-1}{a}\right)\right)\right)}\]

    if -3.61649337106027e-310 < x

    1. Initial program 5.1

      \[a + \log \left(\frac{x}{1 + a}\right)\]
    2. Using strategy rm
    3. Applied log-div0.0

      \[\leadsto a + \color{blue}{\left(\log x - \log \left(1 + a\right)\right)}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt0.0

      \[\leadsto a + \left(\log x - \log \color{blue}{\left(\sqrt{1 + a} \cdot \sqrt{1 + a}\right)}\right)\]
    6. Applied log-prod0.0

      \[\leadsto a + \left(\log x - \color{blue}{\left(\log \left(\sqrt{1 + a}\right) + \log \left(\sqrt{1 + a}\right)\right)}\right)\]
    7. Applied associate--r+0.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -3.61649337106027 \cdot 10^{-310}:\\ \;\;\;\;\left(\left(\frac{\frac{\frac{1}{2}}{a}}{a} - \log \left(\frac{-1}{x}\right)\right) - \left(\frac{1}{a} - \log \left(\frac{-1}{a}\right)\right)\right) + a\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\log x - \log \left(\sqrt{a + 1}\right)\right) - \log \left(\sqrt{a + 1}\right)\right) + a\\ \end{array}\]

Runtime

Time bar (total: 15.6s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (a x)
  :name "a+log(x/(1+a))"
  (+ a (log (/ x (+ 1 a)))))