Average Error: 61.0 → 0.5
Time: 26.1s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[-1 - \left(x + \left(\frac{1}{2} \cdot x\right) \cdot x\right)\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
-1 - \left(x + \left(\frac{1}{2} \cdot x\right) \cdot x\right)
double f(double x) {
        double r2567917 = 1.0;
        double r2567918 = x;
        double r2567919 = r2567917 - r2567918;
        double r2567920 = log(r2567919);
        double r2567921 = r2567917 + r2567918;
        double r2567922 = log(r2567921);
        double r2567923 = r2567920 / r2567922;
        return r2567923;
}

double f(double x) {
        double r2567924 = -1.0;
        double r2567925 = x;
        double r2567926 = 0.5;
        double r2567927 = r2567926 * r2567925;
        double r2567928 = r2567927 * r2567925;
        double r2567929 = r2567925 + r2567928;
        double r2567930 = r2567924 - r2567929;
        return r2567930;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

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

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

Reproduce

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