Average Error: 0.2 → 0.0
Time: 15.2s
Precision: 64
\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
\[\mathsf{fma}\left(4 \cdot b, b, {1}^{2} \cdot {\left(\mathsf{hypot}\left(b, a\right)\right)}^{\left(2 \cdot 2\right)}\right) - 1\]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\mathsf{fma}\left(4 \cdot b, b, {1}^{2} \cdot {\left(\mathsf{hypot}\left(b, a\right)\right)}^{\left(2 \cdot 2\right)}\right) - 1
double f(double a, double b) {
        double r316278 = a;
        double r316279 = r316278 * r316278;
        double r316280 = b;
        double r316281 = r316280 * r316280;
        double r316282 = r316279 + r316281;
        double r316283 = 2.0;
        double r316284 = pow(r316282, r316283);
        double r316285 = 4.0;
        double r316286 = r316285 * r316281;
        double r316287 = r316284 + r316286;
        double r316288 = 1.0;
        double r316289 = r316287 - r316288;
        return r316289;
}

double f(double a, double b) {
        double r316290 = 4.0;
        double r316291 = b;
        double r316292 = r316290 * r316291;
        double r316293 = 1.0;
        double r316294 = 2.0;
        double r316295 = pow(r316293, r316294);
        double r316296 = a;
        double r316297 = hypot(r316291, r316296);
        double r316298 = 2.0;
        double r316299 = r316298 * r316294;
        double r316300 = pow(r316297, r316299);
        double r316301 = r316295 * r316300;
        double r316302 = fma(r316292, r316291, r316301);
        double r316303 = 1.0;
        double r316304 = r316302 - r316303;
        return r316304;
}

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

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

    \[\leadsto \mathsf{fma}\left(4 \cdot b, b, {\color{blue}{\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}}^{2}\right) - 1\]
  5. Applied unpow-prod-down0.2

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

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

    \[\leadsto \mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{hypot}\left(b, a\right)\right)}^{2} \cdot \color{blue}{{\left(\mathsf{hypot}\left(b, a\right)\right)}^{2}}\right) - 1\]
  8. Using strategy rm
  9. Applied *-un-lft-identity0.2

    \[\leadsto \mathsf{fma}\left(4 \cdot b, b, {\color{blue}{\left(1 \cdot \mathsf{hypot}\left(b, a\right)\right)}}^{2} \cdot {\left(\mathsf{hypot}\left(b, a\right)\right)}^{2}\right) - 1\]
  10. Applied unpow-prod-down0.2

    \[\leadsto \mathsf{fma}\left(4 \cdot b, b, \color{blue}{\left({1}^{2} \cdot {\left(\mathsf{hypot}\left(b, a\right)\right)}^{2}\right)} \cdot {\left(\mathsf{hypot}\left(b, a\right)\right)}^{2}\right) - 1\]
  11. Applied associate-*l*0.2

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

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

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

Reproduce

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