Average Error: 61.2 → 0.3
Time: 31.5s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\left(\left(x \cdot x\right) \cdot \frac{-1}{2} - x\right) + -1\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\left(\left(x \cdot x\right) \cdot \frac{-1}{2} - x\right) + -1
double f(double x) {
        double r5226978 = 1.0;
        double r5226979 = x;
        double r5226980 = r5226978 - r5226979;
        double r5226981 = log(r5226980);
        double r5226982 = r5226978 + r5226979;
        double r5226983 = log(r5226982);
        double r5226984 = r5226981 / r5226983;
        return r5226984;
}

double f(double x) {
        double r5226985 = x;
        double r5226986 = r5226985 * r5226985;
        double r5226987 = -0.5;
        double r5226988 = r5226986 * r5226987;
        double r5226989 = r5226988 - r5226985;
        double r5226990 = -1.0;
        double r5226991 = r5226989 + r5226990;
        return r5226991;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 61.2

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

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

    \[\leadsto \color{blue}{\left(-1 - x\right) + \left(x \cdot x\right) \cdot \frac{-1}{2}}\]
  4. Using strategy rm
  5. Applied sub-neg0.3

    \[\leadsto \color{blue}{\left(-1 + \left(-x\right)\right)} + \left(x \cdot x\right) \cdot \frac{-1}{2}\]
  6. Applied associate-+l+0.3

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

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

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

Reproduce

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