Average Error: 39.0 → 0.2
Time: 21.9s
Precision: 64
Internal Precision: 1344
\[\log \left(x + 1\right)\]
\[\begin{array}{l} \mathbf{if}\;\log \left(x + 1\right) \le 1.2187380587550111 \cdot 10^{-06}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(\frac{1}{3} \cdot x - \frac{1}{2}\right) + x\\ \mathbf{else}:\\ \;\;\;\;\log \left(\sqrt{x + 1}\right) + \log \left(\sqrt{x + 1}\right)\\ \end{array}\]

Error

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 (log (+ x 1)) < 1.2187380587550111e-06

    1. Initial program 58.9

      \[\log \left(x + 1\right)\]
    2. Taylor expanded around 0 0.2

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

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

    if 1.2187380587550111e-06 < (log (+ x 1))

    1. Initial program 0.1

      \[\log \left(x + 1\right)\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt0.2

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

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

Runtime

Time bar (total: 21.9s)Debug log

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