Average Error: 0.2 → 0.4
Time: 21.6s
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(1 - 3 \cdot a\right)\right)\right) - 1\]
\[\mathsf{fma}\left(\mathsf{fma}\left(4, a, 4\right), a \cdot a, \mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(a, -12, 4\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \sqrt{\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \mathsf{fma}\left(a, a, b \cdot b\right)}} \cdot \left(\sqrt{\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \mathsf{fma}\left(a, a, b \cdot b\right)}} \cdot \sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right)}\right), -1\right)\right)\right)\]
\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(1 - 3 \cdot a\right)\right)\right) - 1
\mathsf{fma}\left(\mathsf{fma}\left(4, a, 4\right), a \cdot a, \mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(a, -12, 4\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \sqrt{\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \mathsf{fma}\left(a, a, b \cdot b\right)}} \cdot \left(\sqrt{\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \mathsf{fma}\left(a, a, b \cdot b\right)}} \cdot \sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right)}\right), -1\right)\right)\right)
double f(double a, double b) {
        double r8124806 = a;
        double r8124807 = r8124806 * r8124806;
        double r8124808 = b;
        double r8124809 = r8124808 * r8124808;
        double r8124810 = r8124807 + r8124809;
        double r8124811 = 2.0;
        double r8124812 = pow(r8124810, r8124811);
        double r8124813 = 4.0;
        double r8124814 = 1.0;
        double r8124815 = r8124814 + r8124806;
        double r8124816 = r8124807 * r8124815;
        double r8124817 = 3.0;
        double r8124818 = r8124817 * r8124806;
        double r8124819 = r8124814 - r8124818;
        double r8124820 = r8124809 * r8124819;
        double r8124821 = r8124816 + r8124820;
        double r8124822 = r8124813 * r8124821;
        double r8124823 = r8124812 + r8124822;
        double r8124824 = r8124823 - r8124814;
        return r8124824;
}

double f(double a, double b) {
        double r8124825 = 4.0;
        double r8124826 = a;
        double r8124827 = fma(r8124825, r8124826, r8124825);
        double r8124828 = r8124826 * r8124826;
        double r8124829 = b;
        double r8124830 = r8124829 * r8124829;
        double r8124831 = -12.0;
        double r8124832 = fma(r8124826, r8124831, r8124825);
        double r8124833 = fma(r8124826, r8124826, r8124830);
        double r8124834 = r8124833 * r8124833;
        double r8124835 = cbrt(r8124834);
        double r8124836 = sqrt(r8124835);
        double r8124837 = cbrt(r8124833);
        double r8124838 = r8124836 * r8124837;
        double r8124839 = r8124836 * r8124838;
        double r8124840 = -1.0;
        double r8124841 = fma(r8124833, r8124839, r8124840);
        double r8124842 = fma(r8124830, r8124832, r8124841);
        double r8124843 = fma(r8124827, r8124828, r8124842);
        return r8124843;
}

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(1 - 3 \cdot a\right)\right)\right) - 1\]
  2. Simplified0.2

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

    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(4, a, 4\right), a \cdot a, \mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(a, -12, 4\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right)} \cdot \sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right)}}, -1\right)\right)\right)\]
  5. Using strategy rm
  6. Applied cbrt-unprod0.3

    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(4, a, 4\right), a \cdot a, \mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(a, -12, 4\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \color{blue}{\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \mathsf{fma}\left(a, a, b \cdot b\right)}} \cdot \sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right)}, -1\right)\right)\right)\]
  7. Using strategy rm
  8. Applied add-sqr-sqrt0.4

    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(4, a, 4\right), a \cdot a, \mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(a, -12, 4\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \color{blue}{\left(\sqrt{\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \mathsf{fma}\left(a, a, b \cdot b\right)}} \cdot \sqrt{\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \mathsf{fma}\left(a, a, b \cdot b\right)}}\right)} \cdot \sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right)}, -1\right)\right)\right)\]
  9. Applied associate-*l*0.4

    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(4, a, 4\right), a \cdot a, \mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(a, -12, 4\right), \mathsf{fma}\left(\mathsf{fma}\left(a, a, b \cdot b\right), \color{blue}{\sqrt{\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \mathsf{fma}\left(a, a, b \cdot b\right)}} \cdot \left(\sqrt{\sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right) \cdot \mathsf{fma}\left(a, a, b \cdot b\right)}} \cdot \sqrt[3]{\mathsf{fma}\left(a, a, b \cdot b\right)}\right)}, -1\right)\right)\right)\]
  10. Final simplification0.4

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

Reproduce

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