Average Error: 61.0 → 0.4
Time: 20.5s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\left(-1 - \left(\frac{1}{2} \cdot x\right) \cdot x\right) - x\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\left(-1 - \left(\frac{1}{2} \cdot x\right) \cdot x\right) - x
double f(double x) {
        double r1683428 = 1.0;
        double r1683429 = x;
        double r1683430 = r1683428 - r1683429;
        double r1683431 = log(r1683430);
        double r1683432 = r1683428 + r1683429;
        double r1683433 = log(r1683432);
        double r1683434 = r1683431 / r1683433;
        return r1683434;
}

double f(double x) {
        double r1683435 = -1.0;
        double r1683436 = 0.5;
        double r1683437 = x;
        double r1683438 = r1683436 * r1683437;
        double r1683439 = r1683438 * r1683437;
        double r1683440 = r1683435 - r1683439;
        double r1683441 = r1683440 - r1683437;
        return r1683441;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

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

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

Reproduce

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