Average Error: 0.2 → 0.0
Time: 11.1s
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(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)} + 4 \cdot \left(\mathsf{fma}\left(1, \mathsf{fma}\left(a, a, b \cdot b\right), {a}^{3}\right) + \left(-3 \cdot a\right) \cdot \left(b \cdot b\right)\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(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)} + 4 \cdot \left(\mathsf{fma}\left(1, \mathsf{fma}\left(a, a, b \cdot b\right), {a}^{3}\right) + \left(-3 \cdot a\right) \cdot \left(b \cdot b\right)\right)\right) - 1
double f(double a, double b) {
        double r277427 = a;
        double r277428 = r277427 * r277427;
        double r277429 = b;
        double r277430 = r277429 * r277429;
        double r277431 = r277428 + r277430;
        double r277432 = 2.0;
        double r277433 = pow(r277431, r277432);
        double r277434 = 4.0;
        double r277435 = 1.0;
        double r277436 = r277435 + r277427;
        double r277437 = r277428 * r277436;
        double r277438 = 3.0;
        double r277439 = r277438 * r277427;
        double r277440 = r277435 - r277439;
        double r277441 = r277430 * r277440;
        double r277442 = r277437 + r277441;
        double r277443 = r277434 * r277442;
        double r277444 = r277433 + r277443;
        double r277445 = r277444 - r277435;
        return r277445;
}

double f(double a, double b) {
        double r277446 = a;
        double r277447 = b;
        double r277448 = hypot(r277446, r277447);
        double r277449 = 2.0;
        double r277450 = 2.0;
        double r277451 = r277449 * r277450;
        double r277452 = pow(r277448, r277451);
        double r277453 = 4.0;
        double r277454 = 1.0;
        double r277455 = r277447 * r277447;
        double r277456 = fma(r277446, r277446, r277455);
        double r277457 = 3.0;
        double r277458 = pow(r277446, r277457);
        double r277459 = fma(r277454, r277456, r277458);
        double r277460 = 3.0;
        double r277461 = r277460 * r277446;
        double r277462 = -r277461;
        double r277463 = r277462 * r277455;
        double r277464 = r277459 + r277463;
        double r277465 = r277453 * r277464;
        double r277466 = r277452 + r277465;
        double r277467 = r277466 - r277454;
        return r277467;
}

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 add-sqr-sqrt0.2

    \[\leadsto \left({\color{blue}{\left(\sqrt{a \cdot a + b \cdot b} \cdot \sqrt{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\]
  4. Applied unpow-prod-down0.2

    \[\leadsto \left(\color{blue}{{\left(\sqrt{a \cdot a + b \cdot b}\right)}^{2} \cdot {\left(\sqrt{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\]
  5. Applied fma-def0.2

    \[\leadsto \color{blue}{\mathsf{fma}\left({\left(\sqrt{a \cdot a + b \cdot b}\right)}^{2}, {\left(\sqrt{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\]
  6. Using strategy rm
  7. Applied fma-udef0.2

    \[\leadsto \color{blue}{\left({\left(\sqrt{a \cdot a + b \cdot b}\right)}^{2} \cdot {\left(\sqrt{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\]
  8. Simplified0.0

    \[\leadsto \left(\color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)}} + 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\]
  9. Using strategy rm
  10. Applied sub-neg0.0

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

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

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

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

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

Reproduce

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