Average Error: 0.2 → 0.2
Time: 18.2s
Precision: 64
\[\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1\]
\[\mathsf{fma}\left(b \cdot b, 4, \mathsf{fma}\left(\mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)\]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\mathsf{fma}\left(b \cdot b, 4, \mathsf{fma}\left(\mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(a, a, b \cdot b\right), -1\right)\right)
double f(double a, double b) {
        double r7208215 = a;
        double r7208216 = r7208215 * r7208215;
        double r7208217 = b;
        double r7208218 = r7208217 * r7208217;
        double r7208219 = r7208216 + r7208218;
        double r7208220 = 2.0;
        double r7208221 = pow(r7208219, r7208220);
        double r7208222 = 4.0;
        double r7208223 = r7208222 * r7208218;
        double r7208224 = r7208221 + r7208223;
        double r7208225 = 1.0;
        double r7208226 = r7208224 - r7208225;
        return r7208226;
}

double f(double a, double b) {
        double r7208227 = b;
        double r7208228 = r7208227 * r7208227;
        double r7208229 = 4.0;
        double r7208230 = a;
        double r7208231 = r7208230 * r7208230;
        double r7208232 = fma(r7208227, r7208227, r7208231);
        double r7208233 = fma(r7208230, r7208230, r7208228);
        double r7208234 = -1.0;
        double r7208235 = fma(r7208232, r7208233, r7208234);
        double r7208236 = fma(r7208228, r7208229, r7208235);
        return r7208236;
}

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. Simplified0.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(b \cdot b, 4, \mathsf{fma}\left(\mathsf{fma}\left(b, b, a \cdot a\right), \mathsf{fma}\left(b, b, a \cdot a\right), -1\right)\right)}\]
  3. Taylor expanded around 0 0.2

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

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

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

Reproduce

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