Average Error: 0.2 → 0.2
Time: 29.3s
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(3 + a\right)\right)\right) - 1\]
\[\sqrt{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, {\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(3 + a\right)\right)\right) - 1
\sqrt{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} - 1
double f(double a, double b) {
        double r197528 = a;
        double r197529 = r197528 * r197528;
        double r197530 = b;
        double r197531 = r197530 * r197530;
        double r197532 = r197529 + r197531;
        double r197533 = 2.0;
        double r197534 = pow(r197532, r197533);
        double r197535 = 4.0;
        double r197536 = 1.0;
        double r197537 = r197536 - r197528;
        double r197538 = r197529 * r197537;
        double r197539 = 3.0;
        double r197540 = r197539 + r197528;
        double r197541 = r197531 * r197540;
        double r197542 = r197538 + r197541;
        double r197543 = r197535 * r197542;
        double r197544 = r197534 + r197543;
        double r197545 = r197544 - r197536;
        return r197545;
}

double f(double a, double b) {
        double r197546 = a;
        double r197547 = r197546 * r197546;
        double r197548 = 1.0;
        double r197549 = r197548 - r197546;
        double r197550 = b;
        double r197551 = r197550 * r197550;
        double r197552 = 3.0;
        double r197553 = r197552 + r197546;
        double r197554 = r197551 * r197553;
        double r197555 = fma(r197547, r197549, r197554);
        double r197556 = 4.0;
        double r197557 = fma(r197546, r197546, r197551);
        double r197558 = 2.0;
        double r197559 = pow(r197557, r197558);
        double r197560 = fma(r197555, r197556, r197559);
        double r197561 = sqrt(r197560);
        double r197562 = r197561 * r197561;
        double r197563 = r197562 - r197548;
        return r197563;
}

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(3 + a\right)\right)\right) - 1\]
  2. Simplified0.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, {\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(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)}} - 1\]
  5. Final simplification0.2

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

Reproduce

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