Average Error: 61.4 → 0.4
Time: 9.8s
Precision: 64
\[-1 \lt x \land x \lt 1\]
\[\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}\]
\[\sqrt[3]{{\left(\frac{1}{\frac{\mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}\right)}^{3}}\]
\frac{\log \left(1 - x\right)}{\log \left(1 + x\right)}
\sqrt[3]{{\left(\frac{1}{\frac{\mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}\right)}^{3}}
double f(double x) {
        double r91171 = 1.0;
        double r91172 = x;
        double r91173 = r91171 - r91172;
        double r91174 = log(r91173);
        double r91175 = r91171 + r91172;
        double r91176 = log(r91175);
        double r91177 = r91174 / r91176;
        return r91177;
}

double f(double x) {
        double r91178 = 1.0;
        double r91179 = x;
        double r91180 = 1.0;
        double r91181 = log(r91180);
        double r91182 = 0.5;
        double r91183 = 2.0;
        double r91184 = pow(r91179, r91183);
        double r91185 = pow(r91180, r91183);
        double r91186 = r91184 / r91185;
        double r91187 = r91182 * r91186;
        double r91188 = r91181 - r91187;
        double r91189 = fma(r91179, r91180, r91188);
        double r91190 = r91180 * r91179;
        double r91191 = r91190 + r91187;
        double r91192 = r91181 - r91191;
        double r91193 = r91189 / r91192;
        double r91194 = r91178 / r91193;
        double r91195 = 3.0;
        double r91196 = pow(r91194, r91195);
        double r91197 = cbrt(r91196);
        return r91197;
}

Error

Bits error versus x

Target

Original61.4
Target0.3
Herbie0.4
\[-\left(\left(\left(1 + x\right) + \frac{x \cdot x}{2}\right) + 0.4166666666666666851703837437526090070605 \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. Simplified60.5

    \[\leadsto \frac{\log \left(1 - x\right)}{\color{blue}{\mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}\]
  4. 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)}}{\mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}\]
  5. Using strategy rm
  6. Applied clear-num0.4

    \[\leadsto \color{blue}{\frac{1}{\frac{\mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}}\]
  7. Using strategy rm
  8. Applied add-cbrt-cube40.8

    \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}{\color{blue}{\sqrt[3]{\left(\left(\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right) \cdot \left(\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)\right) \cdot \left(\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)}}}}\]
  9. Applied add-cbrt-cube41.4

    \[\leadsto \frac{1}{\frac{\color{blue}{\sqrt[3]{\left(\mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right) \cdot \mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right) \cdot \mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}}{\sqrt[3]{\left(\left(\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right) \cdot \left(\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)\right) \cdot \left(\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)}}}\]
  10. Applied cbrt-undiv41.4

    \[\leadsto \frac{1}{\color{blue}{\sqrt[3]{\frac{\left(\mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right) \cdot \mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right) \cdot \mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}{\left(\left(\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right) \cdot \left(\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)\right) \cdot \left(\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)}}}}\]
  11. Applied add-cbrt-cube41.4

    \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(1 \cdot 1\right) \cdot 1}}}{\sqrt[3]{\frac{\left(\mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right) \cdot \mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right) \cdot \mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}{\left(\left(\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right) \cdot \left(\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)\right) \cdot \left(\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)}}}\]
  12. Applied cbrt-undiv41.4

    \[\leadsto \color{blue}{\sqrt[3]{\frac{\left(1 \cdot 1\right) \cdot 1}{\frac{\left(\mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right) \cdot \mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right) \cdot \mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}{\left(\left(\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right) \cdot \left(\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)\right) \cdot \left(\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)\right)}}}}\]
  13. Simplified0.4

    \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{1}{\frac{\mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}\right)}^{3}}}\]
  14. Final simplification0.4

    \[\leadsto \sqrt[3]{{\left(\frac{1}{\frac{\mathsf{fma}\left(x, 1, \log 1 - \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}{\log 1 - \left(1 \cdot x + \frac{1}{2} \cdot \frac{{x}^{2}}{{1}^{2}}\right)}}\right)}^{3}}\]

Reproduce

herbie shell --seed 2019353 +o rules:numerics
(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))))