Average Error: 0.2 → 0.1
Time: 16.5s
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(4 \cdot \left(\left(b \cdot b\right) \cdot \left(a + 3\right) + \left(1 - a\right) \cdot \left(a \cdot a\right)\right) + \mathsf{fma}\left(b \cdot b, b \cdot b, \mathsf{fma}\left(\left(a \cdot a\right) \cdot 2, b \cdot b, {a}^{4}\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(3 + a\right)\right)\right) - 1
\left(4 \cdot \left(\left(b \cdot b\right) \cdot \left(a + 3\right) + \left(1 - a\right) \cdot \left(a \cdot a\right)\right) + \mathsf{fma}\left(b \cdot b, b \cdot b, \mathsf{fma}\left(\left(a \cdot a\right) \cdot 2, b \cdot b, {a}^{4}\right)\right)\right) - 1
double f(double a, double b) {
        double r2876618 = a;
        double r2876619 = r2876618 * r2876618;
        double r2876620 = b;
        double r2876621 = r2876620 * r2876620;
        double r2876622 = r2876619 + r2876621;
        double r2876623 = 2.0;
        double r2876624 = pow(r2876622, r2876623);
        double r2876625 = 4.0;
        double r2876626 = 1.0;
        double r2876627 = r2876626 - r2876618;
        double r2876628 = r2876619 * r2876627;
        double r2876629 = 3.0;
        double r2876630 = r2876629 + r2876618;
        double r2876631 = r2876621 * r2876630;
        double r2876632 = r2876628 + r2876631;
        double r2876633 = r2876625 * r2876632;
        double r2876634 = r2876624 + r2876633;
        double r2876635 = r2876634 - r2876626;
        return r2876635;
}

double f(double a, double b) {
        double r2876636 = 4.0;
        double r2876637 = b;
        double r2876638 = r2876637 * r2876637;
        double r2876639 = a;
        double r2876640 = 3.0;
        double r2876641 = r2876639 + r2876640;
        double r2876642 = r2876638 * r2876641;
        double r2876643 = 1.0;
        double r2876644 = r2876643 - r2876639;
        double r2876645 = r2876639 * r2876639;
        double r2876646 = r2876644 * r2876645;
        double r2876647 = r2876642 + r2876646;
        double r2876648 = r2876636 * r2876647;
        double r2876649 = 2.0;
        double r2876650 = r2876645 * r2876649;
        double r2876651 = pow(r2876639, r2876636);
        double r2876652 = fma(r2876650, r2876638, r2876651);
        double r2876653 = fma(r2876638, r2876638, r2876652);
        double r2876654 = r2876648 + r2876653;
        double r2876655 = r2876654 - r2876643;
        return r2876655;
}

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

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

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

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

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

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

Reproduce

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