Average Error: 0.2 → 0.1
Time: 26.4s
Precision: 64
\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
\[\begin{array}{l} \mathbf{if}\;a \cdot a \le 1.116639808626210519959006659985626469253 \cdot 10^{-18}:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(b \cdot b\right), 2, {b}^{4}\right) + \left(\sqrt[3]{4} \cdot \sqrt[3]{4}\right) \cdot \left(\sqrt[3]{4} \cdot \left(b \cdot b\right)\right)\right) - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, 2 \cdot \left(a \cdot a\right)\right), {a}^{4}\right) - 1\\ \end{array}\]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\begin{array}{l}
\mathbf{if}\;a \cdot a \le 1.116639808626210519959006659985626469253 \cdot 10^{-18}:\\
\;\;\;\;\left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(b \cdot b\right), 2, {b}^{4}\right) + \left(\sqrt[3]{4} \cdot \sqrt[3]{4}\right) \cdot \left(\sqrt[3]{4} \cdot \left(b \cdot b\right)\right)\right) - 1\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, 2 \cdot \left(a \cdot a\right)\right), {a}^{4}\right) - 1\\

\end{array}
double f(double a, double b) {
        double r207916 = a;
        double r207917 = r207916 * r207916;
        double r207918 = b;
        double r207919 = r207918 * r207918;
        double r207920 = r207917 + r207919;
        double r207921 = 2.0;
        double r207922 = pow(r207920, r207921);
        double r207923 = 4.0;
        double r207924 = r207923 * r207919;
        double r207925 = r207922 + r207924;
        double r207926 = 1.0;
        double r207927 = r207925 - r207926;
        return r207927;
}

double f(double a, double b) {
        double r207928 = a;
        double r207929 = r207928 * r207928;
        double r207930 = 1.1166398086262105e-18;
        bool r207931 = r207929 <= r207930;
        double r207932 = b;
        double r207933 = r207932 * r207932;
        double r207934 = r207929 * r207933;
        double r207935 = 2.0;
        double r207936 = 4.0;
        double r207937 = pow(r207932, r207936);
        double r207938 = fma(r207934, r207935, r207937);
        double r207939 = 4.0;
        double r207940 = cbrt(r207939);
        double r207941 = r207940 * r207940;
        double r207942 = r207940 * r207933;
        double r207943 = r207941 * r207942;
        double r207944 = r207938 + r207943;
        double r207945 = 1.0;
        double r207946 = r207944 - r207945;
        double r207947 = 2.0;
        double r207948 = r207947 * r207929;
        double r207949 = fma(r207932, r207932, r207948);
        double r207950 = pow(r207928, r207936);
        double r207951 = fma(r207933, r207949, r207950);
        double r207952 = r207951 - r207945;
        double r207953 = r207931 ? r207946 : r207952;
        return r207953;
}

Error

Bits error versus a

Bits error versus b

Derivation

  1. Split input into 2 regimes
  2. if (* a a) < 1.1166398086262105e-18

    1. Initial program 0.1

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
    2. Taylor expanded around 0 0.0

      \[\leadsto \left(\color{blue}{\left({b}^{4} + 2 \cdot \left({a}^{2} \cdot {b}^{2}\right)\right)} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
    3. Simplified0.0

      \[\leadsto \left(\color{blue}{\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(b \cdot b\right), 2, {b}^{4}\right)} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
    4. Using strategy rm
    5. Applied add-cube-cbrt0.0

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

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

    if 1.1166398086262105e-18 < (* a a)

    1. Initial program 0.4

      \[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
    2. Taylor expanded around inf 0.3

      \[\leadsto \color{blue}{\left({a}^{4} + \left({b}^{4} + 2 \cdot \left({a}^{2} \cdot {b}^{2}\right)\right)\right)} - 1\]
    3. Simplified0.3

      \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, 2 \cdot \left(a \cdot a\right)\right), {a}^{4}\right)} - 1\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \cdot a \le 1.116639808626210519959006659985626469253 \cdot 10^{-18}:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(a \cdot a\right) \cdot \left(b \cdot b\right), 2, {b}^{4}\right) + \left(\sqrt[3]{4} \cdot \sqrt[3]{4}\right) \cdot \left(\sqrt[3]{4} \cdot \left(b \cdot b\right)\right)\right) - 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, 2 \cdot \left(a \cdot a\right)\right), {a}^{4}\right) - 1\\ \end{array}\]

Reproduce

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