Average Error: 30.0 → 0.1
Time: 8.9s
Precision: 64
\[\log \left(1 + x\right) - \log x\]
\[\begin{array}{l} \mathbf{if}\;x \le 7469.148274187928109313361346721649169922:\\ \;\;\;\;\log \left(\frac{\sqrt[3]{1 + x}}{\sqrt{x}} \cdot \frac{\sqrt[3]{1 + x} \cdot \sqrt[3]{1 + x}}{\sqrt{x}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\frac{0.3333333333333333148296162562473909929395}{x}}{x \cdot x} - \frac{0.5}{x \cdot x}\right) + \frac{1}{x}\\ \end{array}\]
\log \left(1 + x\right) - \log x
\begin{array}{l}
\mathbf{if}\;x \le 7469.148274187928109313361346721649169922:\\
\;\;\;\;\log \left(\frac{\sqrt[3]{1 + x}}{\sqrt{x}} \cdot \frac{\sqrt[3]{1 + x} \cdot \sqrt[3]{1 + x}}{\sqrt{x}}\right)\\

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

\end{array}
double f(double x) {
        double r25896968 = 1.0;
        double r25896969 = x;
        double r25896970 = r25896968 + r25896969;
        double r25896971 = log(r25896970);
        double r25896972 = log(r25896969);
        double r25896973 = r25896971 - r25896972;
        return r25896973;
}

double f(double x) {
        double r25896974 = x;
        double r25896975 = 7469.148274187928;
        bool r25896976 = r25896974 <= r25896975;
        double r25896977 = 1.0;
        double r25896978 = r25896977 + r25896974;
        double r25896979 = cbrt(r25896978);
        double r25896980 = sqrt(r25896974);
        double r25896981 = r25896979 / r25896980;
        double r25896982 = r25896979 * r25896979;
        double r25896983 = r25896982 / r25896980;
        double r25896984 = r25896981 * r25896983;
        double r25896985 = log(r25896984);
        double r25896986 = 0.3333333333333333;
        double r25896987 = r25896986 / r25896974;
        double r25896988 = r25896974 * r25896974;
        double r25896989 = r25896987 / r25896988;
        double r25896990 = 0.5;
        double r25896991 = r25896990 / r25896988;
        double r25896992 = r25896989 - r25896991;
        double r25896993 = r25896977 / r25896974;
        double r25896994 = r25896992 + r25896993;
        double r25896995 = r25896976 ? r25896985 : r25896994;
        return r25896995;
}

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 x < 7469.148274187928

    1. Initial program 0.1

      \[\log \left(1 + x\right) - \log x\]
    2. Using strategy rm
    3. Applied diff-log0.1

      \[\leadsto \color{blue}{\log \left(\frac{1 + x}{x}\right)}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt0.1

      \[\leadsto \log \left(\frac{1 + x}{\color{blue}{\sqrt{x} \cdot \sqrt{x}}}\right)\]
    6. Applied add-cube-cbrt0.1

      \[\leadsto \log \left(\frac{\color{blue}{\left(\sqrt[3]{1 + x} \cdot \sqrt[3]{1 + x}\right) \cdot \sqrt[3]{1 + x}}}{\sqrt{x} \cdot \sqrt{x}}\right)\]
    7. Applied times-frac0.1

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

    if 7469.148274187928 < x

    1. Initial program 59.6

      \[\log \left(1 + x\right) - \log x\]
    2. Using strategy rm
    3. Applied diff-log59.3

      \[\leadsto \color{blue}{\log \left(\frac{1 + x}{x}\right)}\]
    4. Taylor expanded around inf 0.0

      \[\leadsto \color{blue}{\left(0.3333333333333333148296162562473909929395 \cdot \frac{1}{{x}^{3}} + 1 \cdot \frac{1}{x}\right) - 0.5 \cdot \frac{1}{{x}^{2}}}\]
    5. Simplified0.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 7469.148274187928109313361346721649169922:\\ \;\;\;\;\log \left(\frac{\sqrt[3]{1 + x}}{\sqrt{x}} \cdot \frac{\sqrt[3]{1 + x} \cdot \sqrt[3]{1 + x}}{\sqrt{x}}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{\frac{0.3333333333333333148296162562473909929395}{x}}{x \cdot x} - \frac{0.5}{x \cdot x}\right) + \frac{1}{x}\\ \end{array}\]

Reproduce

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