Average Error: 61.3 → 0.5
Time: 9.9s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\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{\frac{1}{2} \cdot x}{1} \cdot \frac{x}{{1}^{1}}}}\right)\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\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{\frac{1}{2} \cdot x}{1} \cdot \frac{x}{{1}^{1}}}}\right)
double f(double x) {
        double r63544 = 1.0;
        double r63545 = x;
        double r63546 = r63544 - r63545;
        double r63547 = log(r63546);
        double r63548 = r63544 + r63545;
        double r63549 = log(r63548);
        double r63550 = r63547 / r63549;
        return r63550;
}

double f(double x) {
        double r63551 = 1.0;
        double r63552 = log(r63551);
        double r63553 = x;
        double r63554 = r63551 * r63553;
        double r63555 = 0.5;
        double r63556 = 2.0;
        double r63557 = pow(r63553, r63556);
        double r63558 = pow(r63551, r63556);
        double r63559 = r63557 / r63558;
        double r63560 = r63555 * r63559;
        double r63561 = r63554 + r63560;
        double r63562 = r63552 - r63561;
        double r63563 = r63554 + r63552;
        double r63564 = r63555 * r63553;
        double r63565 = r63564 / r63551;
        double r63566 = 1.0;
        double r63567 = pow(r63551, r63566);
        double r63568 = r63553 / r63567;
        double r63569 = r63565 * r63568;
        double r63570 = r63563 - r63569;
        double r63571 = r63562 / r63570;
        double r63572 = exp(r63571);
        double r63573 = log(r63572);
        return r63573;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.3
Target0.4
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.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.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 sqr-pow0.5

    \[\leadsto \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}}{\color{blue}{{1}^{\left(\frac{2}{2}\right)} \cdot {1}^{\left(\frac{2}{2}\right)}}}}}\right)\]
  8. Applied unpow20.5

    \[\leadsto \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{\color{blue}{x \cdot x}}{{1}^{\left(\frac{2}{2}\right)} \cdot {1}^{\left(\frac{2}{2}\right)}}}}\right)\]
  9. Applied times-frac0.5

    \[\leadsto \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 \color{blue}{\left(\frac{x}{{1}^{\left(\frac{2}{2}\right)}} \cdot \frac{x}{{1}^{\left(\frac{2}{2}\right)}}\right)}}}\right)\]
  10. Applied associate-*r*0.5

    \[\leadsto \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) - \color{blue}{\left(\frac{1}{2} \cdot \frac{x}{{1}^{\left(\frac{2}{2}\right)}}\right) \cdot \frac{x}{{1}^{\left(\frac{2}{2}\right)}}}}}\right)\]
  11. Simplified0.5

    \[\leadsto \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) - \color{blue}{\frac{\frac{1}{2} \cdot x}{1}} \cdot \frac{x}{{1}^{\left(\frac{2}{2}\right)}}}}\right)\]
  12. Final simplification0.5

    \[\leadsto \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{\frac{1}{2} \cdot x}{1} \cdot \frac{x}{{1}^{1}}}}\right)\]

Reproduce

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