Average Error: 60.9 → 0.5
Time: 31.3s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\left(x \cdot x\right) \cdot \frac{-1}{2} + \left(-1 - x\right)\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\left(x \cdot x\right) \cdot \frac{-1}{2} + \left(-1 - x\right)
double f(double x) {
        double r5097329 = 1.0;
        double r5097330 = x;
        double r5097331 = r5097329 - r5097330;
        double r5097332 = log(r5097331);
        double r5097333 = r5097329 + r5097330;
        double r5097334 = log(r5097333);
        double r5097335 = r5097332 / r5097334;
        return r5097335;
}

double f(double x) {
        double r5097336 = x;
        double r5097337 = r5097336 * r5097336;
        double r5097338 = -0.5;
        double r5097339 = r5097337 * r5097338;
        double r5097340 = -1.0;
        double r5097341 = r5097340 - r5097336;
        double r5097342 = r5097339 + r5097341;
        return r5097342;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 60.9

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

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

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

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

Reproduce

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