Average Error: 0.2 → 0.0
Time: 13.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(1 - 3 \cdot a\right)\right)\right) - 1\]
\[\left(\left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) \cdot 4 + \mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, {\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right)}^{4}\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(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right) \cdot 4 + \mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, {\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right)}^{4}\right)\right) - 1
double f(double a, double b) {
        double r1815608 = a;
        double r1815609 = r1815608 * r1815608;
        double r1815610 = b;
        double r1815611 = r1815610 * r1815610;
        double r1815612 = r1815609 + r1815611;
        double r1815613 = 2.0;
        double r1815614 = pow(r1815612, r1815613);
        double r1815615 = 4.0;
        double r1815616 = 1.0;
        double r1815617 = r1815616 + r1815608;
        double r1815618 = r1815609 * r1815617;
        double r1815619 = 3.0;
        double r1815620 = r1815619 * r1815608;
        double r1815621 = r1815616 - r1815620;
        double r1815622 = r1815611 * r1815621;
        double r1815623 = r1815618 + r1815622;
        double r1815624 = r1815615 * r1815623;
        double r1815625 = r1815614 + r1815624;
        double r1815626 = r1815625 - r1815616;
        return r1815626;
}

double f(double a, double b) {
        double r1815627 = b;
        double r1815628 = r1815627 * r1815627;
        double r1815629 = 1.0;
        double r1815630 = 3.0;
        double r1815631 = a;
        double r1815632 = r1815630 * r1815631;
        double r1815633 = r1815629 - r1815632;
        double r1815634 = r1815628 * r1815633;
        double r1815635 = 4.0;
        double r1815636 = r1815634 * r1815635;
        double r1815637 = r1815631 * r1815631;
        double r1815638 = fma(r1815637, r1815631, r1815637);
        double r1815639 = fma(r1815627, r1815627, r1815637);
        double r1815640 = sqrt(r1815639);
        double r1815641 = pow(r1815640, r1815635);
        double r1815642 = fma(r1815638, r1815635, r1815641);
        double r1815643 = r1815636 + r1815642;
        double r1815644 = r1815643 - r1815629;
        return r1815644;
}

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 distribute-lft-in0.2

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

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

    \[\leadsto \left(\color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, \mathsf{fma}\left(b, b, a \cdot a\right) \cdot \mathsf{fma}\left(b, b, a \cdot a\right)\right)} + 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1\]
  6. Using strategy rm
  7. Applied add-sqr-sqrt0.2

    \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, \mathsf{fma}\left(b, b, a \cdot a\right) \cdot \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)} \cdot \sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right)}\right) + 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1\]
  8. Applied associate-*r*0.1

    \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, \color{blue}{\left(\mathsf{fma}\left(b, b, a \cdot a\right) \cdot \sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right) \cdot \sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}}\right) + 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1\]
  9. Using strategy rm
  10. Applied pow10.1

    \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, \left(\mathsf{fma}\left(b, b, a \cdot a\right) \cdot \sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right) \cdot \color{blue}{{\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right)}^{1}}\right) + 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1\]
  11. Applied add-sqr-sqrt0.1

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

    \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, a, a \cdot a\right), 4, \color{blue}{{\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right)}^{3}} \cdot {\left(\sqrt{\mathsf{fma}\left(b, b, a \cdot a\right)}\right)}^{1}\right) + 4 \cdot \left(\left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right)\right) - 1\]
  13. Applied pow-prod-up0.0

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

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

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

Reproduce

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