Average Error: 0.2 → 0.1
Time: 18.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\]
\[\left(\mathsf{fma}\left(b \cdot b, b \cdot b, \mathsf{fma}\left(2, \left(b \cdot b\right) \cdot \left(a \cdot a\right), {a}^{4}\right)\right) + 4 \cdot \left(\left(1 - a \cdot 3\right) \cdot \left(b \cdot b\right) + \left(1 + a\right) \cdot \left(a \cdot a\right)\right)\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(1 - 3 \cdot a\right)\right)\right) - 1
\left(\mathsf{fma}\left(b \cdot b, b \cdot b, \mathsf{fma}\left(2, \left(b \cdot b\right) \cdot \left(a \cdot a\right), {a}^{4}\right)\right) + 4 \cdot \left(\left(1 - a \cdot 3\right) \cdot \left(b \cdot b\right) + \left(1 + a\right) \cdot \left(a \cdot a\right)\right)\right) - 1
double f(double a, double b) {
        double r2016762 = a;
        double r2016763 = r2016762 * r2016762;
        double r2016764 = b;
        double r2016765 = r2016764 * r2016764;
        double r2016766 = r2016763 + r2016765;
        double r2016767 = 2.0;
        double r2016768 = pow(r2016766, r2016767);
        double r2016769 = 4.0;
        double r2016770 = 1.0;
        double r2016771 = r2016770 + r2016762;
        double r2016772 = r2016763 * r2016771;
        double r2016773 = 3.0;
        double r2016774 = r2016773 * r2016762;
        double r2016775 = r2016770 - r2016774;
        double r2016776 = r2016765 * r2016775;
        double r2016777 = r2016772 + r2016776;
        double r2016778 = r2016769 * r2016777;
        double r2016779 = r2016768 + r2016778;
        double r2016780 = r2016779 - r2016770;
        return r2016780;
}

double f(double a, double b) {
        double r2016781 = b;
        double r2016782 = r2016781 * r2016781;
        double r2016783 = 2.0;
        double r2016784 = a;
        double r2016785 = r2016784 * r2016784;
        double r2016786 = r2016782 * r2016785;
        double r2016787 = 4.0;
        double r2016788 = pow(r2016784, r2016787);
        double r2016789 = fma(r2016783, r2016786, r2016788);
        double r2016790 = fma(r2016782, r2016782, r2016789);
        double r2016791 = 1.0;
        double r2016792 = 3.0;
        double r2016793 = r2016784 * r2016792;
        double r2016794 = r2016791 - r2016793;
        double r2016795 = r2016794 * r2016782;
        double r2016796 = r2016791 + r2016784;
        double r2016797 = r2016796 * r2016785;
        double r2016798 = r2016795 + r2016797;
        double r2016799 = r2016787 * r2016798;
        double r2016800 = r2016790 + r2016799;
        double r2016801 = r2016800 - r2016791;
        return r2016801;
}

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. Taylor expanded around 0 0.0

    \[\leadsto \left(\color{blue}{\left({b}^{4} + \left(2 \cdot \left({a}^{2} \cdot {b}^{2}\right) + {a}^{4}\right)\right)} + 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\]
  3. Simplified0.2

    \[\leadsto \left(\color{blue}{\mathsf{fma}\left(b \cdot b, b \cdot b, \mathsf{fma}\left(2, \left(b \cdot b\right) \cdot \left(a \cdot a\right), \left(a \cdot a\right) \cdot \left(a \cdot a\right)\right)\right)} + 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\]
  4. Using strategy rm
  5. Applied pow10.2

    \[\leadsto \left(\mathsf{fma}\left(b \cdot b, b \cdot b, \mathsf{fma}\left(2, \left(b \cdot b\right) \cdot \left(a \cdot a\right), \left(a \cdot a\right) \cdot \left(a \cdot \color{blue}{{a}^{1}}\right)\right)\right) + 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\]
  6. Applied pow10.2

    \[\leadsto \left(\mathsf{fma}\left(b \cdot b, b \cdot b, \mathsf{fma}\left(2, \left(b \cdot b\right) \cdot \left(a \cdot a\right), \left(a \cdot a\right) \cdot \left(\color{blue}{{a}^{1}} \cdot {a}^{1}\right)\right)\right) + 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\]
  7. Applied pow-prod-up0.2

    \[\leadsto \left(\mathsf{fma}\left(b \cdot b, b \cdot b, \mathsf{fma}\left(2, \left(b \cdot b\right) \cdot \left(a \cdot a\right), \left(a \cdot a\right) \cdot \color{blue}{{a}^{\left(1 + 1\right)}}\right)\right) + 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\]
  8. Applied pow10.2

    \[\leadsto \left(\mathsf{fma}\left(b \cdot b, b \cdot b, \mathsf{fma}\left(2, \left(b \cdot b\right) \cdot \left(a \cdot a\right), \left(a \cdot \color{blue}{{a}^{1}}\right) \cdot {a}^{\left(1 + 1\right)}\right)\right) + 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\]
  9. Applied pow10.2

    \[\leadsto \left(\mathsf{fma}\left(b \cdot b, b \cdot b, \mathsf{fma}\left(2, \left(b \cdot b\right) \cdot \left(a \cdot a\right), \left(\color{blue}{{a}^{1}} \cdot {a}^{1}\right) \cdot {a}^{\left(1 + 1\right)}\right)\right) + 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\]
  10. Applied pow-prod-up0.2

    \[\leadsto \left(\mathsf{fma}\left(b \cdot b, b \cdot b, \mathsf{fma}\left(2, \left(b \cdot b\right) \cdot \left(a \cdot a\right), \color{blue}{{a}^{\left(1 + 1\right)}} \cdot {a}^{\left(1 + 1\right)}\right)\right) + 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\]
  11. Applied pow-prod-up0.1

    \[\leadsto \left(\mathsf{fma}\left(b \cdot b, b \cdot b, \mathsf{fma}\left(2, \left(b \cdot b\right) \cdot \left(a \cdot a\right), \color{blue}{{a}^{\left(\left(1 + 1\right) + \left(1 + 1\right)\right)}}\right)\right) + 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\]
  12. Simplified0.1

    \[\leadsto \left(\mathsf{fma}\left(b \cdot b, b \cdot b, \mathsf{fma}\left(2, \left(b \cdot b\right) \cdot \left(a \cdot a\right), {a}^{\color{blue}{4}}\right)\right) + 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\]
  13. Final simplification0.1

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

Reproduce

herbie shell --seed 2019153 +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))