Average Error: 0.2 → 0.0
Time: 18.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(3 + a\right)\right)\right) - 1\]
\[\left({\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}^{4} + \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right) \cdot 4\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
\left({\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}^{4} + \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right) \cdot 4\right) - 1
double f(double a, double b) {
        double r8940205 = a;
        double r8940206 = r8940205 * r8940205;
        double r8940207 = b;
        double r8940208 = r8940207 * r8940207;
        double r8940209 = r8940206 + r8940208;
        double r8940210 = 2.0;
        double r8940211 = pow(r8940209, r8940210);
        double r8940212 = 4.0;
        double r8940213 = 1.0;
        double r8940214 = r8940213 - r8940205;
        double r8940215 = r8940206 * r8940214;
        double r8940216 = 3.0;
        double r8940217 = r8940216 + r8940205;
        double r8940218 = r8940208 * r8940217;
        double r8940219 = r8940215 + r8940218;
        double r8940220 = r8940212 * r8940219;
        double r8940221 = r8940211 + r8940220;
        double r8940222 = r8940221 - r8940213;
        return r8940222;
}

double f(double a, double b) {
        double r8940223 = a;
        double r8940224 = b;
        double r8940225 = r8940224 * r8940224;
        double r8940226 = fma(r8940223, r8940223, r8940225);
        double r8940227 = sqrt(r8940226);
        double r8940228 = 4.0;
        double r8940229 = pow(r8940227, r8940228);
        double r8940230 = r8940223 * r8940223;
        double r8940231 = 1.0;
        double r8940232 = r8940231 - r8940223;
        double r8940233 = r8940230 * r8940232;
        double r8940234 = 3.0;
        double r8940235 = r8940234 + r8940223;
        double r8940236 = r8940225 * r8940235;
        double r8940237 = r8940233 + r8940236;
        double r8940238 = r8940237 * r8940228;
        double r8940239 = r8940229 + r8940238;
        double r8940240 = r8940239 - r8940231;
        return r8940240;
}

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. Using strategy rm
  3. Applied *-un-lft-identity0.2

    \[\leadsto \left({\color{blue}{\left(1 \cdot \left(a \cdot a + b \cdot b\right)\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\]
  4. Applied unpow-prod-down0.2

    \[\leadsto \left(\color{blue}{{1}^{2} \cdot {\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\]
  5. Simplified0.2

    \[\leadsto \left(\color{blue}{1} \cdot {\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\]
  6. Simplified0.2

    \[\leadsto \left(1 \cdot \color{blue}{\left(\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \mathsf{fma}\left(a, a, b \cdot b\right)\right)} + 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\]
  7. Using strategy rm
  8. Applied add-sqr-sqrt0.2

    \[\leadsto \left(1 \cdot \left(\color{blue}{\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)} \cdot \mathsf{fma}\left(a, a, b \cdot b\right)\right) + 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\]
  9. Applied associate-*l*0.1

    \[\leadsto \left(1 \cdot \color{blue}{\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \mathsf{fma}\left(a, a, b \cdot b\right)\right)\right)} + 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\]
  10. Using strategy rm
  11. Applied add-sqr-sqrt0.1

    \[\leadsto \left(1 \cdot \left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \color{blue}{\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}\right)\right) + 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\]
  12. Applied cube-unmult0.1

    \[\leadsto \left(1 \cdot \left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \color{blue}{{\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}^{3}}\right) + 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\]
  13. Applied pow10.1

    \[\leadsto \left(1 \cdot \left(\color{blue}{{\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}^{1}} \cdot {\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}^{3}\right) + 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\]
  14. Applied pow-prod-up0.0

    \[\leadsto \left(1 \cdot \color{blue}{{\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}^{\left(1 + 3\right)}} + 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\]
  15. Simplified0.0

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

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

Reproduce

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