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(\left(-x\right) - 1\right) - \left(x \cdot x\right) \cdot \frac{1}{2}\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\left(\left(-x\right) - 1\right) - \left(x \cdot x\right) \cdot \frac{1}{2}
double f(double x) {
        double r2704284 = 1.0;
        double r2704285 = x;
        double r2704286 = r2704284 - r2704285;
        double r2704287 = log(r2704286);
        double r2704288 = r2704284 + r2704285;
        double r2704289 = log(r2704288);
        double r2704290 = r2704287 / r2704289;
        return r2704290;
}

double f(double x) {
        double r2704291 = x;
        double r2704292 = -r2704291;
        double r2704293 = 1.0;
        double r2704294 = r2704292 - r2704293;
        double r2704295 = r2704291 * r2704291;
        double r2704296 = 0.5;
        double r2704297 = r2704295 * r2704296;
        double r2704298 = r2704294 - r2704297;
        return r2704298;
}

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

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

Reproduce

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