Average Error: 0.2 → 0.1
Time: 20.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(b \cdot b, b \cdot b, \mathsf{fma}\left(\left(a \cdot a\right) \cdot 2, b \cdot b, {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(\left(a \cdot a\right) \cdot 2, b \cdot b, {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 r4066098 = a;
        double r4066099 = r4066098 * r4066098;
        double r4066100 = b;
        double r4066101 = r4066100 * r4066100;
        double r4066102 = r4066099 + r4066101;
        double r4066103 = 2.0;
        double r4066104 = pow(r4066102, r4066103);
        double r4066105 = 4.0;
        double r4066106 = 1.0;
        double r4066107 = r4066106 + r4066098;
        double r4066108 = r4066099 * r4066107;
        double r4066109 = 3.0;
        double r4066110 = r4066109 * r4066098;
        double r4066111 = r4066106 - r4066110;
        double r4066112 = r4066101 * r4066111;
        double r4066113 = r4066108 + r4066112;
        double r4066114 = r4066105 * r4066113;
        double r4066115 = r4066104 + r4066114;
        double r4066116 = r4066115 - r4066106;
        return r4066116;
}

double f(double a, double b) {
        double r4066117 = b;
        double r4066118 = r4066117 * r4066117;
        double r4066119 = a;
        double r4066120 = r4066119 * r4066119;
        double r4066121 = 2.0;
        double r4066122 = r4066120 * r4066121;
        double r4066123 = 4.0;
        double r4066124 = pow(r4066119, r4066123);
        double r4066125 = fma(r4066122, r4066118, r4066124);
        double r4066126 = fma(r4066118, r4066118, r4066125);
        double r4066127 = 1.0;
        double r4066128 = 3.0;
        double r4066129 = r4066119 * r4066128;
        double r4066130 = r4066127 - r4066129;
        double r4066131 = r4066130 * r4066118;
        double r4066132 = r4066127 + r4066119;
        double r4066133 = r4066132 * r4066120;
        double r4066134 = r4066131 + r4066133;
        double r4066135 = r4066123 * r4066134;
        double r4066136 = r4066126 + r4066135;
        double r4066137 = r4066136 - r4066127;
        return r4066137;
}

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 \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(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 \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(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 \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(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 \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(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 \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(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 \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(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 \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(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 \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(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 \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(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(\left(a \cdot a\right) \cdot 2, b \cdot b, {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 2019164 +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))