Average Error: 15.7 → 0.5
Time: 16.3s
Precision: 64
$\log x - \log \left(x + \frac{1}{x}\right)$
$\begin{array}{l} \mathbf{if}\;x \le 68.44198867238041827931738225743174552917:\\ \;\;\;\;\log x - \log \left(x + \frac{1}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{0.5}{{x}^{4}} - \frac{1}{x \cdot x}\right) - \frac{0.3333333333333333148296162562473909929395}{{x}^{6}}\\ \end{array}$
\log x - \log \left(x + \frac{1}{x}\right)
\begin{array}{l}
\mathbf{if}\;x \le 68.44198867238041827931738225743174552917:\\
\;\;\;\;\log x - \log \left(x + \frac{1}{x}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{0.5}{{x}^{4}} - \frac{1}{x \cdot x}\right) - \frac{0.3333333333333333148296162562473909929395}{{x}^{6}}\\

\end{array}
double f(double x) {
double r1711591 = x;
double r1711592 = log(r1711591);
double r1711593 = 1.0;
double r1711594 = r1711593 / r1711591;
double r1711595 = r1711591 + r1711594;
double r1711596 = log(r1711595);
double r1711597 = r1711592 - r1711596;
return r1711597;
}


double f(double x) {
double r1711598 = x;
double r1711599 = 68.44198867238042;
bool r1711600 = r1711598 <= r1711599;
double r1711601 = log(r1711598);
double r1711602 = 1.0;
double r1711603 = r1711602 / r1711598;
double r1711604 = r1711598 + r1711603;
double r1711605 = log(r1711604);
double r1711606 = r1711601 - r1711605;
double r1711607 = 0.5;
double r1711608 = 4.0;
double r1711609 = pow(r1711598, r1711608);
double r1711610 = r1711607 / r1711609;
double r1711611 = r1711598 * r1711598;
double r1711612 = r1711602 / r1711611;
double r1711613 = r1711610 - r1711612;
double r1711614 = 0.3333333333333333;
double r1711615 = 6.0;
double r1711616 = pow(r1711598, r1711615);
double r1711617 = r1711614 / r1711616;
double r1711618 = r1711613 - r1711617;
double r1711619 = r1711600 ? r1711606 : r1711618;
return r1711619;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if x < 68.44198867238042

1. Initial program 0.1

$\log x - \log \left(x + \frac{1}{x}\right)$
2. Using strategy rm

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

$\leadsto \color{blue}{\left(\log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) + \log \left(\sqrt[3]{x}\right)\right)} - \log \left(x + \frac{1}{x}\right)$
5. Applied associate--l+0.3

$\leadsto \color{blue}{\log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) + \left(\log \left(\sqrt[3]{x}\right) - \log \left(x + \frac{1}{x}\right)\right)}$
6. Using strategy rm
7. Applied associate-+r-0.3

$\leadsto \color{blue}{\left(\log \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) + \log \left(\sqrt[3]{x}\right)\right) - \log \left(x + \frac{1}{x}\right)}$
8. Simplified0.1

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

## if 68.44198867238042 < x

1. Initial program 31.0

$\log x - \log \left(x + \frac{1}{x}\right)$
2. Taylor expanded around inf 1.0

$\leadsto \color{blue}{0.5 \cdot \frac{1}{{x}^{4}} - \left(1 \cdot \frac{1}{{x}^{2}} + 0.3333333333333333148296162562473909929395 \cdot \frac{1}{{x}^{6}}\right)}$
3. Simplified1.0

$\leadsto \color{blue}{\left(\frac{0.5}{{x}^{4}} - \frac{1}{x \cdot x}\right) - \frac{0.3333333333333333148296162562473909929395}{{x}^{6}}}$
3. Recombined 2 regimes into one program.
4. Final simplification0.5

$\leadsto \begin{array}{l} \mathbf{if}\;x \le 68.44198867238041827931738225743174552917:\\ \;\;\;\;\log x - \log \left(x + \frac{1}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{0.5}{{x}^{4}} - \frac{1}{x \cdot x}\right) - \frac{0.3333333333333333148296162562473909929395}{{x}^{6}}\\ \end{array}$

# Reproduce

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