Average Error: 0.2 → 0.2
Time: 25.1s
Precision: 64
\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
\[\sqrt{\mathsf{fma}\left(4, b \cdot b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4, b \cdot b, {\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(b \cdot b\right)\right) - 1
\sqrt{\mathsf{fma}\left(4, b \cdot b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4, b \cdot b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} - 1
double f(double a, double b) {
        double r9086981 = a;
        double r9086982 = r9086981 * r9086981;
        double r9086983 = b;
        double r9086984 = r9086983 * r9086983;
        double r9086985 = r9086982 + r9086984;
        double r9086986 = 2.0;
        double r9086987 = pow(r9086985, r9086986);
        double r9086988 = 4.0;
        double r9086989 = r9086988 * r9086984;
        double r9086990 = r9086987 + r9086989;
        double r9086991 = 1.0;
        double r9086992 = r9086990 - r9086991;
        return r9086992;
}

double f(double a, double b) {
        double r9086993 = 4.0;
        double r9086994 = b;
        double r9086995 = r9086994 * r9086994;
        double r9086996 = a;
        double r9086997 = fma(r9086996, r9086996, r9086995);
        double r9086998 = 2.0;
        double r9086999 = pow(r9086997, r9086998);
        double r9087000 = fma(r9086993, r9086995, r9086999);
        double r9087001 = sqrt(r9087000);
        double r9087002 = r9087001 * r9087001;
        double r9087003 = 1.0;
        double r9087004 = r9087002 - r9087003;
        return r9087004;
}

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(b \cdot b\right)\right) - 1\]
  2. Simplified0.2

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

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

Reproduce

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