Average Error: 61.5 → 0.4
Time: 8.9s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\frac{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\frac{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}
double f(double x) {
        double r77767 = 1.0;
        double r77768 = x;
        double r77769 = r77767 - r77768;
        double r77770 = log(r77769);
        double r77771 = r77767 + r77768;
        double r77772 = log(r77771);
        double r77773 = r77770 / r77772;
        return r77773;
}

double f(double x) {
        double r77774 = 1.0;
        double r77775 = log(r77774);
        double r77776 = x;
        double r77777 = r77774 * r77776;
        double r77778 = 0.5;
        double r77779 = 2.0;
        double r77780 = pow(r77776, r77779);
        double r77781 = pow(r77774, r77779);
        double r77782 = r77780 / r77781;
        double r77783 = r77778 * r77782;
        double r77784 = r77777 + r77783;
        double r77785 = r77775 - r77784;
        double r77786 = r77777 + r77775;
        double r77787 = r77786 - r77783;
        double r77788 = r77785 / r77787;
        return r77788;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 61.5

    \[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
  2. Taylor expanded around 0 60.6

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

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

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

Reproduce

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