Average Error: 7.9 → 5.4
Time: 4.0s
Precision: 64
\[x0 = 1.855 \land x1 = 2.09000000000000012 \cdot 10^{-4} \lor x0 = 2.98499999999999988 \land x1 = 0.018599999999999998\]
\[\frac{x0}{1 - x1} - x0\]
\[\frac{{\left(\log \left(\frac{1}{\sqrt{e^{x0}}}\right)\right)}^{3} + {\left(\mathsf{fma}\left(\frac{\sqrt[3]{x0}}{1 - x1}, {x0}^{\frac{2}{3}}, \log \left(\frac{1}{\sqrt{e^{x0}}}\right)\right)\right)}^{3}}{\mathsf{fma}\left(\frac{\sqrt[3]{x0}}{1 - x1}, {x0}^{\frac{2}{3}}, \log \left(\frac{1}{\sqrt{e^{x0}}}\right)\right) \cdot \left(\frac{\sqrt[3]{x0}}{1 - x1} \cdot {x0}^{\frac{2}{3}}\right) + \log \left(\sqrt{e^{x0}}\right) \cdot \log \left(\sqrt{e^{x0}}\right)}\]
\frac{x0}{1 - x1} - x0
\frac{{\left(\log \left(\frac{1}{\sqrt{e^{x0}}}\right)\right)}^{3} + {\left(\mathsf{fma}\left(\frac{\sqrt[3]{x0}}{1 - x1}, {x0}^{\frac{2}{3}}, \log \left(\frac{1}{\sqrt{e^{x0}}}\right)\right)\right)}^{3}}{\mathsf{fma}\left(\frac{\sqrt[3]{x0}}{1 - x1}, {x0}^{\frac{2}{3}}, \log \left(\frac{1}{\sqrt{e^{x0}}}\right)\right) \cdot \left(\frac{\sqrt[3]{x0}}{1 - x1} \cdot {x0}^{\frac{2}{3}}\right) + \log \left(\sqrt{e^{x0}}\right) \cdot \log \left(\sqrt{e^{x0}}\right)}
double f(double x0, double x1) {
        double r132885 = x0;
        double r132886 = 1.0;
        double r132887 = x1;
        double r132888 = r132886 - r132887;
        double r132889 = r132885 / r132888;
        double r132890 = r132889 - r132885;
        return r132890;
}

double f(double x0, double x1) {
        double r132891 = 1.0;
        double r132892 = x0;
        double r132893 = exp(r132892);
        double r132894 = sqrt(r132893);
        double r132895 = r132891 / r132894;
        double r132896 = log(r132895);
        double r132897 = 3.0;
        double r132898 = pow(r132896, r132897);
        double r132899 = cbrt(r132892);
        double r132900 = 1.0;
        double r132901 = x1;
        double r132902 = r132900 - r132901;
        double r132903 = r132899 / r132902;
        double r132904 = 0.6666666666666666;
        double r132905 = pow(r132892, r132904);
        double r132906 = fma(r132903, r132905, r132896);
        double r132907 = pow(r132906, r132897);
        double r132908 = r132898 + r132907;
        double r132909 = r132903 * r132905;
        double r132910 = r132906 * r132909;
        double r132911 = log(r132894);
        double r132912 = r132911 * r132911;
        double r132913 = r132910 + r132912;
        double r132914 = r132908 / r132913;
        return r132914;
}

Error

Bits error versus x0

Bits error versus x1

Target

Original7.9
Target0.2
Herbie5.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-log-exp7.8

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

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

    \[\leadsto \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)\]
  12. Applied *-un-lft-identity7.3

    \[\leadsto \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)\]
  13. Applied unpow-prod-down7.3

    \[\leadsto \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)\]
  14. Applied times-frac6.9

    \[\leadsto \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)}\]
  15. Applied log-prod7.0

    \[\leadsto \color{blue}{\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)}\]
  16. Simplified7.0

    \[\leadsto \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)\]
  17. Simplified6.4

    \[\leadsto \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)}\]
  18. Using strategy rm
  19. Applied flip3-+5.5

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

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

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

Reproduce

herbie shell --seed 2020020 +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))