Average Error: 61.4 → 0.5
Time: 9.2s
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 r140892 = 1.0;
        double r140893 = x;
        double r140894 = r140892 - r140893;
        double r140895 = log(r140894);
        double r140896 = r140892 + r140893;
        double r140897 = log(r140896);
        double r140898 = r140895 / r140897;
        return r140898;
}

double f(double x) {
        double r140899 = 1.0;
        double r140900 = log(r140899);
        double r140901 = x;
        double r140902 = r140899 * r140901;
        double r140903 = 0.5;
        double r140904 = 2.0;
        double r140905 = pow(r140901, r140904);
        double r140906 = pow(r140899, r140904);
        double r140907 = r140905 / r140906;
        double r140908 = r140903 * r140907;
        double r140909 = r140902 + r140908;
        double r140910 = r140900 - r140909;
        double r140911 = r140902 + r140900;
        double r140912 = r140911 - r140908;
        double r140913 = r140910 / r140912;
        return r140913;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Initial program 61.4

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

    \[\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.5

    \[\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.5

    \[\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 2019354 
(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))))