Average Error: 61.5 → 0.4
Time: 9.3s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\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)}}\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\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)}}
double f(double x) {
        double r62933 = 1.0;
        double r62934 = x;
        double r62935 = r62933 - r62934;
        double r62936 = log(r62935);
        double r62937 = r62933 + r62934;
        double r62938 = log(r62937);
        double r62939 = r62936 / r62938;
        return r62939;
}

double f(double x) {
        double r62940 = 1.0;
        double r62941 = 1.0;
        double r62942 = x;
        double r62943 = r62941 * r62942;
        double r62944 = log(r62941);
        double r62945 = r62943 + r62944;
        double r62946 = 0.5;
        double r62947 = 2.0;
        double r62948 = pow(r62942, r62947);
        double r62949 = pow(r62941, r62947);
        double r62950 = r62948 / r62949;
        double r62951 = r62946 * r62950;
        double r62952 = r62945 - r62951;
        double r62953 = r62943 + r62951;
        double r62954 = r62944 - r62953;
        double r62955 = r62952 / r62954;
        double r62956 = r62940 / r62955;
        return r62956;
}

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

    \[\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. Final simplification0.4

    \[\leadsto \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)}}\]

Reproduce

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