Average Error: 60.8 → 0.4
Time: 13.3s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[-\left(\left(x \cdot \left(x \cdot \frac{1}{2}\right) + 1\right) + x\right)\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
-\left(\left(x \cdot \left(x \cdot \frac{1}{2}\right) + 1\right) + x\right)
double f(double x) {
        double r1537943 = 1.0;
        double r1537944 = x;
        double r1537945 = r1537943 - r1537944;
        double r1537946 = log(r1537945);
        double r1537947 = r1537943 + r1537944;
        double r1537948 = log(r1537947);
        double r1537949 = r1537946 / r1537948;
        return r1537949;
}

double f(double x) {
        double r1537950 = x;
        double r1537951 = 0.5;
        double r1537952 = r1537950 * r1537951;
        double r1537953 = r1537950 * r1537952;
        double r1537954 = 1.0;
        double r1537955 = r1537953 + r1537954;
        double r1537956 = r1537955 + r1537950;
        double r1537957 = -r1537956;
        return r1537957;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original60.8
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 60.8

    \[\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(\left(x + 1\right) + \left(x \cdot x\right) \cdot \frac{1}{2}\right)}\]
  4. Taylor expanded around 0 0.4

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

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

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

Reproduce

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