Average Error: 61.4 → 0.5
Time: 10.4s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\frac{\frac{1}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}}{\frac{1}{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\frac{\frac{1}{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}}{\frac{1}{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}
double f(double x) {
        double r98028 = 1.0;
        double r98029 = x;
        double r98030 = r98028 - r98029;
        double r98031 = log(r98030);
        double r98032 = r98028 + r98029;
        double r98033 = log(r98032);
        double r98034 = r98031 / r98033;
        return r98034;
}

double f(double x) {
        double r98035 = 1.0;
        double r98036 = 1.0;
        double r98037 = x;
        double r98038 = r98036 * r98037;
        double r98039 = log(r98036);
        double r98040 = r98038 + r98039;
        double r98041 = 0.5;
        double r98042 = 2.0;
        double r98043 = pow(r98037, r98042);
        double r98044 = pow(r98036, r98042);
        double r98045 = r98043 / r98044;
        double r98046 = r98041 * r98045;
        double r98047 = r98040 - r98046;
        double r98048 = r98035 / r98047;
        double r98049 = r98038 + r98046;
        double r98050 = r98039 - r98049;
        double r98051 = r98035 / r98050;
        double r98052 = r98048 / r98051;
        return r98052;
}

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.416666666666666685 \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. Using strategy rm
  5. Applied clear-num0.5

    \[\leadsto \color{blue}{\frac{1}{\frac{\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}}{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}}\]
  6. Using strategy rm
  7. Applied div-inv0.7

    \[\leadsto \frac{1}{\color{blue}{\left(\left(1 \cdot x + \log 1\right) - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right) \cdot \frac{1}{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}}\]
  8. Applied associate-/r*0.5

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

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

Reproduce

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