Average Error: 0.2 → 0.2
Time: 14.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\]
\[\mathsf{fma}\left(4, \mathsf{fma}\left(1, \mathsf{fma}\left(a, a, b \cdot b\right), {a}^{3}\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\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
\mathsf{fma}\left(4, \mathsf{fma}\left(1, \mathsf{fma}\left(a, a, b \cdot b\right), {a}^{3}\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right) - 1
double f(double a, double b) {
        double r132455 = a;
        double r132456 = r132455 * r132455;
        double r132457 = b;
        double r132458 = r132457 * r132457;
        double r132459 = r132456 + r132458;
        double r132460 = 2.0;
        double r132461 = pow(r132459, r132460);
        double r132462 = 4.0;
        double r132463 = 1.0;
        double r132464 = r132463 + r132455;
        double r132465 = r132456 * r132464;
        double r132466 = 3.0;
        double r132467 = r132466 * r132455;
        double r132468 = r132463 - r132467;
        double r132469 = r132458 * r132468;
        double r132470 = r132465 + r132469;
        double r132471 = r132462 * r132470;
        double r132472 = r132461 + r132471;
        double r132473 = r132472 - r132463;
        return r132473;
}

double f(double a, double b) {
        double r132474 = 4.0;
        double r132475 = 1.0;
        double r132476 = a;
        double r132477 = b;
        double r132478 = r132477 * r132477;
        double r132479 = fma(r132476, r132476, r132478);
        double r132480 = 3.0;
        double r132481 = pow(r132476, r132480);
        double r132482 = fma(r132475, r132479, r132481);
        double r132483 = 2.0;
        double r132484 = pow(r132479, r132483);
        double r132485 = fma(r132474, r132482, r132484);
        double r132486 = r132485 - r132475;
        return r132486;
}

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(4, \mathsf{fma}\left(a \cdot a, 1 + a, \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right) - 1}\]
  3. Taylor expanded around 0 0.2

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

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

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