Average Error: 0.2 → 0.1
Time: 11.2s
Precision: 64
\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
\[\left(\left(b \cdot b\right) \cdot 4 + \mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, \left(a \cdot a\right) \cdot 2\right), {a}^{4}\right)\right) - 1\]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\left(\left(b \cdot b\right) \cdot 4 + \mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, \left(a \cdot a\right) \cdot 2\right), {a}^{4}\right)\right) - 1
double f(double a, double b) {
        double r3441095 = a;
        double r3441096 = r3441095 * r3441095;
        double r3441097 = b;
        double r3441098 = r3441097 * r3441097;
        double r3441099 = r3441096 + r3441098;
        double r3441100 = 2.0;
        double r3441101 = pow(r3441099, r3441100);
        double r3441102 = 4.0;
        double r3441103 = r3441102 * r3441098;
        double r3441104 = r3441101 + r3441103;
        double r3441105 = 1.0;
        double r3441106 = r3441104 - r3441105;
        return r3441106;
}

double f(double a, double b) {
        double r3441107 = b;
        double r3441108 = r3441107 * r3441107;
        double r3441109 = 4.0;
        double r3441110 = r3441108 * r3441109;
        double r3441111 = a;
        double r3441112 = r3441111 * r3441111;
        double r3441113 = 2.0;
        double r3441114 = r3441112 * r3441113;
        double r3441115 = fma(r3441107, r3441107, r3441114);
        double r3441116 = pow(r3441111, r3441109);
        double r3441117 = fma(r3441108, r3441115, r3441116);
        double r3441118 = r3441110 + r3441117;
        double r3441119 = 1.0;
        double r3441120 = r3441118 - r3441119;
        return r3441120;
}

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

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

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

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

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

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

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

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

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

Reproduce

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