Average Error: 0.2 → 0.0
Time: 14.5s
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, {\left(\mathsf{hypot}\left(b, a\right)\right)}^{\left(2 + 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, {\left(\mathsf{hypot}\left(b, a\right)\right)}^{\left(2 + 2\right)}\right) - 1
double f(double a, double b) {
        double r227358 = a;
        double r227359 = r227358 * r227358;
        double r227360 = b;
        double r227361 = r227360 * r227360;
        double r227362 = r227359 + r227361;
        double r227363 = 2.0;
        double r227364 = pow(r227362, r227363);
        double r227365 = 4.0;
        double r227366 = r227365 * r227361;
        double r227367 = r227364 + r227366;
        double r227368 = 1.0;
        double r227369 = r227367 - r227368;
        return r227369;
}

double f(double a, double b) {
        double r227370 = 4.0;
        double r227371 = b;
        double r227372 = r227370 * r227371;
        double r227373 = a;
        double r227374 = hypot(r227371, r227373);
        double r227375 = 2.0;
        double r227376 = r227375 + r227375;
        double r227377 = pow(r227374, r227376);
        double r227378 = fma(r227372, r227371, r227377);
        double r227379 = 1.0;
        double r227380 = r227378 - r227379;
        return r227380;
}

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

    \[\leadsto \mathsf{fma}\left(4 \cdot b, b, {\left(\color{blue}{\mathsf{hypot}\left(b, a\right)} \cdot \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, {\left(\mathsf{hypot}\left(b, a\right) \cdot \color{blue}{\mathsf{hypot}\left(b, a\right)}\right)}^{2}\right) - 1\]
  7. Using strategy rm
  8. Applied pow10.2

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

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

    \[\leadsto \mathsf{fma}\left(4 \cdot b, b, {\color{blue}{\left({\left(\mathsf{hypot}\left(b, a\right)\right)}^{\left(1 + 1\right)}\right)}}^{2}\right) - 1\]
  11. Applied pow-pow0.0

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

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

    \[\leadsto \mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{hypot}\left(b, a\right)\right)}^{\left(2 + 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))