Average Error: 30.0 → 0.1
Time: 12.0s
Precision: 64
\[\log \left(x + 1\right) - \log x\]
\[\begin{array}{l} \mathbf{if}\;x \le 7469.148274187928:\\ \;\;\;\;\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{-1}{2}}{x \cdot x} + \frac{1}{x}\right) + \frac{\frac{\frac{1}{3}}{x}}{x \cdot x}\\ \end{array}\]
\log \left(x + 1\right) - \log x
\begin{array}{l}
\mathbf{if}\;x \le 7469.148274187928:\\
\;\;\;\;\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{-1}{2}}{x \cdot x} + \frac{1}{x}\right) + \frac{\frac{\frac{1}{3}}{x}}{x \cdot x}\\

\end{array}
double f(double x) {
        double r4690927 = x;
        double r4690928 = 1.0;
        double r4690929 = r4690927 + r4690928;
        double r4690930 = log(r4690929);
        double r4690931 = log(r4690927);
        double r4690932 = r4690930 - r4690931;
        return r4690932;
}

double f(double x) {
        double r4690933 = x;
        double r4690934 = 7469.148274187928;
        bool r4690935 = r4690933 <= r4690934;
        double r4690936 = 1.0;
        double r4690937 = r4690936 + r4690933;
        double r4690938 = cbrt(r4690937);
        double r4690939 = sqrt(r4690933);
        double r4690940 = r4690938 / r4690939;
        double r4690941 = r4690938 * r4690938;
        double r4690942 = r4690941 / r4690939;
        double r4690943 = r4690940 * r4690942;
        double r4690944 = log(r4690943);
        double r4690945 = -0.5;
        double r4690946 = r4690933 * r4690933;
        double r4690947 = r4690945 / r4690946;
        double r4690948 = r4690936 / r4690933;
        double r4690949 = r4690947 + r4690948;
        double r4690950 = 0.3333333333333333;
        double r4690951 = r4690950 / r4690933;
        double r4690952 = r4690951 / r4690946;
        double r4690953 = r4690949 + r4690952;
        double r4690954 = r4690935 ? r4690944 : r4690953;
        return r4690954;
}

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(x + 1\right) - \log x\]
    2. Using strategy rm
    3. Applied add-log-exp0.1

      \[\leadsto \color{blue}{\log \left(e^{\log \left(x + 1\right) - \log x}\right)}\]
    4. Simplified0.1

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

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

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

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

    if 7469.148274187928 < x

    1. Initial program 59.6

      \[\log \left(x + 1\right) - \log x\]
    2. Using strategy rm
    3. Applied add-log-exp59.6

      \[\leadsto \color{blue}{\log \left(e^{\log \left(x + 1\right) - \log x}\right)}\]
    4. Simplified59.3

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 7469.148274187928:\\ \;\;\;\;\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{-1}{2}}{x \cdot x} + \frac{1}{x}\right) + \frac{\frac{\frac{1}{3}}{x}}{x \cdot x}\\ \end{array}\]

Reproduce

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