Average Error: 61.5 → 0.4
Time: 19.3s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\frac{\log 1 - 1 \cdot x}{\left(\log 1 + 1 \cdot x\right) + \frac{\frac{-1}{2}}{\frac{1 \cdot 1}{{x}^{2}}}} - \frac{\frac{x}{1}}{\frac{\left(\log 1 + 1 \cdot x\right) + \frac{\frac{-1}{2}}{\frac{1 \cdot 1}{{x}^{2}}}}{\frac{\frac{1}{2}}{\frac{1}{x}}}}\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\frac{\log 1 - 1 \cdot x}{\left(\log 1 + 1 \cdot x\right) + \frac{\frac{-1}{2}}{\frac{1 \cdot 1}{{x}^{2}}}} - \frac{\frac{x}{1}}{\frac{\left(\log 1 + 1 \cdot x\right) + \frac{\frac{-1}{2}}{\frac{1 \cdot 1}{{x}^{2}}}}{\frac{\frac{1}{2}}{\frac{1}{x}}}}
double f(double x) {
        double r65546 = 1.0;
        double r65547 = x;
        double r65548 = r65546 - r65547;
        double r65549 = log(r65548);
        double r65550 = r65546 + r65547;
        double r65551 = log(r65550);
        double r65552 = r65549 / r65551;
        return r65552;
}

double f(double x) {
        double r65553 = 1.0;
        double r65554 = log(r65553);
        double r65555 = x;
        double r65556 = r65553 * r65555;
        double r65557 = r65554 - r65556;
        double r65558 = r65554 + r65556;
        double r65559 = -0.5;
        double r65560 = r65553 * r65553;
        double r65561 = 2.0;
        double r65562 = pow(r65555, r65561);
        double r65563 = r65560 / r65562;
        double r65564 = r65559 / r65563;
        double r65565 = r65558 + r65564;
        double r65566 = r65557 / r65565;
        double r65567 = r65555 / r65553;
        double r65568 = 0.5;
        double r65569 = r65553 / r65555;
        double r65570 = r65568 / r65569;
        double r65571 = r65565 / r65570;
        double r65572 = r65567 / r65571;
        double r65573 = r65566 - r65572;
        return r65573;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.5
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.5

    \[\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(\log 1 + 1 \cdot x\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}}\]
  3. Simplified60.5

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

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

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

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

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

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

Reproduce

herbie shell --seed 2019194 
(FPCore (x)
  :name "qlog (example 3.10)"
  :pre (and (< -1.0 x) (< x 1.0))

  :herbie-target
  (- (+ (+ (+ 1.0 x) (/ (* x x) 2.0)) (* 0.4166666666666667 (pow x 3.0))))

  (/ (log (- 1.0 x)) (log (+ 1.0 x))))