Average Error: 60.9 → 0.5
Time: 20.9s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\frac{-1}{2} \cdot \left(x \cdot x\right) + \left(-1 - x\right)\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\frac{-1}{2} \cdot \left(x \cdot x\right) + \left(-1 - x\right)
double f(double x) {
        double r3412943 = 1.0;
        double r3412944 = x;
        double r3412945 = r3412943 - r3412944;
        double r3412946 = log(r3412945);
        double r3412947 = r3412943 + r3412944;
        double r3412948 = log(r3412947);
        double r3412949 = r3412946 / r3412948;
        return r3412949;
}

double f(double x) {
        double r3412950 = -0.5;
        double r3412951 = x;
        double r3412952 = r3412951 * r3412951;
        double r3412953 = r3412950 * r3412952;
        double r3412954 = -1.0;
        double r3412955 = r3412954 - r3412951;
        double r3412956 = r3412953 + r3412955;
        return r3412956;
}

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(\frac{-1}{2} \cdot \left(x \cdot x\right) + -1\right) - x}\]
  4. Using strategy rm
  5. Applied associate--l+0.5

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

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

Reproduce

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