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

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if (log (+ 1 x)) < 1.2187380587550111e-06

1. Initial program 58.9

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

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

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

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

1. Initial program 0.1

$\log \left(1 + x\right)$
2. Using strategy rm

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

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

# Runtime

Time bar (total: 23.5s)Debug log

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