Average Error: 19.2 → 0.4
Time: 13.0s
Precision: 64
$x \cdot \log \left(x + 1\right)$
$\begin{array}{l} \mathbf{if}\;x \cdot \log \left(x + 1\right) \le 6.00970367779055429227083607288833684516 \cdot 10^{-19}:\\ \;\;\;\;x \cdot \left(\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot \log \left(x + 1\right)\\ \end{array}$
x \cdot \log \left(x + 1\right)
\begin{array}{l}
\mathbf{if}\;x \cdot \log \left(x + 1\right) \le 6.00970367779055429227083607288833684516 \cdot 10^{-19}:\\
\;\;\;\;x \cdot \left(\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\\

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

\end{array}
double f(double x) {
double r645803 = x;
double r645804 = 1.0;
double r645805 = r645803 + r645804;
double r645806 = log(r645805);
double r645807 = r645803 * r645806;
return r645807;
}


double f(double x) {
double r645808 = x;
double r645809 = 1.0;
double r645810 = r645808 + r645809;
double r645811 = log(r645810);
double r645812 = r645808 * r645811;
double r645813 = 6.009703677790554e-19;
bool r645814 = r645812 <= r645813;
double r645815 = r645809 * r645808;
double r645816 = log(r645809);
double r645817 = r645815 + r645816;
double r645818 = 0.5;
double r645819 = 2.0;
double r645820 = pow(r645808, r645819);
double r645821 = pow(r645809, r645819);
double r645822 = r645820 / r645821;
double r645823 = r645818 * r645822;
double r645824 = r645817 - r645823;
double r645825 = r645808 * r645824;
double r645826 = r645814 ? r645825 : r645812;
return r645826;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if (* x (log (+ x 1.0))) < 6.009703677790554e-19

1. Initial program 29.6

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

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

## if 6.009703677790554e-19 < (* x (log (+ x 1.0)))

1. Initial program 1.1

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

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

# Reproduce

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