Average Error: 61.3 → 0.5
Time: 12.7s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\log \left(\frac{e^{\frac{\log 1}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}}}{e^{\frac{1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}}}\right)\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\log \left(\frac{e^{\frac{\log 1}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}}}{e^{\frac{1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}}}\right)
double f(double x) {
        double r75963 = 1.0;
        double r75964 = x;
        double r75965 = r75963 - r75964;
        double r75966 = log(r75965);
        double r75967 = r75963 + r75964;
        double r75968 = log(r75967);
        double r75969 = r75966 / r75968;
        return r75969;
}

double f(double x) {
        double r75970 = 1.0;
        double r75971 = log(r75970);
        double r75972 = x;
        double r75973 = r75970 * r75972;
        double r75974 = r75973 + r75971;
        double r75975 = 0.5;
        double r75976 = 2.0;
        double r75977 = pow(r75972, r75976);
        double r75978 = pow(r75970, r75976);
        double r75979 = r75977 / r75978;
        double r75980 = r75975 * r75979;
        double r75981 = r75974 - r75980;
        double r75982 = r75971 / r75981;
        double r75983 = exp(r75982);
        double r75984 = r75973 + r75980;
        double r75985 = r75984 / r75981;
        double r75986 = exp(r75985);
        double r75987 = r75983 / r75986;
        double r75988 = log(r75987);
        return r75988;
}

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.5
\[-\left(\left(\left(1 + x\right) + \frac{x \cdot x}{2}\right) + 0.416666666666666685 \cdot {x}^{3}\right)\]

Derivation

  1. Initial program 61.3

    \[\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. Using strategy rm
  5. Applied add-log-exp0.5

    \[\leadsto \color{blue}{\log \left(e^{\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}}}}\right)}\]
  6. Using strategy rm
  7. Applied div-sub0.5

    \[\leadsto \log \left(e^{\color{blue}{\frac{\log 1}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}} - \frac{1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}}}\right)\]
  8. Applied exp-diff0.5

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

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

Reproduce

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