Average Error: 60.9 → 0.5
Time: 18.5s
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 r1277432 = 1.0;
        double r1277433 = x;
        double r1277434 = r1277432 - r1277433;
        double r1277435 = log(r1277434);
        double r1277436 = r1277432 + r1277433;
        double r1277437 = log(r1277436);
        double r1277438 = r1277435 / r1277437;
        return r1277438;
}

double f(double x) {
        double r1277439 = x;
        double r1277440 = -r1277439;
        double r1277441 = -1.0;
        double r1277442 = r1277440 + r1277441;
        double r1277443 = r1277439 * r1277439;
        double r1277444 = -0.5;
        double r1277445 = r1277443 * r1277444;
        double r1277446 = r1277442 + r1277445;
        return r1277446;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original60.9
Target0.4
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(-\left(x + 1\right)\right) + \left(x \cdot x\right) \cdot \frac{-1}{2}}\]
  4. Final simplification0.5

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

Reproduce

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