Average Error: 0.2 → 0.2
Time: 29.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(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 r191716 = a;
        double r191717 = r191716 * r191716;
        double r191718 = b;
        double r191719 = r191718 * r191718;
        double r191720 = r191717 + r191719;
        double r191721 = 2.0;
        double r191722 = pow(r191720, r191721);
        double r191723 = 4.0;
        double r191724 = 1.0;
        double r191725 = r191724 + r191716;
        double r191726 = r191717 * r191725;
        double r191727 = 3.0;
        double r191728 = r191727 * r191716;
        double r191729 = r191724 - r191728;
        double r191730 = r191719 * r191729;
        double r191731 = r191726 + r191730;
        double r191732 = r191723 * r191731;
        double r191733 = r191722 + r191732;
        double r191734 = r191733 - r191724;
        return r191734;
}

double f(double a, double b) {
        double r191735 = 4.0;
        double r191736 = a;
        double r191737 = r191736 * r191736;
        double r191738 = 1.0;
        double r191739 = r191738 + r191736;
        double r191740 = b;
        double r191741 = r191740 * r191740;
        double r191742 = 3.0;
        double r191743 = r191742 * r191736;
        double r191744 = r191738 - r191743;
        double r191745 = r191741 * r191744;
        double r191746 = fma(r191737, r191739, r191745);
        double r191747 = fma(r191736, r191736, r191741);
        double r191748 = 2.0;
        double r191749 = pow(r191747, r191748);
        double r191750 = fma(r191735, r191746, r191749);
        double r191751 = sqrt(r191750);
        double r191752 = r191751 * r191751;
        double r191753 = r191752 - r191738;
        return r191753;
}

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))