Average Error: 61.2 → 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{1}{\log \left(e^{\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)}}\right)}\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\frac{1}{\log \left(e^{\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)}}\right)}
double f(double x) {
        double r90235 = 1.0;
        double r90236 = x;
        double r90237 = r90235 - r90236;
        double r90238 = log(r90237);
        double r90239 = r90235 + r90236;
        double r90240 = log(r90239);
        double r90241 = r90238 / r90240;
        return r90241;
}

double f(double x) {
        double r90242 = 1.0;
        double r90243 = 1.0;
        double r90244 = x;
        double r90245 = r90243 * r90244;
        double r90246 = log(r90243);
        double r90247 = r90245 + r90246;
        double r90248 = 0.5;
        double r90249 = 2.0;
        double r90250 = pow(r90244, r90249);
        double r90251 = pow(r90243, r90249);
        double r90252 = r90250 / r90251;
        double r90253 = r90248 * r90252;
        double r90254 = r90247 - r90253;
        double r90255 = r90245 + r90253;
        double r90256 = r90246 - r90255;
        double r90257 = r90254 / r90256;
        double r90258 = exp(r90257);
        double r90259 = log(r90258);
        double r90260 = r90242 / r90259;
        return r90260;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.2
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.2

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

    \[\leadsto \frac{1}{\color{blue}{\log \left(e^{\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)}}\right)}}\]
  8. Final simplification0.5

    \[\leadsto \frac{1}{\log \left(e^{\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)}}\right)}\]

Reproduce

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