Average Error: 61.1 → 0.6
Time: 10.2s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\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}}}\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\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}}}
double f(double x) {
        double r65112 = 1.0;
        double r65113 = x;
        double r65114 = r65112 - r65113;
        double r65115 = log(r65114);
        double r65116 = r65112 + r65113;
        double r65117 = log(r65116);
        double r65118 = r65115 / r65117;
        return r65118;
}

double f(double x) {
        double r65119 = 1.0;
        double r65120 = log(r65119);
        double r65121 = x;
        double r65122 = r65119 * r65121;
        double r65123 = 0.5;
        double r65124 = 2.0;
        double r65125 = pow(r65121, r65124);
        double r65126 = pow(r65119, r65124);
        double r65127 = r65125 / r65126;
        double r65128 = r65123 * r65127;
        double r65129 = r65122 + r65128;
        double r65130 = r65120 - r65129;
        double r65131 = r65122 + r65120;
        double r65132 = r65131 - r65128;
        double r65133 = r65130 / r65132;
        return r65133;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original61.1
Target0.4
Herbie0.6
\[-\left(\left(\left(1 + x\right) + \frac{x \cdot x}{2}\right) + 0.416666666666666685 \cdot {x}^{3}\right)\]

Derivation

  1. Initial program 61.1

    \[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
  2. Taylor expanded around 0 60.4

    \[\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.6

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

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

Reproduce

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