Average Error: 0.2 → 0.2
Time: 13.7s
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\]
\[\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, b \cdot \left(b \cdot \left(3 + a\right)\right)\right), 4, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\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
\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, b \cdot \left(b \cdot \left(3 + a\right)\right)\right), 4, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right) - 1
double f(double a, double b) {
        double r233361 = a;
        double r233362 = r233361 * r233361;
        double r233363 = b;
        double r233364 = r233363 * r233363;
        double r233365 = r233362 + r233364;
        double r233366 = 2.0;
        double r233367 = pow(r233365, r233366);
        double r233368 = 4.0;
        double r233369 = 1.0;
        double r233370 = r233369 - r233361;
        double r233371 = r233362 * r233370;
        double r233372 = 3.0;
        double r233373 = r233372 + r233361;
        double r233374 = r233364 * r233373;
        double r233375 = r233371 + r233374;
        double r233376 = r233368 * r233375;
        double r233377 = r233367 + r233376;
        double r233378 = r233377 - r233369;
        return r233378;
}

double f(double a, double b) {
        double r233379 = a;
        double r233380 = r233379 * r233379;
        double r233381 = 1.0;
        double r233382 = r233381 - r233379;
        double r233383 = b;
        double r233384 = 3.0;
        double r233385 = r233384 + r233379;
        double r233386 = r233383 * r233385;
        double r233387 = r233383 * r233386;
        double r233388 = fma(r233380, r233382, r233387);
        double r233389 = 4.0;
        double r233390 = r233383 * r233383;
        double r233391 = fma(r233379, r233379, r233390);
        double r233392 = 2.0;
        double r233393 = pow(r233391, r233392);
        double r233394 = fma(r233388, r233389, r233393);
        double r233395 = r233394 - r233381;
        return r233395;
}

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(a \cdot a, 1 - a, \left(b \cdot b\right) \cdot \left(3 + a\right)\right), 4, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right) - 1}\]
  3. Using strategy rm
  4. Applied associate-*l*0.2

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

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

Reproduce

herbie shell --seed 2020045 +o rules:numerics
(FPCore (a b)
  :name "Bouland and Aaronson, Equation (24)"
  :precision binary64
  (- (+ (pow (+ (* a a) (* b b)) 2) (* 4 (+ (* (* a a) (- 1 a)) (* (* b b) (+ 3 a))))) 1))