Average Error: 61.4 → 0.5
Time: 9.6s
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 r62249 = 1.0;
        double r62250 = x;
        double r62251 = r62249 - r62250;
        double r62252 = log(r62251);
        double r62253 = r62249 + r62250;
        double r62254 = log(r62253);
        double r62255 = r62252 / r62254;
        return r62255;
}

double f(double x) {
        double r62256 = 1.0;
        double r62257 = 1.0;
        double r62258 = x;
        double r62259 = r62257 * r62258;
        double r62260 = log(r62257);
        double r62261 = r62259 + r62260;
        double r62262 = 0.5;
        double r62263 = 2.0;
        double r62264 = pow(r62258, r62263);
        double r62265 = pow(r62257, r62263);
        double r62266 = r62264 / r62265;
        double r62267 = r62262 * r62266;
        double r62268 = r62261 - r62267;
        double r62269 = r62256 / r62268;
        double r62270 = r62259 + r62267;
        double r62271 = r62260 - r62270;
        double r62272 = r62256 / r62271;
        double r62273 = r62269 / r62272;
        return r62273;
}

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))))