Average Error: 61.3 → 0.7
Time: 7.2s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[1 \cdot \left(\log 1 + \frac{\log 1}{x}\right) + \left(0.25 \cdot \frac{x \cdot \log 1}{{1}^{4}} - \left(0.3333333333333333148296162562473909929395 \cdot \frac{x \cdot \log 1}{{1}^{3}} + \left(1 \cdot x + \left(0.5 \cdot \frac{\log 1}{{1}^{2}} + 1\right)\right)\right)\right)\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
1 \cdot \left(\log 1 + \frac{\log 1}{x}\right) + \left(0.25 \cdot \frac{x \cdot \log 1}{{1}^{4}} - \left(0.3333333333333333148296162562473909929395 \cdot \frac{x \cdot \log 1}{{1}^{3}} + \left(1 \cdot x + \left(0.5 \cdot \frac{\log 1}{{1}^{2}} + 1\right)\right)\right)\right)
double f(double x) {
        double r62625 = 1.0;
        double r62626 = x;
        double r62627 = r62625 - r62626;
        double r62628 = log(r62627);
        double r62629 = r62625 + r62626;
        double r62630 = log(r62629);
        double r62631 = r62628 / r62630;
        return r62631;
}

double f(double x) {
        double r62632 = 1.0;
        double r62633 = log(r62632);
        double r62634 = x;
        double r62635 = r62633 / r62634;
        double r62636 = r62633 + r62635;
        double r62637 = r62632 * r62636;
        double r62638 = 0.25;
        double r62639 = r62634 * r62633;
        double r62640 = 4.0;
        double r62641 = pow(r62632, r62640);
        double r62642 = r62639 / r62641;
        double r62643 = r62638 * r62642;
        double r62644 = 0.3333333333333333;
        double r62645 = 3.0;
        double r62646 = pow(r62632, r62645);
        double r62647 = r62639 / r62646;
        double r62648 = r62644 * r62647;
        double r62649 = r62632 * r62634;
        double r62650 = 0.5;
        double r62651 = 2.0;
        double r62652 = pow(r62632, r62651);
        double r62653 = r62633 / r62652;
        double r62654 = r62650 * r62653;
        double r62655 = r62654 + r62632;
        double r62656 = r62649 + r62655;
        double r62657 = r62648 + r62656;
        double r62658 = r62643 - r62657;
        double r62659 = r62637 + r62658;
        return r62659;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.3
Target0.3
Herbie0.7
\[-\left(\left(\left(1 + x\right) + \frac{x \cdot x}{2}\right) + 0.4166666666666666851703837437526090070605 \cdot {x}^{3}\right)\]

Derivation

  1. Initial program 61.3

    \[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
  2. Using strategy rm
  3. Applied flip3-+61.1

    \[\leadsto \frac{\log \left(1 - x\right)}{\log \color{blue}{\left(\frac{{1}^{3} + {x}^{3}}{1 \cdot 1 + \left(x \cdot x - 1 \cdot x\right)}\right)}}\]
  4. Applied log-div61.2

    \[\leadsto \frac{\log \left(1 - x\right)}{\color{blue}{\log \left({1}^{3} + {x}^{3}\right) - \log \left(1 \cdot 1 + \left(x \cdot x - 1 \cdot x\right)\right)}}\]
  5. Taylor expanded around 0 0.7

    \[\leadsto \color{blue}{\left(1 \cdot \log 1 + \left(1 \cdot \frac{\log 1}{x} + 0.25 \cdot \frac{x \cdot \log 1}{{1}^{4}}\right)\right) - \left(0.3333333333333333148296162562473909929395 \cdot \frac{x \cdot \log 1}{{1}^{3}} + \left(1 \cdot x + \left(0.5 \cdot \frac{\log 1}{{1}^{2}} + 1\right)\right)\right)}\]
  6. Simplified0.7

    \[\leadsto \color{blue}{1 \cdot \left(\log 1 + \frac{\log 1}{x}\right) + \left(0.25 \cdot \frac{x \cdot \log 1}{{1}^{4}} - \left(0.3333333333333333148296162562473909929395 \cdot \frac{x \cdot \log 1}{{1}^{3}} + \left(1 \cdot x + \left(0.5 \cdot \frac{\log 1}{{1}^{2}} + 1\right)\right)\right)\right)}\]
  7. Final simplification0.7

    \[\leadsto 1 \cdot \left(\log 1 + \frac{\log 1}{x}\right) + \left(0.25 \cdot \frac{x \cdot \log 1}{{1}^{4}} - \left(0.3333333333333333148296162562473909929395 \cdot \frac{x \cdot \log 1}{{1}^{3}} + \left(1 \cdot x + \left(0.5 \cdot \frac{\log 1}{{1}^{2}} + 1\right)\right)\right)\right)\]

Reproduce

herbie shell --seed 2019344 
(FPCore (x)
  :name "qlog (example 3.10)"
  :precision binary64
  :pre (and (< -1 x) (< x 1))

  :herbie-target
  (- (+ (+ (+ 1 x) (/ (* x x) 2)) (* 0.4166666666666667 (pow x 3))))

  (/ (log (- 1 x)) (log (+ 1 x))))