Average Error: 0.2 → 0.2
Time: 26.4s
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\]
\[\sqrt{\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)} \cdot \sqrt{\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\]
\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
\sqrt{\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)} \cdot \sqrt{\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
double f(double a, double b) {
        double r103445 = a;
        double r103446 = r103445 * r103445;
        double r103447 = b;
        double r103448 = r103447 * r103447;
        double r103449 = r103446 + r103448;
        double r103450 = 2.0;
        double r103451 = pow(r103449, r103450);
        double r103452 = 4.0;
        double r103453 = 1.0;
        double r103454 = r103453 + r103445;
        double r103455 = r103446 * r103454;
        double r103456 = 3.0;
        double r103457 = r103456 * r103445;
        double r103458 = r103453 - r103457;
        double r103459 = r103448 * r103458;
        double r103460 = r103455 + r103459;
        double r103461 = r103452 * r103460;
        double r103462 = r103451 + r103461;
        double r103463 = r103462 - r103453;
        return r103463;
}

double f(double a, double b) {
        double r103464 = 4.0;
        double r103465 = a;
        double r103466 = r103465 * r103465;
        double r103467 = 1.0;
        double r103468 = r103467 + r103465;
        double r103469 = b;
        double r103470 = r103469 * r103469;
        double r103471 = 3.0;
        double r103472 = r103471 * r103465;
        double r103473 = r103467 - r103472;
        double r103474 = r103470 * r103473;
        double r103475 = fma(r103466, r103468, r103474);
        double r103476 = fma(r103465, r103465, r103470);
        double r103477 = 2.0;
        double r103478 = pow(r103476, r103477);
        double r103479 = fma(r103464, r103475, r103478);
        double r103480 = sqrt(r103479);
        double r103481 = r103480 * r103480;
        double r103482 = r103481 - r103467;
        return r103482;
}

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. Using strategy rm
  4. Applied add-sqr-sqrt0.2

    \[\leadsto \color{blue}{\sqrt{\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)} \cdot \sqrt{\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\]
  5. Final simplification0.2

    \[\leadsto \sqrt{\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)} \cdot \sqrt{\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\]

Reproduce

herbie shell --seed 2019323 +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))