Average Error: 0.2 → 0.1
Time: 30.8s
Precision: 64
\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
\[\left(4 \cdot \left(b \cdot b\right) + \mathsf{fma}\left(b, \left(\mathsf{fma}\left(b, b, \left(\left(a \cdot a\right) \cdot 2\right)\right) \cdot b\right), \left({a}^{4}\right)\right)\right) - 1\]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\left(4 \cdot \left(b \cdot b\right) + \mathsf{fma}\left(b, \left(\mathsf{fma}\left(b, b, \left(\left(a \cdot a\right) \cdot 2\right)\right) \cdot b\right), \left({a}^{4}\right)\right)\right) - 1
double f(double a, double b) {
        double r54123682 = a;
        double r54123683 = r54123682 * r54123682;
        double r54123684 = b;
        double r54123685 = r54123684 * r54123684;
        double r54123686 = r54123683 + r54123685;
        double r54123687 = 2.0;
        double r54123688 = pow(r54123686, r54123687);
        double r54123689 = 4.0;
        double r54123690 = r54123689 * r54123685;
        double r54123691 = r54123688 + r54123690;
        double r54123692 = 1.0;
        double r54123693 = r54123691 - r54123692;
        return r54123693;
}

double f(double a, double b) {
        double r54123694 = 4.0;
        double r54123695 = b;
        double r54123696 = r54123695 * r54123695;
        double r54123697 = r54123694 * r54123696;
        double r54123698 = a;
        double r54123699 = r54123698 * r54123698;
        double r54123700 = 2.0;
        double r54123701 = r54123699 * r54123700;
        double r54123702 = fma(r54123695, r54123695, r54123701);
        double r54123703 = r54123702 * r54123695;
        double r54123704 = pow(r54123698, r54123694);
        double r54123705 = fma(r54123695, r54123703, r54123704);
        double r54123706 = r54123697 + r54123705;
        double r54123707 = 1.0;
        double r54123708 = r54123706 - r54123707;
        return r54123708;
}

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

    \[\leadsto \left(\color{blue}{\mathsf{fma}\left(b, \left(b \cdot \mathsf{fma}\left(b, b, \left(2 \cdot \left(a \cdot a\right)\right)\right)\right), \left(\left(a \cdot a\right) \cdot \left(a \cdot a\right)\right)\right)} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
  4. Using strategy rm
  5. Applied pow10.2

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

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

    \[\leadsto \left(\mathsf{fma}\left(b, \left(b \cdot \mathsf{fma}\left(b, b, \left(2 \cdot \left(a \cdot a\right)\right)\right)\right), \left(\left(a \cdot a\right) \cdot \color{blue}{{a}^{\left(1 + 1\right)}}\right)\right) + 4 \cdot \left(b \cdot b\right)\right) - 1\]
  8. Applied pow10.2

    \[\leadsto \left(\mathsf{fma}\left(b, \left(b \cdot \mathsf{fma}\left(b, b, \left(2 \cdot \left(a \cdot a\right)\right)\right)\right), \left(\left(\color{blue}{{a}^{1}} \cdot a\right) \cdot {a}^{\left(1 + 1\right)}\right)\right) + 4 \cdot \left(b \cdot b\right)\right) - 1\]
  9. Applied pow-plus0.2

    \[\leadsto \left(\mathsf{fma}\left(b, \left(b \cdot \mathsf{fma}\left(b, b, \left(2 \cdot \left(a \cdot a\right)\right)\right)\right), \left(\color{blue}{{a}^{\left(1 + 1\right)}} \cdot {a}^{\left(1 + 1\right)}\right)\right) + 4 \cdot \left(b \cdot b\right)\right) - 1\]
  10. Applied pow-sqr0.1

    \[\leadsto \left(\mathsf{fma}\left(b, \left(b \cdot \mathsf{fma}\left(b, b, \left(2 \cdot \left(a \cdot a\right)\right)\right)\right), \color{blue}{\left({a}^{\left(2 \cdot \left(1 + 1\right)\right)}\right)}\right) + 4 \cdot \left(b \cdot b\right)\right) - 1\]
  11. Simplified0.1

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

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

Reproduce

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