Average Error: 0.2 → 0.1
Time: 25.2s
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(\left(b \cdot b\right), \left(b \cdot b\right), \left(\mathsf{fma}\left(\left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right), 2, \left({a}^{4}\right)\right)\right)\right) + 4 \cdot \left(\left(1 - a \cdot 3\right) \cdot \left(b \cdot b\right) + \left(a \cdot a\right) \cdot \left(1 + 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(\left(b \cdot b\right), \left(b \cdot b\right), \left(\mathsf{fma}\left(\left(\left(a \cdot a\right) \cdot \left(b \cdot b\right)\right), 2, \left({a}^{4}\right)\right)\right)\right) + 4 \cdot \left(\left(1 - a \cdot 3\right) \cdot \left(b \cdot b\right) + \left(a \cdot a\right) \cdot \left(1 + a\right)\right)\right) - 1
double f(double a, double b) {
        double r6253697 = a;
        double r6253698 = r6253697 * r6253697;
        double r6253699 = b;
        double r6253700 = r6253699 * r6253699;
        double r6253701 = r6253698 + r6253700;
        double r6253702 = 2.0;
        double r6253703 = pow(r6253701, r6253702);
        double r6253704 = 4.0;
        double r6253705 = 1.0;
        double r6253706 = r6253705 + r6253697;
        double r6253707 = r6253698 * r6253706;
        double r6253708 = 3.0;
        double r6253709 = r6253708 * r6253697;
        double r6253710 = r6253705 - r6253709;
        double r6253711 = r6253700 * r6253710;
        double r6253712 = r6253707 + r6253711;
        double r6253713 = r6253704 * r6253712;
        double r6253714 = r6253703 + r6253713;
        double r6253715 = r6253714 - r6253705;
        return r6253715;
}

double f(double a, double b) {
        double r6253716 = b;
        double r6253717 = r6253716 * r6253716;
        double r6253718 = a;
        double r6253719 = r6253718 * r6253718;
        double r6253720 = r6253719 * r6253717;
        double r6253721 = 2.0;
        double r6253722 = 4.0;
        double r6253723 = pow(r6253718, r6253722);
        double r6253724 = fma(r6253720, r6253721, r6253723);
        double r6253725 = fma(r6253717, r6253717, r6253724);
        double r6253726 = 1.0;
        double r6253727 = 3.0;
        double r6253728 = r6253718 * r6253727;
        double r6253729 = r6253726 - r6253728;
        double r6253730 = r6253729 * r6253717;
        double r6253731 = r6253726 + r6253718;
        double r6253732 = r6253719 * r6253731;
        double r6253733 = r6253730 + r6253732;
        double r6253734 = r6253722 * r6253733;
        double r6253735 = r6253725 + r6253734;
        double r6253736 = r6253735 - r6253726;
        return r6253736;
}

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 inf 0.0

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

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

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

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

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

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

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

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

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

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

Reproduce

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