Average Error: 0.2 → 0.1
Time: 27.2s
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 r232835 = a;
        double r232836 = r232835 * r232835;
        double r232837 = b;
        double r232838 = r232837 * r232837;
        double r232839 = r232836 + r232838;
        double r232840 = 2.0;
        double r232841 = pow(r232839, r232840);
        double r232842 = 4.0;
        double r232843 = r232842 * r232838;
        double r232844 = r232841 + r232843;
        double r232845 = 1.0;
        double r232846 = r232844 - r232845;
        return r232846;
}

double f(double a, double b) {
        double r232847 = a;
        double r232848 = r232847 * r232847;
        double r232849 = 1.1166398086262105e-18;
        bool r232850 = r232848 <= r232849;
        double r232851 = b;
        double r232852 = r232851 * r232851;
        double r232853 = r232848 * r232852;
        double r232854 = 2.0;
        double r232855 = 4.0;
        double r232856 = pow(r232851, r232855);
        double r232857 = fma(r232853, r232854, r232856);
        double r232858 = 4.0;
        double r232859 = cbrt(r232858);
        double r232860 = r232859 * r232859;
        double r232861 = r232859 * r232852;
        double r232862 = r232860 * r232861;
        double r232863 = r232857 + r232862;
        double r232864 = 1.0;
        double r232865 = r232863 - r232864;
        double r232866 = 2.0;
        double r232867 = r232866 * r232848;
        double r232868 = fma(r232851, r232851, r232867);
        double r232869 = pow(r232847, r232855);
        double r232870 = fma(r232852, r232868, r232869);
        double r232871 = r232870 - r232864;
        double r232872 = r232850 ? r232865 : r232871;
        return r232872;
}

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