Average Error: 0.2 → 0.2
Time: 46.7s
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 r7364088 = a;
        double r7364089 = r7364088 * r7364088;
        double r7364090 = b;
        double r7364091 = r7364090 * r7364090;
        double r7364092 = r7364089 + r7364091;
        double r7364093 = 2.0;
        double r7364094 = pow(r7364092, r7364093);
        double r7364095 = 4.0;
        double r7364096 = r7364095 * r7364091;
        double r7364097 = r7364094 + r7364096;
        double r7364098 = 1.0;
        double r7364099 = r7364097 - r7364098;
        return r7364099;
}

double f(double a, double b) {
        double r7364100 = 4.0;
        double r7364101 = b;
        double r7364102 = r7364101 * r7364101;
        double r7364103 = a;
        double r7364104 = fma(r7364103, r7364103, r7364102);
        double r7364105 = 2.0;
        double r7364106 = pow(r7364104, r7364105);
        double r7364107 = fma(r7364100, r7364102, r7364106);
        double r7364108 = sqrt(r7364107);
        double r7364109 = r7364108 * r7364108;
        double r7364110 = 1.0;
        double r7364111 = r7364109 - r7364110;
        return r7364111;
}

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