Average Error: 0.5 → 0.6
Time: 48.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)\]
\[\left(\left(\left(\left(\left(\left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} - 6\right) \cdot \left(x1 \cdot x1\right) + \left(\left(x1 \cdot 2\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + x2 \cdot 2\right) - x1}{1 + x1 \cdot x1}\right) \cdot \mathsf{fma}\left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + x2 \cdot 2\right) - x1}{{\left(x1 \cdot x1\right)}^{3} + 1}, \left(1 - x1 \cdot x1\right) + \left(x1 \cdot x1\right) \cdot \left(x1 \cdot x1\right), -3\right)\right) \cdot \left(1 + x1 \cdot x1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + x2 \cdot 2\right) - x1}{1 + x1 \cdot x1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + \frac{\left(\left(3 \cdot x1\right) \cdot x1 - x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} \cdot 3\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)
\left(\left(\left(\left(\left(\left(4 \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} - 6\right) \cdot \left(x1 \cdot x1\right) + \left(\left(x1 \cdot 2\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + x2 \cdot 2\right) - x1}{1 + x1 \cdot x1}\right) \cdot \mathsf{fma}\left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + x2 \cdot 2\right) - x1}{{\left(x1 \cdot x1\right)}^{3} + 1}, \left(1 - x1 \cdot x1\right) + \left(x1 \cdot x1\right) \cdot \left(x1 \cdot x1\right), -3\right)\right) \cdot \left(1 + x1 \cdot x1\right) + \left(\left(3 \cdot x1\right) \cdot x1\right) \cdot \frac{\left(\left(3 \cdot x1\right) \cdot x1 + x2 \cdot 2\right) - x1}{1 + x1 \cdot x1}\right) + \left(x1 \cdot x1\right) \cdot x1\right) + x1\right) + \frac{\left(\left(3 \cdot x1\right) \cdot x1 - x2 \cdot 2\right) - x1}{1 + x1 \cdot x1} \cdot 3\right) + x1
double f(double x1, double x2) {
        double r932953 = x1;
        double r932954 = 2.0;
        double r932955 = r932954 * r932953;
        double r932956 = 3.0;
        double r932957 = r932956 * r932953;
        double r932958 = r932957 * r932953;
        double r932959 = x2;
        double r932960 = r932954 * r932959;
        double r932961 = r932958 + r932960;
        double r932962 = r932961 - r932953;
        double r932963 = r932953 * r932953;
        double r932964 = 1.0;
        double r932965 = r932963 + r932964;
        double r932966 = r932962 / r932965;
        double r932967 = r932955 * r932966;
        double r932968 = r932966 - r932956;
        double r932969 = r932967 * r932968;
        double r932970 = 4.0;
        double r932971 = r932970 * r932966;
        double r932972 = 6.0;
        double r932973 = r932971 - r932972;
        double r932974 = r932963 * r932973;
        double r932975 = r932969 + r932974;
        double r932976 = r932975 * r932965;
        double r932977 = r932958 * r932966;
        double r932978 = r932976 + r932977;
        double r932979 = r932963 * r932953;
        double r932980 = r932978 + r932979;
        double r932981 = r932980 + r932953;
        double r932982 = r932958 - r932960;
        double r932983 = r932982 - r932953;
        double r932984 = r932983 / r932965;
        double r932985 = r932956 * r932984;
        double r932986 = r932981 + r932985;
        double r932987 = r932953 + r932986;
        return r932987;
}

double f(double x1, double x2) {
        double r932988 = 4.0;
        double r932989 = 3.0;
        double r932990 = x1;
        double r932991 = r932989 * r932990;
        double r932992 = r932991 * r932990;
        double r932993 = x2;
        double r932994 = 2.0;
        double r932995 = r932993 * r932994;
        double r932996 = r932992 + r932995;
        double r932997 = r932996 - r932990;
        double r932998 = 1.0;
        double r932999 = r932990 * r932990;
        double r933000 = r932998 + r932999;
        double r933001 = r932997 / r933000;
        double r933002 = r932988 * r933001;
        double r933003 = 6.0;
        double r933004 = r933002 - r933003;
        double r933005 = r933004 * r932999;
        double r933006 = r932990 * r932994;
        double r933007 = r933006 * r933001;
        double r933008 = pow(r932999, r932989);
        double r933009 = r933008 + r932998;
        double r933010 = r932997 / r933009;
        double r933011 = r932998 - r932999;
        double r933012 = r932999 * r932999;
        double r933013 = r933011 + r933012;
        double r933014 = -3.0;
        double r933015 = fma(r933010, r933013, r933014);
        double r933016 = r933007 * r933015;
        double r933017 = r933005 + r933016;
        double r933018 = r933017 * r933000;
        double r933019 = r932992 * r933001;
        double r933020 = r933018 + r933019;
        double r933021 = r932999 * r932990;
        double r933022 = r933020 + r933021;
        double r933023 = r933022 + r932990;
        double r933024 = r932992 - r932995;
        double r933025 = r933024 - r932990;
        double r933026 = r933025 / r933000;
        double r933027 = r933026 * r932989;
        double r933028 = r933023 + r933027;
        double r933029 = r933028 + r932990;
        return r933029;
}

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 flip3-+0.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}{\color{blue}{\frac{{\left(x1 \cdot x1\right)}^{3} + {1}^{3}}{\left(x1 \cdot x1\right) \cdot \left(x1 \cdot x1\right) + \left(1 \cdot 1 - \left(x1 \cdot x1\right) \cdot 1\right)}}} - 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)\]
  4. Applied associate-/r/0.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(\color{blue}{\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{{\left(x1 \cdot x1\right)}^{3} + {1}^{3}} \cdot \left(\left(x1 \cdot x1\right) \cdot \left(x1 \cdot x1\right) + \left(1 \cdot 1 - \left(x1 \cdot x1\right) \cdot 1\right)\right)} - 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)\]
  5. Applied fma-neg0.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 \color{blue}{\mathsf{fma}\left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{{\left(x1 \cdot x1\right)}^{3} + {1}^{3}}, \left(x1 \cdot x1\right) \cdot \left(x1 \cdot x1\right) + \left(1 \cdot 1 - \left(x1 \cdot x1\right) \cdot 1\right), -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)\]
  6. Simplified0.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 \mathsf{fma}\left(\frac{\left(\left(3 \cdot x1\right) \cdot x1 + 2 \cdot x2\right) - x1}{{\left(x1 \cdot x1\right)}^{3} + {1}^{3}}, \left(x1 \cdot x1\right) \cdot \left(x1 \cdot x1\right) + \left(1 \cdot 1 - \left(x1 \cdot x1\right) \cdot 1\right), \color{blue}{-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)\]
  7. Final simplification0.6

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

Reproduce

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