Average Error: 0.2 → 0.1
Time: 47.3s
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(3 + a\right)\right)\right) - 1\]
\[\left((b \cdot \left((b \cdot b + \left(\left(a \cdot a\right) \cdot 2\right))_* \cdot b\right) + \left({a}^{4}\right))_* + \left(\left(b \cdot b\right) \cdot \left(3 + a\right) + \left(a \cdot a\right) \cdot \left(1 - a\right)\right) \cdot 4\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(3 + a\right)\right)\right) - 1
\left((b \cdot \left((b \cdot b + \left(\left(a \cdot a\right) \cdot 2\right))_* \cdot b\right) + \left({a}^{4}\right))_* + \left(\left(b \cdot b\right) \cdot \left(3 + a\right) + \left(a \cdot a\right) \cdot \left(1 - a\right)\right) \cdot 4\right) - 1
double f(double a, double b) {
        double r54100694 = a;
        double r54100695 = r54100694 * r54100694;
        double r54100696 = b;
        double r54100697 = r54100696 * r54100696;
        double r54100698 = r54100695 + r54100697;
        double r54100699 = 2.0;
        double r54100700 = pow(r54100698, r54100699);
        double r54100701 = 4.0;
        double r54100702 = 1.0;
        double r54100703 = r54100702 - r54100694;
        double r54100704 = r54100695 * r54100703;
        double r54100705 = 3.0;
        double r54100706 = r54100705 + r54100694;
        double r54100707 = r54100697 * r54100706;
        double r54100708 = r54100704 + r54100707;
        double r54100709 = r54100701 * r54100708;
        double r54100710 = r54100700 + r54100709;
        double r54100711 = r54100710 - r54100702;
        return r54100711;
}

double f(double a, double b) {
        double r54100712 = b;
        double r54100713 = a;
        double r54100714 = r54100713 * r54100713;
        double r54100715 = 2.0;
        double r54100716 = r54100714 * r54100715;
        double r54100717 = fma(r54100712, r54100712, r54100716);
        double r54100718 = r54100717 * r54100712;
        double r54100719 = 4.0;
        double r54100720 = pow(r54100713, r54100719);
        double r54100721 = fma(r54100712, r54100718, r54100720);
        double r54100722 = r54100712 * r54100712;
        double r54100723 = 3.0;
        double r54100724 = r54100723 + r54100713;
        double r54100725 = r54100722 * r54100724;
        double r54100726 = 1.0;
        double r54100727 = r54100726 - r54100713;
        double r54100728 = r54100714 * r54100727;
        double r54100729 = r54100725 + r54100728;
        double r54100730 = r54100729 * r54100719;
        double r54100731 = r54100721 + r54100730;
        double r54100732 = r54100731 - r54100726;
        return r54100732;
}

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

    \[\leadsto \left(\color{blue}{(b \cdot \left(b \cdot (b \cdot b + \left(2 \cdot \left(a \cdot a\right)\right))_*\right) + \left(\left(a \cdot a\right) \cdot \left(a \cdot a\right)\right))_*} + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1\]
  4. Using strategy rm
  5. Applied pow20.2

    \[\leadsto \left((b \cdot \left(b \cdot (b \cdot b + \left(2 \cdot \left(a \cdot a\right)\right))_*\right) + \left(\left(a \cdot a\right) \cdot \color{blue}{{a}^{2}}\right))_* + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1\]
  6. Applied pow10.2

    \[\leadsto \left((b \cdot \left(b \cdot (b \cdot b + \left(2 \cdot \left(a \cdot a\right)\right))_*\right) + \left(\left(a \cdot \color{blue}{{a}^{1}}\right) \cdot {a}^{2}\right))_* + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1\]
  7. Applied pow10.2

    \[\leadsto \left((b \cdot \left(b \cdot (b \cdot b + \left(2 \cdot \left(a \cdot a\right)\right))_*\right) + \left(\left(\color{blue}{{a}^{1}} \cdot {a}^{1}\right) \cdot {a}^{2}\right))_* + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1\]
  8. Applied pow-sqr0.2

    \[\leadsto \left((b \cdot \left(b \cdot (b \cdot b + \left(2 \cdot \left(a \cdot a\right)\right))_*\right) + \left(\color{blue}{{a}^{\left(2 \cdot 1\right)}} \cdot {a}^{2}\right))_* + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1\]
  9. Applied pow-prod-up0.1

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

    \[\leadsto \left((b \cdot \left(b \cdot (b \cdot b + \left(2 \cdot \left(a \cdot a\right)\right))_*\right) + \left({a}^{\color{blue}{4}}\right))_* + 4 \cdot \left(\left(a \cdot a\right) \cdot \left(1 - a\right) + \left(b \cdot b\right) \cdot \left(3 + a\right)\right)\right) - 1\]
  11. Final simplification0.1

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

Reproduce

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