Average Error: 7.9 → 6.4
Time: 3.7s
Precision: 64
\[x0 = 1.854999999999999982236431605997495353222 \land x1 = 2.090000000000000115064208161541614572343 \cdot 10^{-4} \lor x0 = 2.984999999999999875655021241982467472553 \land x1 = 0.01859999999999999847899445626353553961962\]
\[\frac{x0}{1 - x1} - x0\]
\[e^{\log \left(\log \left(\frac{1}{\sqrt{e^{x0}}}\right) + \mathsf{fma}\left(\frac{\sqrt[3]{x0}}{1 - x1}, {x0}^{\frac{2}{3}}, \log \left(\frac{1}{\sqrt{e^{x0}}}\right)\right)\right)}\]
\frac{x0}{1 - x1} - x0
e^{\log \left(\log \left(\frac{1}{\sqrt{e^{x0}}}\right) + \mathsf{fma}\left(\frac{\sqrt[3]{x0}}{1 - x1}, {x0}^{\frac{2}{3}}, \log \left(\frac{1}{\sqrt{e^{x0}}}\right)\right)\right)}
double f(double x0, double x1) {
        double r172698 = x0;
        double r172699 = 1.0;
        double r172700 = x1;
        double r172701 = r172699 - r172700;
        double r172702 = r172698 / r172701;
        double r172703 = r172702 - r172698;
        return r172703;
}

double f(double x0, double x1) {
        double r172704 = 1.0;
        double r172705 = x0;
        double r172706 = exp(r172705);
        double r172707 = sqrt(r172706);
        double r172708 = r172704 / r172707;
        double r172709 = log(r172708);
        double r172710 = cbrt(r172705);
        double r172711 = 1.0;
        double r172712 = x1;
        double r172713 = r172711 - r172712;
        double r172714 = r172710 / r172713;
        double r172715 = 0.6666666666666666;
        double r172716 = pow(r172705, r172715);
        double r172717 = fma(r172714, r172716, r172709);
        double r172718 = r172709 + r172717;
        double r172719 = log(r172718);
        double r172720 = exp(r172719);
        return r172720;
}

Error

Bits error versus x0

Bits error versus x1

Target

Original7.9
Target0.3
Herbie6.4
\[\frac{x0 \cdot x1}{1 - x1}\]

Derivation

  1. Initial program 7.9

    \[\frac{x0}{1 - x1} - x0\]
  2. Using strategy rm
  3. Applied *-un-lft-identity7.9

    \[\leadsto \frac{x0}{\color{blue}{1 \cdot \left(1 - x1\right)}} - x0\]
  4. Applied add-cube-cbrt7.9

    \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}\right) \cdot \sqrt[3]{x0}}}{1 \cdot \left(1 - x1\right)} - x0\]
  5. Applied times-frac8.2

    \[\leadsto \color{blue}{\frac{\sqrt[3]{x0} \cdot \sqrt[3]{x0}}{1} \cdot \frac{\sqrt[3]{x0}}{1 - x1}} - x0\]
  6. Applied fma-neg6.9

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\sqrt[3]{x0} \cdot \sqrt[3]{x0}}{1}, \frac{\sqrt[3]{x0}}{1 - x1}, -x0\right)}\]
  7. Using strategy rm
  8. Applied add-exp-log6.9

    \[\leadsto \color{blue}{e^{\log \left(\mathsf{fma}\left(\frac{\sqrt[3]{x0} \cdot \sqrt[3]{x0}}{1}, \frac{\sqrt[3]{x0}}{1 - x1}, -x0\right)\right)}}\]
  9. Using strategy rm
  10. Applied add-log-exp7.8

    \[\leadsto e^{\log \color{blue}{\left(\log \left(e^{\mathsf{fma}\left(\frac{\sqrt[3]{x0} \cdot \sqrt[3]{x0}}{1}, \frac{\sqrt[3]{x0}}{1 - x1}, -x0\right)}\right)\right)}}\]
  11. Simplified6.7

    \[\leadsto e^{\log \left(\log \color{blue}{\left(\frac{{\left(e^{{x0}^{\frac{2}{3}}}\right)}^{\left(\frac{\sqrt[3]{x0}}{1 - x1}\right)}}{e^{x0}}\right)}\right)}\]
  12. Using strategy rm
  13. Applied add-sqr-sqrt7.2

    \[\leadsto e^{\log \left(\log \left(\frac{{\left(e^{{x0}^{\frac{2}{3}}}\right)}^{\left(\frac{\sqrt[3]{x0}}{1 - x1}\right)}}{\color{blue}{\sqrt{e^{x0}} \cdot \sqrt{e^{x0}}}}\right)\right)}\]
  14. Applied *-un-lft-identity7.2

    \[\leadsto e^{\log \left(\log \left(\frac{{\color{blue}{\left(1 \cdot e^{{x0}^{\frac{2}{3}}}\right)}}^{\left(\frac{\sqrt[3]{x0}}{1 - x1}\right)}}{\sqrt{e^{x0}} \cdot \sqrt{e^{x0}}}\right)\right)}\]
  15. Applied unpow-prod-down7.2

    \[\leadsto e^{\log \left(\log \left(\frac{\color{blue}{{1}^{\left(\frac{\sqrt[3]{x0}}{1 - x1}\right)} \cdot {\left(e^{{x0}^{\frac{2}{3}}}\right)}^{\left(\frac{\sqrt[3]{x0}}{1 - x1}\right)}}}{\sqrt{e^{x0}} \cdot \sqrt{e^{x0}}}\right)\right)}\]
  16. Applied times-frac6.8

    \[\leadsto e^{\log \left(\log \color{blue}{\left(\frac{{1}^{\left(\frac{\sqrt[3]{x0}}{1 - x1}\right)}}{\sqrt{e^{x0}}} \cdot \frac{{\left(e^{{x0}^{\frac{2}{3}}}\right)}^{\left(\frac{\sqrt[3]{x0}}{1 - x1}\right)}}{\sqrt{e^{x0}}}\right)}\right)}\]
  17. Applied log-prod7.0

    \[\leadsto e^{\log \color{blue}{\left(\log \left(\frac{{1}^{\left(\frac{\sqrt[3]{x0}}{1 - x1}\right)}}{\sqrt{e^{x0}}}\right) + \log \left(\frac{{\left(e^{{x0}^{\frac{2}{3}}}\right)}^{\left(\frac{\sqrt[3]{x0}}{1 - x1}\right)}}{\sqrt{e^{x0}}}\right)\right)}}\]
  18. Simplified7.0

    \[\leadsto e^{\log \left(\color{blue}{\log \left(\frac{1}{\sqrt{e^{x0}}}\right)} + \log \left(\frac{{\left(e^{{x0}^{\frac{2}{3}}}\right)}^{\left(\frac{\sqrt[3]{x0}}{1 - x1}\right)}}{\sqrt{e^{x0}}}\right)\right)}\]
  19. Simplified6.4

    \[\leadsto e^{\log \left(\log \left(\frac{1}{\sqrt{e^{x0}}}\right) + \color{blue}{\mathsf{fma}\left(\frac{\sqrt[3]{x0}}{1 - x1}, {x0}^{\frac{2}{3}}, \log \left(\frac{1}{\sqrt{e^{x0}}}\right)\right)}\right)}\]
  20. Final simplification6.4

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

Reproduce

herbie shell --seed 2019353 +o rules:numerics
(FPCore (x0 x1)
  :name "(- (/ x0 (- 1 x1)) x0)"
  :precision binary64
  :pre (or (and (== x0 1.855) (== x1 0.000209)) (and (== x0 2.985) (== x1 0.0186)))

  :herbie-target
  (/ (* x0 x1) (- 1 x1))

  (- (/ x0 (- 1 x1)) x0))