Average Error: 61.3 → 0.4
Time: 26.4s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\frac{\left(\log 1 - \frac{\frac{{x}^{2}}{{1}^{2}}}{2}\right) - 1 \cdot x}{\log 1 - \left(\frac{\frac{{x}^{2}}{{1}^{2}}}{2} - 1 \cdot x\right)}\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\frac{\left(\log 1 - \frac{\frac{{x}^{2}}{{1}^{2}}}{2}\right) - 1 \cdot x}{\log 1 - \left(\frac{\frac{{x}^{2}}{{1}^{2}}}{2} - 1 \cdot x\right)}
double f(double x) {
        double r116804 = 1.0;
        double r116805 = x;
        double r116806 = r116804 - r116805;
        double r116807 = log(r116806);
        double r116808 = r116804 + r116805;
        double r116809 = log(r116808);
        double r116810 = r116807 / r116809;
        return r116810;
}

double f(double x) {
        double r116811 = 1.0;
        double r116812 = log(r116811);
        double r116813 = x;
        double r116814 = 2.0;
        double r116815 = pow(r116813, r116814);
        double r116816 = pow(r116811, r116814);
        double r116817 = r116815 / r116816;
        double r116818 = r116817 / r116814;
        double r116819 = r116812 - r116818;
        double r116820 = r116811 * r116813;
        double r116821 = r116819 - r116820;
        double r116822 = r116818 - r116820;
        double r116823 = r116812 - r116822;
        double r116824 = r116821 / r116823;
        return r116824;
}

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.4
\[-\left(\left(\left(1 + x\right) + \frac{x \cdot x}{2}\right) + 0.4166666666666666851703837437526090070605 \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. Simplified60.4

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

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

    \[\leadsto \color{blue}{\frac{1}{\frac{\log 1 - \left(\frac{\frac{{x}^{2}}{{1}^{2}}}{2} - 1 \cdot x\right)}{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}}\]
  8. Using strategy rm
  9. Applied div-inv0.6

    \[\leadsto \frac{1}{\color{blue}{\left(\log 1 - \left(\frac{\frac{{x}^{2}}{{1}^{2}}}{2} - 1 \cdot x\right)\right) \cdot \frac{1}{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}}\]
  10. Applied associate-/r*0.5

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

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

Reproduce

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

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

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