Average Error: 61.3 → 0.5
Time: 14.6s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\log \left(\frac{e^{\frac{\log 1}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}}}{e^{\frac{1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}}}\right)\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\log \left(\frac{e^{\frac{\log 1}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}}}{e^{\frac{1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}}}\right)
double f(double x) {
        double r113340 = 1.0;
        double r113341 = x;
        double r113342 = r113340 - r113341;
        double r113343 = log(r113342);
        double r113344 = r113340 + r113341;
        double r113345 = log(r113344);
        double r113346 = r113343 / r113345;
        return r113346;
}

double f(double x) {
        double r113347 = 1.0;
        double r113348 = log(r113347);
        double r113349 = x;
        double r113350 = r113347 * r113349;
        double r113351 = r113350 + r113348;
        double r113352 = 0.5;
        double r113353 = 2.0;
        double r113354 = pow(r113349, r113353);
        double r113355 = pow(r113347, r113353);
        double r113356 = r113354 / r113355;
        double r113357 = r113352 * r113356;
        double r113358 = r113351 - r113357;
        double r113359 = r113348 / r113358;
        double r113360 = exp(r113359);
        double r113361 = r113350 + r113357;
        double r113362 = r113361 / r113358;
        double r113363 = exp(r113362);
        double r113364 = r113360 / r113363;
        double r113365 = log(r113364);
        return r113365;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 61.3

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

    \[\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.5

    \[\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.5

    \[\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 div-sub0.5

    \[\leadsto \log \left(e^{\color{blue}{\frac{\log 1}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}} - \frac{1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}}}\right)\]
  8. Applied exp-diff0.5

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

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

Reproduce

herbie shell --seed 2020045 
(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))))