Average Error: 0.2 → 0.0
Time: 20.7s
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 r7722945 = a;
        double r7722946 = r7722945 * r7722945;
        double r7722947 = b;
        double r7722948 = r7722947 * r7722947;
        double r7722949 = r7722946 + r7722948;
        double r7722950 = 2.0;
        double r7722951 = pow(r7722949, r7722950);
        double r7722952 = 4.0;
        double r7722953 = 1.0;
        double r7722954 = r7722953 - r7722945;
        double r7722955 = r7722946 * r7722954;
        double r7722956 = 3.0;
        double r7722957 = r7722956 + r7722945;
        double r7722958 = r7722948 * r7722957;
        double r7722959 = r7722955 + r7722958;
        double r7722960 = r7722952 * r7722959;
        double r7722961 = r7722951 + r7722960;
        double r7722962 = r7722961 - r7722953;
        return r7722962;
}

double f(double a, double b) {
        double r7722963 = a;
        double r7722964 = b;
        double r7722965 = r7722964 * r7722964;
        double r7722966 = fma(r7722963, r7722963, r7722965);
        double r7722967 = sqrt(r7722966);
        double r7722968 = 4.0;
        double r7722969 = pow(r7722967, r7722968);
        double r7722970 = r7722963 * r7722963;
        double r7722971 = 1.0;
        double r7722972 = r7722971 - r7722963;
        double r7722973 = r7722970 * r7722972;
        double r7722974 = 3.0;
        double r7722975 = r7722974 + r7722963;
        double r7722976 = r7722965 * r7722975;
        double r7722977 = r7722973 + r7722976;
        double r7722978 = r7722977 * r7722968;
        double r7722979 = r7722969 + r7722978;
        double r7722980 = r7722979 - r7722971;
        return r7722980;
}

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