Average Error: 0.2 → 0.0
Time: 14.2s
Precision: 64
\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1\]
\[\left(\left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) \cdot 4 + \mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, {\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right)}^{4}\right)\right) - 1\]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1
\left(\left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) \cdot 4 + \mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, {\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right)}^{4}\right)\right) - 1
double f(double a, double b) {
        double r2948049 = a;
        double r2948050 = r2948049 * r2948049;
        double r2948051 = b;
        double r2948052 = r2948051 * r2948051;
        double r2948053 = r2948050 + r2948052;
        double r2948054 = 2.0;
        double r2948055 = pow(r2948053, r2948054);
        double r2948056 = 4.0;
        double r2948057 = 1.0;
        double r2948058 = r2948057 + r2948049;
        double r2948059 = r2948050 * r2948058;
        double r2948060 = 3.0;
        double r2948061 = r2948060 * r2948049;
        double r2948062 = r2948057 - r2948061;
        double r2948063 = r2948052 * r2948062;
        double r2948064 = r2948059 + r2948063;
        double r2948065 = r2948056 * r2948064;
        double r2948066 = r2948055 + r2948065;
        double r2948067 = r2948066 - r2948057;
        return r2948067;
}

double f(double a, double b) {
        double r2948068 = b;
        double r2948069 = r2948068 * r2948068;
        double r2948070 = 1.0;
        double r2948071 = 3.0;
        double r2948072 = a;
        double r2948073 = r2948071 * r2948072;
        double r2948074 = r2948070 - r2948073;
        double r2948075 = r2948069 * r2948074;
        double r2948076 = 4.0;
        double r2948077 = r2948075 * r2948076;
        double r2948078 = r2948072 * r2948072;
        double r2948079 = fma(r2948078, r2948072, r2948078);
        double r2948080 = fma(r2948068, r2948068, r2948078);
        double r2948081 = sqrt(r2948080);
        double r2948082 = pow(r2948081, r2948076);
        double r2948083 = fma(r2948079, r2948076, r2948082);
        double r2948084 = r2948077 + r2948083;
        double r2948085 = r2948084 - r2948070;
        return r2948085;
}

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(\left(a \cdot a\right) \cdot \left(1 + a\right) + \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1\]
  2. Using strategy rm
  3. Applied distribute-rgt-in0.2

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

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

    \[\leadsto \left(\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, \mathsf{fma}\left(b, b, a \cdot a\right) \cdot \mathsf{fma}\left(b, b, a \cdot a\right)\right)} + \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) \cdot 4\right) - 1\]
  6. Using strategy rm
  7. Applied add-sqr-sqrt0.2

    \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)} \cdot \sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right)} \cdot \mathsf{fma}\left(b, b, a \cdot a\right)\right) + \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) \cdot 4\right) - 1\]
  8. Applied associate-*l*0.1

    \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, \color{blue}{\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)} \cdot \left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)} \cdot \mathsf{fma}\left(b, b, a \cdot a\right)\right)}\right) + \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) \cdot 4\right) - 1\]
  9. Using strategy rm
  10. Applied add-sqr-sqrt0.1

    \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, \sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)} \cdot \left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)} \cdot \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)} \cdot \sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right)}\right)\right) + \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) \cdot 4\right) - 1\]
  11. Applied cube-unmult0.1

    \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, \sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)} \cdot \color{blue}{{\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right)}^{3}}\right) + \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) \cdot 4\right) - 1\]
  12. Applied pow10.1

    \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, \color{blue}{{\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right)}^{1}} \cdot {\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right)}^{3}\right) + \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) \cdot 4\right) - 1\]
  13. Applied pow-prod-up0.0

    \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, \color{blue}{{\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right)}^{\left(1 + 3\right)}}\right) + \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) \cdot 4\right) - 1\]
  14. Simplified0.0

    \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, {\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right)}^{\color{blue}{4}}\right) + \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) \cdot 4\right) - 1\]
  15. Final simplification0.0

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

Reproduce

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