Average Error: 61.1 → 0.4
Time: 15.1s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\left(\left(-x\right) + -1\right) + \left(x \cdot x\right) \cdot \frac{-1}{2}\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\left(\left(-x\right) + -1\right) + \left(x \cdot x\right) \cdot \frac{-1}{2}
double f(double x) {
        double r941692 = 1.0;
        double r941693 = x;
        double r941694 = r941692 - r941693;
        double r941695 = log(r941694);
        double r941696 = r941692 + r941693;
        double r941697 = log(r941696);
        double r941698 = r941695 / r941697;
        return r941698;
}

double f(double x) {
        double r941699 = x;
        double r941700 = -r941699;
        double r941701 = -1.0;
        double r941702 = r941700 + r941701;
        double r941703 = r941699 * r941699;
        double r941704 = -0.5;
        double r941705 = r941703 * r941704;
        double r941706 = r941702 + r941705;
        return r941706;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 61.1

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

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

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

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

Reproduce

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

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

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