Average Error: 61.0 → 0.5
Time: 20.3s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\left(-1 - x \cdot \left(x \cdot \frac{1}{2}\right)\right) - x\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\left(-1 - x \cdot \left(x \cdot \frac{1}{2}\right)\right) - x
double f(double x) {
        double r2040945 = 1.0;
        double r2040946 = x;
        double r2040947 = r2040945 - r2040946;
        double r2040948 = log(r2040947);
        double r2040949 = r2040945 + r2040946;
        double r2040950 = log(r2040949);
        double r2040951 = r2040948 / r2040950;
        return r2040951;
}

double f(double x) {
        double r2040952 = -1.0;
        double r2040953 = x;
        double r2040954 = 0.5;
        double r2040955 = r2040953 * r2040954;
        double r2040956 = r2040953 * r2040955;
        double r2040957 = r2040952 - r2040956;
        double r2040958 = r2040957 - r2040953;
        return r2040958;
}

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

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

Reproduce

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