Average Error: 60.9 → 0.5
Time: 16.9s
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 r1235184 = 1.0;
        double r1235185 = x;
        double r1235186 = r1235184 - r1235185;
        double r1235187 = log(r1235186);
        double r1235188 = r1235184 + r1235185;
        double r1235189 = log(r1235188);
        double r1235190 = r1235187 / r1235189;
        return r1235190;
}

double f(double x) {
        double r1235191 = x;
        double r1235192 = -r1235191;
        double r1235193 = -1.0;
        double r1235194 = r1235192 + r1235193;
        double r1235195 = r1235191 * r1235191;
        double r1235196 = -0.5;
        double r1235197 = r1235195 * r1235196;
        double r1235198 = r1235194 + r1235197;
        return r1235198;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

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

Reproduce

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