Average Error: 0.5 → 0.3
Time: 33.5s
Precision: 64
\[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right)\]
\[x1 + \mathsf{fma}\left(3, \frac{\mathsf{fma}\left(3, x1 \cdot x1, -\mathsf{fma}\left(x2, 2, x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1 \cdot x1, \left(-6\right) + 6, \mathsf{fma}\left(\frac{\mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} - 3, \frac{\mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\frac{\mathsf{fma}\left(x1, x1, 1\right)}{2 \cdot x1}}, \mathsf{fma}\left(4, \frac{\mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, -6\right) \cdot \left(x1 \cdot x1\right)\right)\right), \mathsf{fma}\left(x1 \cdot 3, \frac{x1 \cdot \mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, {x1}^{3}\right)\right)\right)\]
x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right)
x1 + \mathsf{fma}\left(3, \frac{\mathsf{fma}\left(3, x1 \cdot x1, -\mathsf{fma}\left(x2, 2, x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1 \cdot x1, \left(-6\right) + 6, \mathsf{fma}\left(\frac{\mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} - 3, \frac{\mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\frac{\mathsf{fma}\left(x1, x1, 1\right)}{2 \cdot x1}}, \mathsf{fma}\left(4, \frac{\mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, -6\right) \cdot \left(x1 \cdot x1\right)\right)\right), \mathsf{fma}\left(x1 \cdot 3, \frac{x1 \cdot \mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, {x1}^{3}\right)\right)\right)
double f(double x1, double x2) {
        double r60825 = x1;
        double r60826 = 2.0;
        double r60827 = r60826 * r60825;
        double r60828 = 3.0;
        double r60829 = r60828 * r60825;
        double r60830 = r60829 * r60825;
        double r60831 = x2;
        double r60832 = r60826 * r60831;
        double r60833 = r60830 + r60832;
        double r60834 = r60833 - r60825;
        double r60835 = r60825 * r60825;
        double r60836 = 1.0;
        double r60837 = r60835 + r60836;
        double r60838 = r60834 / r60837;
        double r60839 = r60827 * r60838;
        double r60840 = r60838 - r60828;
        double r60841 = r60839 * r60840;
        double r60842 = 4.0;
        double r60843 = r60842 * r60838;
        double r60844 = 6.0;
        double r60845 = r60843 - r60844;
        double r60846 = r60835 * r60845;
        double r60847 = r60841 + r60846;
        double r60848 = r60847 * r60837;
        double r60849 = r60830 * r60838;
        double r60850 = r60848 + r60849;
        double r60851 = r60835 * r60825;
        double r60852 = r60850 + r60851;
        double r60853 = r60852 + r60825;
        double r60854 = r60830 - r60832;
        double r60855 = r60854 - r60825;
        double r60856 = r60855 / r60837;
        double r60857 = r60828 * r60856;
        double r60858 = r60853 + r60857;
        double r60859 = r60825 + r60858;
        return r60859;
}

double f(double x1, double x2) {
        double r60860 = x1;
        double r60861 = 3.0;
        double r60862 = r60860 * r60860;
        double r60863 = x2;
        double r60864 = 2.0;
        double r60865 = fma(r60863, r60864, r60860);
        double r60866 = -r60865;
        double r60867 = fma(r60861, r60862, r60866);
        double r60868 = 1.0;
        double r60869 = fma(r60860, r60860, r60868);
        double r60870 = r60867 / r60869;
        double r60871 = 6.0;
        double r60872 = -r60871;
        double r60873 = r60872 + r60871;
        double r60874 = -r60860;
        double r60875 = fma(r60863, r60864, r60874);
        double r60876 = fma(r60861, r60862, r60875);
        double r60877 = r60876 / r60869;
        double r60878 = r60877 - r60861;
        double r60879 = r60864 * r60860;
        double r60880 = r60869 / r60879;
        double r60881 = r60876 / r60880;
        double r60882 = 4.0;
        double r60883 = fma(r60882, r60877, r60872);
        double r60884 = r60883 * r60862;
        double r60885 = fma(r60878, r60881, r60884);
        double r60886 = fma(r60862, r60873, r60885);
        double r60887 = r60860 * r60861;
        double r60888 = r60860 * r60876;
        double r60889 = r60888 / r60869;
        double r60890 = 3.0;
        double r60891 = pow(r60860, r60890);
        double r60892 = fma(r60887, r60889, r60891);
        double r60893 = fma(r60869, r60886, r60892);
        double r60894 = r60860 + r60893;
        double r60895 = fma(r60861, r60870, r60894);
        double r60896 = r60860 + r60895;
        return r60896;
}

Error

Bits error versus x1

Bits error versus x2

Derivation

  1. Initial program 0.5

    \[x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 6\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right)\]
  2. Using strategy rm
  3. Applied add-cube-cbrt0.6

    \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - \color{blue}{\left(\sqrt[3]{6} \cdot \sqrt[3]{6}\right) \cdot \sqrt[3]{6}}\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right)\]
  4. Applied prod-diff0.6

    \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \left(x1 \cdot x1\right) \cdot \color{blue}{\left(\mathsf{fma}\left(4, \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}, -\sqrt[3]{6} \cdot \left(\sqrt[3]{6} \cdot \sqrt[3]{6}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{6}, \sqrt[3]{6} \cdot \sqrt[3]{6}, \sqrt[3]{6} \cdot \left(\sqrt[3]{6} \cdot \sqrt[3]{6}\right)\right)\right)}\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right)\]
  5. Applied distribute-rgt-in0.6

    \[\leadsto x1 + \left(\left(\left(\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \color{blue}{\left(\mathsf{fma}\left(4, \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}, -\sqrt[3]{6} \cdot \left(\sqrt[3]{6} \cdot \sqrt[3]{6}\right)\right) \cdot \left(x1 \cdot x1\right) + \mathsf{fma}\left(-\sqrt[3]{6}, \sqrt[3]{6} \cdot \sqrt[3]{6}, \sqrt[3]{6} \cdot \left(\sqrt[3]{6} \cdot \sqrt[3]{6}\right)\right) \cdot \left(x1 \cdot x1\right)\right)}\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right)\]
  6. Applied associate-+r+0.6

    \[\leadsto x1 + \left(\left(\left(\left(\color{blue}{\left(\left(\left(\left(2 \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) \cdot \left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1} - 3\right) + \mathsf{fma}\left(4, \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}, -\sqrt[3]{6} \cdot \left(\sqrt[3]{6} \cdot \sqrt[3]{6}\right)\right) \cdot \left(x1 \cdot x1\right)\right) + \mathsf{fma}\left(-\sqrt[3]{6}, \sqrt[3]{6} \cdot \sqrt[3]{6}, \sqrt[3]{6} \cdot \left(\sqrt[3]{6} \cdot \sqrt[3]{6}\right)\right) \cdot \left(x1 \cdot x1\right)\right)} \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right)\]
  7. Simplified0.5

    \[\leadsto x1 + \left(\left(\left(\left(\left(\color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(x1, 3 \cdot x1, x2 \cdot 2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)} - 3, \frac{\left(\mathsf{fma}\left(x1, 3 \cdot x1, x2 \cdot 2\right) - x1\right) \cdot \left(x1 \cdot 2\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \left(x1 \cdot x1\right) \cdot \mathsf{fma}\left(4, \frac{\mathsf{fma}\left(x1, 3 \cdot x1, x2 \cdot 2\right) - x1}{\mathsf{fma}\left(x1, x1, 1\right)}, -6\right)\right)} + \mathsf{fma}\left(-\sqrt[3]{6}, \sqrt[3]{6} \cdot \sqrt[3]{6}, \sqrt[3]{6} \cdot \left(\sqrt[3]{6} \cdot \sqrt[3]{6}\right)\right) \cdot \left(x1 \cdot x1\right)\right) \cdot \left(x1 \cdot x1 + 1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + 3 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 - 2 \cdot x2\right) - x1}{x1 \cdot x1 + 1}\right)\]
  8. Simplified0.3

    \[\leadsto \color{blue}{x1 + \mathsf{fma}\left(3, \frac{\mathsf{fma}\left(3, x1 \cdot x1, -\mathsf{fma}\left(x2, 2, x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1 \cdot x1, \left(-6\right) + 6, \mathsf{fma}\left(\frac{\mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} - 3, \frac{\mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\frac{\mathsf{fma}\left(x1, x1, 1\right)}{x1 \cdot 2}}, \mathsf{fma}\left(4, \frac{\mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, -6\right) \cdot \left(x1 \cdot x1\right)\right)\right), \mathsf{fma}\left(x1 \cdot 3, \frac{x1 \cdot \mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, {x1}^{3}\right)\right) + x1\right)}\]
  9. Final simplification0.3

    \[\leadsto x1 + \mathsf{fma}\left(3, \frac{\mathsf{fma}\left(3, x1 \cdot x1, -\mathsf{fma}\left(x2, 2, x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, x1 + \mathsf{fma}\left(\mathsf{fma}\left(x1, x1, 1\right), \mathsf{fma}\left(x1 \cdot x1, \left(-6\right) + 6, \mathsf{fma}\left(\frac{\mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)} - 3, \frac{\mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\frac{\mathsf{fma}\left(x1, x1, 1\right)}{2 \cdot x1}}, \mathsf{fma}\left(4, \frac{\mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, -6\right) \cdot \left(x1 \cdot x1\right)\right)\right), \mathsf{fma}\left(x1 \cdot 3, \frac{x1 \cdot \mathsf{fma}\left(3, x1 \cdot x1, \mathsf{fma}\left(x2, 2, -x1\right)\right)}{\mathsf{fma}\left(x1, x1, 1\right)}, {x1}^{3}\right)\right)\right)\]

Reproduce

herbie shell --seed 2019196 +o rules:numerics
(FPCore (x1 x2)
  :name "Rosa's FloatVsDoubleBenchmark"
  (+ x1 (+ (+ (+ (+ (* (+ (* (* (* 2.0 x1) (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))) (- (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0)) 3.0)) (* (* x1 x1) (- (* 4.0 (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))) 6.0))) (+ (* x1 x1) 1.0)) (* (* (* 3.0 x1) x1) (/ (- (+ (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0)))) (* (* x1 x1) x1)) x1) (* 3.0 (/ (- (- (* (* 3.0 x1) x1) (* 2.0 x2)) x1) (+ (* x1 x1) 1.0))))))