Average Error: 61.2 → 0.4
Time: 9.3s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\log \left(e^{\frac{1}{\frac{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}}\right)\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\log \left(e^{\frac{1}{\frac{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}}\right)
double f(double x) {
        double r91031 = 1.0;
        double r91032 = x;
        double r91033 = r91031 - r91032;
        double r91034 = log(r91033);
        double r91035 = r91031 + r91032;
        double r91036 = log(r91035);
        double r91037 = r91034 / r91036;
        return r91037;
}

double f(double x) {
        double r91038 = 1.0;
        double r91039 = 1.0;
        double r91040 = x;
        double r91041 = r91039 * r91040;
        double r91042 = log(r91039);
        double r91043 = r91041 + r91042;
        double r91044 = 0.5;
        double r91045 = 2.0;
        double r91046 = pow(r91040, r91045);
        double r91047 = pow(r91039, r91045);
        double r91048 = r91046 / r91047;
        double r91049 = r91044 * r91048;
        double r91050 = r91043 - r91049;
        double r91051 = r91041 + r91049;
        double r91052 = r91042 - r91051;
        double r91053 = r91050 / r91052;
        double r91054 = r91038 / r91053;
        double r91055 = exp(r91054);
        double r91056 = log(r91055);
        return r91056;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.2
Target0.3
Herbie0.4
\[-\left(\left(\left(1 + x\right) + \frac{x \cdot x}{2}\right) + 0.416666666666666685 \cdot {x}^{3}\right)\]

Derivation

  1. Initial program 61.2

    \[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
  2. Taylor expanded around 0 60.4

    \[\leadsto \frac{\log \left(1 - x\right)}{\color{blue}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}}\]
  3. Taylor expanded around 0 0.4

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

    \[\leadsto \color{blue}{\log \left(e^{\frac{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}}\right)}\]
  6. Using strategy rm
  7. Applied clear-num0.4

    \[\leadsto \log \left(e^{\color{blue}{\frac{1}{\frac{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}}}\right)\]
  8. Final simplification0.4

    \[\leadsto \log \left(e^{\frac{1}{\frac{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}}\right)\]

Reproduce

herbie shell --seed 2020049 
(FPCore (x)
  :name "qlog (example 3.10)"
  :precision binary64
  :pre (and (< -1 x) (< x 1))

  :herbie-target
  (- (+ (+ (+ 1 x) (/ (* x x) 2)) (* 0.4166666666666667 (pow x 3))))

  (/ (log (- 1 x)) (log (+ 1 x))))