Average Error: 0.2 → 0.2
Time: 24.5s
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(3, b \cdot b, a \cdot \mathsf{fma}\left(1 - a, a, b \cdot b\right)\right), 4, {\left(\mathsf{fma}\left(b, b, a \cdot a\right)\right)}^{2}\right)} \cdot \left|\sqrt{\mathsf{fma}\left(\mathsf{fma}\left(3, b \cdot b, a \cdot \mathsf{fma}\left(1 - a, a, b \cdot b\right)\right), 4, {\left(\mathsf{fma}\left(b, b, a \cdot a\right)\right)}^{2}\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(3 + a\right)\right)\right) - 1
\sqrt{\mathsf{fma}\left(\mathsf{fma}\left(3, b \cdot b, a \cdot \mathsf{fma}\left(1 - a, a, b \cdot b\right)\right), 4, {\left(\mathsf{fma}\left(b, b, a \cdot a\right)\right)}^{2}\right)} \cdot \left|\sqrt{\mathsf{fma}\left(\mathsf{fma}\left(3, b \cdot b, a \cdot \mathsf{fma}\left(1 - a, a, b \cdot b\right)\right), 4, {\left(\mathsf{fma}\left(b, b, a \cdot a\right)\right)}^{2}\right)}\right| - 1
double f(double a, double b) {
        double r12943650 = a;
        double r12943651 = r12943650 * r12943650;
        double r12943652 = b;
        double r12943653 = r12943652 * r12943652;
        double r12943654 = r12943651 + r12943653;
        double r12943655 = 2.0;
        double r12943656 = pow(r12943654, r12943655);
        double r12943657 = 4.0;
        double r12943658 = 1.0;
        double r12943659 = r12943658 - r12943650;
        double r12943660 = r12943651 * r12943659;
        double r12943661 = 3.0;
        double r12943662 = r12943661 + r12943650;
        double r12943663 = r12943653 * r12943662;
        double r12943664 = r12943660 + r12943663;
        double r12943665 = r12943657 * r12943664;
        double r12943666 = r12943656 + r12943665;
        double r12943667 = r12943666 - r12943658;
        return r12943667;
}

double f(double a, double b) {
        double r12943668 = 3.0;
        double r12943669 = b;
        double r12943670 = r12943669 * r12943669;
        double r12943671 = a;
        double r12943672 = 1.0;
        double r12943673 = r12943672 - r12943671;
        double r12943674 = fma(r12943673, r12943671, r12943670);
        double r12943675 = r12943671 * r12943674;
        double r12943676 = fma(r12943668, r12943670, r12943675);
        double r12943677 = 4.0;
        double r12943678 = r12943671 * r12943671;
        double r12943679 = fma(r12943669, r12943669, r12943678);
        double r12943680 = 2.0;
        double r12943681 = pow(r12943679, r12943680);
        double r12943682 = fma(r12943676, r12943677, r12943681);
        double r12943683 = sqrt(r12943682);
        double r12943684 = fabs(r12943683);
        double r12943685 = r12943683 * r12943684;
        double r12943686 = r12943685 - r12943672;
        return r12943686;
}

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(3, b \cdot b, a \cdot \mathsf{fma}\left(1 - a, a, b \cdot b\right)\right), 4, {\left(\mathsf{fma}\left(b, b, a \cdot a\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(3, b \cdot b, a \cdot \mathsf{fma}\left(1 - a, a, b \cdot b\right)\right), 4, {\left(\mathsf{fma}\left(b, b, a \cdot a\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(3, b \cdot b, a \cdot \mathsf{fma}\left(1 - a, a, b \cdot b\right)\right), 4, {\left(\mathsf{fma}\left(b, b, a \cdot a\right)\right)}^{2}\right)}} - 1\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt0.2

    \[\leadsto \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(3, b \cdot b, a \cdot \mathsf{fma}\left(1 - a, a, b \cdot b\right)\right), 4, {\left(\mathsf{fma}\left(b, b, a \cdot a\right)\right)}^{2}\right)} \cdot \sqrt{\color{blue}{\sqrt{\mathsf{fma}\left(\mathsf{fma}\left(3, b \cdot b, a \cdot \mathsf{fma}\left(1 - a, a, b \cdot b\right)\right), 4, {\left(\mathsf{fma}\left(b, b, a \cdot a\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(\mathsf{fma}\left(3, b \cdot b, a \cdot \mathsf{fma}\left(1 - a, a, b \cdot b\right)\right), 4, {\left(\mathsf{fma}\left(b, b, a \cdot a\right)\right)}^{2}\right)}}} - 1\]
  7. Applied rem-sqrt-square0.2

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

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

Reproduce

herbie shell --seed 2019169 +o rules:numerics
(FPCore (a b)
  :name "Bouland and Aaronson, Equation (24)"
  (- (+ (pow (+ (* a a) (* b b)) 2.0) (* 4.0 (+ (* (* a a) (- 1.0 a)) (* (* b b) (+ 3.0 a))))) 1.0))