Average Error: 0.5 → 0.3
Time: 4.0m
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)\]
\[(3 \cdot \left(\frac{x1 \cdot \left(x1 \cdot 3\right) - (2 \cdot x2 + x1)_*}{(x1 \cdot x1 + 1)_*}\right) + \left((x1 \cdot \left(x1 \cdot x1\right) + \left((\left(\frac{(x2 \cdot 2 + \left(x1 \cdot \left(x1 \cdot 3\right)\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right) \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right) + \left((x1 \cdot x1 + 1)_* \cdot (\left((\left(\frac{(x2 \cdot 2 + \left(x1 \cdot \left(x1 \cdot 3\right)\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right) \cdot 4 + -6)_*\right) \cdot \left(x1 \cdot x1\right) + \left(\left(\frac{(x2 \cdot 2 + \left(x1 \cdot \left(x1 \cdot 3\right)\right))_* - x1}{(x1 \cdot x1 + 1)_*} \cdot \left(2 \cdot x1\right)\right) \cdot (\left(\frac{1}{\sqrt{(x1 \cdot x1 + 1)_*}}\right) \cdot \left(\frac{(x2 \cdot 2 + \left(x1 \cdot \left(x1 \cdot 3\right)\right))_* - x1}{\sqrt{(x1 \cdot x1 + 1)_*}}\right) + -3)_*\right))_*\right))_*\right))_* + x1\right))_* + x1\]
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)
(3 \cdot \left(\frac{x1 \cdot \left(x1 \cdot 3\right) - (2 \cdot x2 + x1)_*}{(x1 \cdot x1 + 1)_*}\right) + \left((x1 \cdot \left(x1 \cdot x1\right) + \left((\left(\frac{(x2 \cdot 2 + \left(x1 \cdot \left(x1 \cdot 3\right)\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right) \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right) + \left((x1 \cdot x1 + 1)_* \cdot (\left((\left(\frac{(x2 \cdot 2 + \left(x1 \cdot \left(x1 \cdot 3\right)\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right) \cdot 4 + -6)_*\right) \cdot \left(x1 \cdot x1\right) + \left(\left(\frac{(x2 \cdot 2 + \left(x1 \cdot \left(x1 \cdot 3\right)\right))_* - x1}{(x1 \cdot x1 + 1)_*} \cdot \left(2 \cdot x1\right)\right) \cdot (\left(\frac{1}{\sqrt{(x1 \cdot x1 + 1)_*}}\right) \cdot \left(\frac{(x2 \cdot 2 + \left(x1 \cdot \left(x1 \cdot 3\right)\right))_* - x1}{\sqrt{(x1 \cdot x1 + 1)_*}}\right) + -3)_*\right))_*\right))_*\right))_* + x1\right))_* + x1
double f(double x1, double x2) {
        double r23617821 = x1;
        double r23617822 = 2.0;
        double r23617823 = r23617822 * r23617821;
        double r23617824 = 3.0;
        double r23617825 = r23617824 * r23617821;
        double r23617826 = r23617825 * r23617821;
        double r23617827 = x2;
        double r23617828 = r23617822 * r23617827;
        double r23617829 = r23617826 + r23617828;
        double r23617830 = r23617829 - r23617821;
        double r23617831 = r23617821 * r23617821;
        double r23617832 = 1.0;
        double r23617833 = r23617831 + r23617832;
        double r23617834 = r23617830 / r23617833;
        double r23617835 = r23617823 * r23617834;
        double r23617836 = r23617834 - r23617824;
        double r23617837 = r23617835 * r23617836;
        double r23617838 = 4.0;
        double r23617839 = r23617838 * r23617834;
        double r23617840 = 6.0;
        double r23617841 = r23617839 - r23617840;
        double r23617842 = r23617831 * r23617841;
        double r23617843 = r23617837 + r23617842;
        double r23617844 = r23617843 * r23617833;
        double r23617845 = r23617826 * r23617834;
        double r23617846 = r23617844 + r23617845;
        double r23617847 = r23617831 * r23617821;
        double r23617848 = r23617846 + r23617847;
        double r23617849 = r23617848 + r23617821;
        double r23617850 = r23617826 - r23617828;
        double r23617851 = r23617850 - r23617821;
        double r23617852 = r23617851 / r23617833;
        double r23617853 = r23617824 * r23617852;
        double r23617854 = r23617849 + r23617853;
        double r23617855 = r23617821 + r23617854;
        return r23617855;
}

double f(double x1, double x2) {
        double r23617856 = 3.0;
        double r23617857 = x1;
        double r23617858 = r23617857 * r23617856;
        double r23617859 = r23617857 * r23617858;
        double r23617860 = 2.0;
        double r23617861 = x2;
        double r23617862 = fma(r23617860, r23617861, r23617857);
        double r23617863 = r23617859 - r23617862;
        double r23617864 = 1.0;
        double r23617865 = fma(r23617857, r23617857, r23617864);
        double r23617866 = r23617863 / r23617865;
        double r23617867 = r23617857 * r23617857;
        double r23617868 = fma(r23617861, r23617860, r23617859);
        double r23617869 = r23617868 - r23617857;
        double r23617870 = r23617869 / r23617865;
        double r23617871 = 4.0;
        double r23617872 = -6.0;
        double r23617873 = fma(r23617870, r23617871, r23617872);
        double r23617874 = r23617860 * r23617857;
        double r23617875 = r23617870 * r23617874;
        double r23617876 = sqrt(r23617865);
        double r23617877 = r23617864 / r23617876;
        double r23617878 = r23617869 / r23617876;
        double r23617879 = -3.0;
        double r23617880 = fma(r23617877, r23617878, r23617879);
        double r23617881 = r23617875 * r23617880;
        double r23617882 = fma(r23617873, r23617867, r23617881);
        double r23617883 = r23617865 * r23617882;
        double r23617884 = fma(r23617870, r23617859, r23617883);
        double r23617885 = fma(r23617857, r23617867, r23617884);
        double r23617886 = r23617885 + r23617857;
        double r23617887 = fma(r23617856, r23617866, r23617886);
        double r23617888 = r23617887 + r23617857;
        return r23617888;
}

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. Simplified0.3

    \[\leadsto \color{blue}{x1 + (3 \cdot \left(\frac{\left(3 \cdot x1\right) \cdot x1 - (2 \cdot x2 + x1)_*}{(x1 \cdot x1 + 1)_*}\right) + \left((x1 \cdot \left(x1 \cdot x1\right) + \left((\left(\frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right) \cdot \left(\left(3 \cdot x1\right) \cdot x1\right) + \left((x1 \cdot x1 + 1)_* \cdot (\left((\left(\frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right) \cdot 4 + -6)_*\right) \cdot \left(x1 \cdot x1\right) + \left(\left(\frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{(x1 \cdot x1 + 1)_*} - 3\right) \cdot \left(\left(x1 \cdot 2\right) \cdot \frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right)\right))_*\right))_*\right))_* + x1\right))_*}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt0.3

    \[\leadsto x1 + (3 \cdot \left(\frac{\left(3 \cdot x1\right) \cdot x1 - (2 \cdot x2 + x1)_*}{(x1 \cdot x1 + 1)_*}\right) + \left((x1 \cdot \left(x1 \cdot x1\right) + \left((\left(\frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right) \cdot \left(\left(3 \cdot x1\right) \cdot x1\right) + \left((x1 \cdot x1 + 1)_* \cdot (\left((\left(\frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right) \cdot 4 + -6)_*\right) \cdot \left(x1 \cdot x1\right) + \left(\left(\frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{\color{blue}{\sqrt{(x1 \cdot x1 + 1)_*} \cdot \sqrt{(x1 \cdot x1 + 1)_*}}} - 3\right) \cdot \left(\left(x1 \cdot 2\right) \cdot \frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right)\right))_*\right))_*\right))_* + x1\right))_*\]
  5. Applied *-un-lft-identity0.3

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

    \[\leadsto x1 + (3 \cdot \left(\frac{\left(3 \cdot x1\right) \cdot x1 - (2 \cdot x2 + x1)_*}{(x1 \cdot x1 + 1)_*}\right) + \left((x1 \cdot \left(x1 \cdot x1\right) + \left((\left(\frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right) \cdot \left(\left(3 \cdot x1\right) \cdot x1\right) + \left((x1 \cdot x1 + 1)_* \cdot (\left((\left(\frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right) \cdot 4 + -6)_*\right) \cdot \left(x1 \cdot x1\right) + \left(\left(\color{blue}{\frac{1}{\sqrt{(x1 \cdot x1 + 1)_*}} \cdot \frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{\sqrt{(x1 \cdot x1 + 1)_*}}} - 3\right) \cdot \left(\left(x1 \cdot 2\right) \cdot \frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right)\right))_*\right))_*\right))_* + x1\right))_*\]
  7. Applied fma-neg0.3

    \[\leadsto x1 + (3 \cdot \left(\frac{\left(3 \cdot x1\right) \cdot x1 - (2 \cdot x2 + x1)_*}{(x1 \cdot x1 + 1)_*}\right) + \left((x1 \cdot \left(x1 \cdot x1\right) + \left((\left(\frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right) \cdot \left(\left(3 \cdot x1\right) \cdot x1\right) + \left((x1 \cdot x1 + 1)_* \cdot (\left((\left(\frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right) \cdot 4 + -6)_*\right) \cdot \left(x1 \cdot x1\right) + \left(\color{blue}{(\left(\frac{1}{\sqrt{(x1 \cdot x1 + 1)_*}}\right) \cdot \left(\frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{\sqrt{(x1 \cdot x1 + 1)_*}}\right) + \left(-3\right))_*} \cdot \left(\left(x1 \cdot 2\right) \cdot \frac{(x2 \cdot 2 + \left(\left(3 \cdot x1\right) \cdot x1\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right)\right))_*\right))_*\right))_* + x1\right))_*\]
  8. Final simplification0.3

    \[\leadsto (3 \cdot \left(\frac{x1 \cdot \left(x1 \cdot 3\right) - (2 \cdot x2 + x1)_*}{(x1 \cdot x1 + 1)_*}\right) + \left((x1 \cdot \left(x1 \cdot x1\right) + \left((\left(\frac{(x2 \cdot 2 + \left(x1 \cdot \left(x1 \cdot 3\right)\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right) \cdot \left(x1 \cdot \left(x1 \cdot 3\right)\right) + \left((x1 \cdot x1 + 1)_* \cdot (\left((\left(\frac{(x2 \cdot 2 + \left(x1 \cdot \left(x1 \cdot 3\right)\right))_* - x1}{(x1 \cdot x1 + 1)_*}\right) \cdot 4 + -6)_*\right) \cdot \left(x1 \cdot x1\right) + \left(\left(\frac{(x2 \cdot 2 + \left(x1 \cdot \left(x1 \cdot 3\right)\right))_* - x1}{(x1 \cdot x1 + 1)_*} \cdot \left(2 \cdot x1\right)\right) \cdot (\left(\frac{1}{\sqrt{(x1 \cdot x1 + 1)_*}}\right) \cdot \left(\frac{(x2 \cdot 2 + \left(x1 \cdot \left(x1 \cdot 3\right)\right))_* - x1}{\sqrt{(x1 \cdot x1 + 1)_*}}\right) + -3)_*\right))_*\right))_*\right))_* + x1\right))_* + x1\]

Reproduce

herbie shell --seed 2019104 +o rules:numerics
(FPCore (x1 x2)
  :name "Rosa's FloatVsDoubleBenchmark"
  (+ x1 (+ (+ (+ (+ (* (+ (* (* (* 2 x1) (/ (- (+ (* (* 3 x1) x1) (* 2 x2)) x1) (+ (* x1 x1) 1))) (- (/ (- (+ (* (* 3 x1) x1) (* 2 x2)) x1) (+ (* x1 x1) 1)) 3)) (* (* x1 x1) (- (* 4 (/ (- (+ (* (* 3 x1) x1) (* 2 x2)) x1) (+ (* x1 x1) 1))) 6))) (+ (* x1 x1) 1)) (* (* (* 3 x1) x1) (/ (- (+ (* (* 3 x1) x1) (* 2 x2)) x1) (+ (* x1 x1) 1)))) (* (* x1 x1) x1)) x1) (* 3 (/ (- (- (* (* 3 x1) x1) (* 2 x2)) x1) (+ (* x1 x1) 1))))))