Average Error: 38.4 → 0.6
Time: 10.1s
Precision: 64
$\log \left(x + 1\right)$
$\begin{array}{l} \mathbf{if}\;x + 1 \le 1.000000000000006439293542825907934457064:\\ \;\;\;\;\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\log \left(x + 1\right)\\ \end{array}$
\log \left(x + 1\right)
\begin{array}{l}
\mathbf{if}\;x + 1 \le 1.000000000000006439293542825907934457064:\\
\;\;\;\;\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\\

\mathbf{else}:\\
\;\;\;\;\log \left(x + 1\right)\\

\end{array}
double f(double x) {
double r1084141 = x;
double r1084142 = 1.0;
double r1084143 = r1084141 + r1084142;
double r1084144 = log(r1084143);
return r1084144;
}


double f(double x) {
double r1084145 = x;
double r1084146 = 1.0;
double r1084147 = r1084145 + r1084146;
double r1084148 = 1.0000000000000064;
bool r1084149 = r1084147 <= r1084148;
double r1084150 = r1084146 * r1084145;
double r1084151 = log(r1084146);
double r1084152 = r1084150 + r1084151;
double r1084153 = 0.5;
double r1084154 = 2.0;
double r1084155 = pow(r1084145, r1084154);
double r1084156 = pow(r1084146, r1084154);
double r1084157 = r1084155 / r1084156;
double r1084158 = r1084153 * r1084157;
double r1084159 = r1084152 - r1084158;
double r1084160 = log(r1084147);
double r1084161 = r1084149 ? r1084159 : r1084160;
return r1084161;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if (+ x 1.0) < 1.0000000000000064

1. Initial program 59.4

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

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

## if 1.0000000000000064 < (+ x 1.0)

1. Initial program 0.9

$\log \left(x + 1\right)$
3. Recombined 2 regimes into one program.
4. Final simplification0.6

$\leadsto \begin{array}{l} \mathbf{if}\;x + 1 \le 1.000000000000006439293542825907934457064:\\ \;\;\;\;\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\log \left(x + 1\right)\\ \end{array}$

# Reproduce

herbie shell --seed 1
(FPCore (x)
:name "log(x+1)"
:precision binary64
(log (+ x 1)))