Average Error: 0.2 → 0.2
Time: 20.1s
Precision: 64
\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
\[\left(\left(b \cdot b\right) \cdot 4 + \mathsf{fma}\left(b \cdot b, b \cdot b, \left(a \cdot \mathsf{fma}\left(2, b \cdot b, a \cdot a\right)\right) \cdot a\right)\right) - 1\]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\left(\left(b \cdot b\right) \cdot 4 + \mathsf{fma}\left(b \cdot b, b \cdot b, \left(a \cdot \mathsf{fma}\left(2, b \cdot b, a \cdot a\right)\right) \cdot a\right)\right) - 1
double f(double a, double b) {
        double r9462888 = a;
        double r9462889 = r9462888 * r9462888;
        double r9462890 = b;
        double r9462891 = r9462890 * r9462890;
        double r9462892 = r9462889 + r9462891;
        double r9462893 = 2.0;
        double r9462894 = pow(r9462892, r9462893);
        double r9462895 = 4.0;
        double r9462896 = r9462895 * r9462891;
        double r9462897 = r9462894 + r9462896;
        double r9462898 = 1.0;
        double r9462899 = r9462897 - r9462898;
        return r9462899;
}

double f(double a, double b) {
        double r9462900 = b;
        double r9462901 = r9462900 * r9462900;
        double r9462902 = 4.0;
        double r9462903 = r9462901 * r9462902;
        double r9462904 = a;
        double r9462905 = 2.0;
        double r9462906 = r9462904 * r9462904;
        double r9462907 = fma(r9462905, r9462901, r9462906);
        double r9462908 = r9462904 * r9462907;
        double r9462909 = r9462908 * r9462904;
        double r9462910 = fma(r9462901, r9462901, r9462909);
        double r9462911 = r9462903 + r9462910;
        double r9462912 = 1.0;
        double r9462913 = r9462911 - r9462912;
        return r9462913;
}

Error

Bits error versus a

Bits error versus b

Derivation

  1. Initial program 0.2

    \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
  2. Taylor expanded around 0 0.0

    \[\leadsto \left(\color{blue}{\left({b}^{4} + \left(2 \cdot \left({a}^{2} \cdot {b}^{2}\right) + {a}^{4}\right)\right)} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
  3. Simplified0.2

    \[\leadsto \left(\color{blue}{\mathsf{fma}\left(b \cdot b, b \cdot b, \left(a \cdot a\right) \cdot \left(\left(b \cdot b\right) \cdot 2 + a \cdot a\right)\right)} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
  4. Using strategy rm
  5. Applied associate-*l*0.2

    \[\leadsto \left(\mathsf{fma}\left(b \cdot b, b \cdot b, \color{blue}{a \cdot \left(a \cdot \left(\left(b \cdot b\right) \cdot 2 + a \cdot a\right)\right)}\right) + 4 \cdot \left(b \cdot b\right)\right) - 1\]
  6. Simplified0.2

    \[\leadsto \left(\mathsf{fma}\left(b \cdot b, b \cdot b, a \cdot \color{blue}{\left(a \cdot \mathsf{fma}\left(2, b \cdot b, a \cdot a\right)\right)}\right) + 4 \cdot \left(b \cdot b\right)\right) - 1\]
  7. Final simplification0.2

    \[\leadsto \left(\left(b \cdot b\right) \cdot 4 + \mathsf{fma}\left(b \cdot b, b \cdot b, \left(a \cdot \mathsf{fma}\left(2, b \cdot b, a \cdot a\right)\right) \cdot a\right)\right) - 1\]

Reproduce

herbie shell --seed 2019164 +o rules:numerics
(FPCore (a b)
  :name "Bouland and Aaronson, Equation (26)"
  (- (+ (pow (+ (* a a) (* b b)) 2) (* 4 (* b b))) 1))