Average Error: 0.2 → 0.1
Time: 20.2s
Precision: 64
\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
\[\sqrt{\sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)}} \cdot \left(\sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)}\right)} \cdot \sqrt{\sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)}}\right) - 1\]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\sqrt{\sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)}} \cdot \left(\sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)}\right)} \cdot \sqrt{\sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)}}\right) - 1
double f(double a, double b) {
        double r245943 = a;
        double r245944 = r245943 * r245943;
        double r245945 = b;
        double r245946 = r245945 * r245945;
        double r245947 = r245944 + r245946;
        double r245948 = 2.0;
        double r245949 = pow(r245947, r245948);
        double r245950 = 4.0;
        double r245951 = r245950 * r245946;
        double r245952 = r245949 + r245951;
        double r245953 = 1.0;
        double r245954 = r245952 - r245953;
        return r245954;
}

double f(double a, double b) {
        double r245955 = 4.0;
        double r245956 = b;
        double r245957 = r245955 * r245956;
        double r245958 = a;
        double r245959 = r245956 * r245956;
        double r245960 = fma(r245958, r245958, r245959);
        double r245961 = 2.0;
        double r245962 = pow(r245960, r245961);
        double r245963 = fma(r245957, r245956, r245962);
        double r245964 = sqrt(r245963);
        double r245965 = sqrt(r245964);
        double r245966 = hypot(r245958, r245956);
        double r245967 = 2.0;
        double r245968 = r245967 * r245961;
        double r245969 = pow(r245966, r245968);
        double r245970 = fma(r245957, r245956, r245969);
        double r245971 = sqrt(r245970);
        double r245972 = r245971 * r245965;
        double r245973 = r245965 * r245972;
        double r245974 = 1.0;
        double r245975 = r245973 - r245974;
        return r245975;
}

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 \cdot b, 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 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)}} - 1\]
  5. Using strategy rm
  6. Applied add-sqr-sqrt0.2

    \[\leadsto \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\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)}}^{2}\right)} - 1\]
  7. Applied unpow-prod-down0.2

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

    \[\leadsto \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4 \cdot b, b, \color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}} \cdot {\left(\sqrt{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}^{2}\right)} - 1\]
  9. Simplified0.2

    \[\leadsto \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot \color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}}\right)} - 1\]
  10. Using strategy rm
  11. Applied *-un-lft-identity0.2

    \[\leadsto \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\color{blue}{\left(1 \cdot \mathsf{hypot}\left(a, b\right)\right)}}^{2}\right)} - 1\]
  12. Applied unpow-prod-down0.2

    \[\leadsto \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot \color{blue}{\left({1}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}\right)} - 1\]
  13. Applied *-un-lft-identity0.2

    \[\leadsto \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\color{blue}{\left(1 \cdot \mathsf{hypot}\left(a, b\right)\right)}}^{2} \cdot \left({1}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)\right)} - 1\]
  14. Applied unpow-prod-down0.2

    \[\leadsto \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4 \cdot b, b, \color{blue}{\left({1}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)} \cdot \left({1}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)\right)} - 1\]
  15. Applied swap-sqr0.2

    \[\leadsto \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4 \cdot b, b, \color{blue}{\left({1}^{2} \cdot {1}^{2}\right) \cdot \left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)}\right)} - 1\]
  16. Simplified0.2

    \[\leadsto \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4 \cdot b, b, \color{blue}{1} \cdot \left({\left(\mathsf{hypot}\left(a, b\right)\right)}^{2} \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{2}\right)\right)} - 1\]
  17. Simplified0.1

    \[\leadsto \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4 \cdot b, b, 1 \cdot \color{blue}{{\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)}}\right)} - 1\]
  18. Using strategy rm
  19. Applied add-sqr-sqrt0.1

    \[\leadsto \sqrt{\color{blue}{\sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} \cdot \sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)}}} \cdot \sqrt{\mathsf{fma}\left(4 \cdot b, b, 1 \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)}\right)} - 1\]
  20. Applied sqrt-prod0.1

    \[\leadsto \color{blue}{\left(\sqrt{\sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)}}\right)} \cdot \sqrt{\mathsf{fma}\left(4 \cdot b, b, 1 \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)}\right)} - 1\]
  21. Applied associate-*l*0.1

    \[\leadsto \color{blue}{\sqrt{\sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)}} \cdot \left(\sqrt{\sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)}} \cdot \sqrt{\mathsf{fma}\left(4 \cdot b, b, 1 \cdot {\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)}\right)}\right)} - 1\]
  22. Simplified0.1

    \[\leadsto \sqrt{\sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)}} \cdot \color{blue}{\left(\sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{hypot}\left(a, b\right)\right)}^{\left(2 \cdot 2\right)}\right)} \cdot \sqrt{\sqrt{\mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)}}\right)} - 1\]
  23. Final simplification0.1

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

Reproduce

herbie shell --seed 2019305 +o rules:numerics
(FPCore (a b)
  :name "Bouland and Aaronson, Equation (26)"
  :precision binary64
  (- (+ (pow (+ (* a a) (* b b)) 2) (* 4 (* b b))) 1))