Average Error: 61.0 → 0.5
Time: 17.2s
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} + \left(1 + x\right)\right)\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
-\left(\left(x \cdot x\right) \cdot \frac{1}{2} + \left(1 + x\right)\right)
double f(double x) {
        double r1474642 = 1.0;
        double r1474643 = x;
        double r1474644 = r1474642 - r1474643;
        double r1474645 = log(r1474644);
        double r1474646 = r1474642 + r1474643;
        double r1474647 = log(r1474646);
        double r1474648 = r1474645 / r1474647;
        return r1474648;
}

double f(double x) {
        double r1474649 = x;
        double r1474650 = r1474649 * r1474649;
        double r1474651 = 0.5;
        double r1474652 = r1474650 * r1474651;
        double r1474653 = 1.0;
        double r1474654 = r1474653 + r1474649;
        double r1474655 = r1474652 + r1474654;
        double r1474656 = -r1474655;
        return r1474656;
}

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

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

Reproduce

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