Average Error: 0.2 → 0.1
Time: 20.4s
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 r6876482 = a;
        double r6876483 = r6876482 * r6876482;
        double r6876484 = b;
        double r6876485 = r6876484 * r6876484;
        double r6876486 = r6876483 + r6876485;
        double r6876487 = 2.0;
        double r6876488 = pow(r6876486, r6876487);
        double r6876489 = 4.0;
        double r6876490 = 1.0;
        double r6876491 = r6876490 + r6876482;
        double r6876492 = r6876483 * r6876491;
        double r6876493 = 3.0;
        double r6876494 = r6876493 * r6876482;
        double r6876495 = r6876490 - r6876494;
        double r6876496 = r6876485 * r6876495;
        double r6876497 = r6876492 + r6876496;
        double r6876498 = r6876489 * r6876497;
        double r6876499 = r6876488 + r6876498;
        double r6876500 = r6876499 - r6876490;
        return r6876500;
}

double f(double a, double b) {
        double r6876501 = b;
        double r6876502 = r6876501 * r6876501;
        double r6876503 = a;
        double r6876504 = r6876503 * r6876503;
        double r6876505 = 2.0;
        double r6876506 = r6876504 * r6876505;
        double r6876507 = 4.0;
        double r6876508 = pow(r6876503, r6876507);
        double r6876509 = fma(r6876506, r6876502, r6876508);
        double r6876510 = fma(r6876502, r6876502, r6876509);
        double r6876511 = 1.0;
        double r6876512 = 3.0;
        double r6876513 = r6876503 * r6876512;
        double r6876514 = r6876511 - r6876513;
        double r6876515 = r6876514 * r6876502;
        double r6876516 = r6876511 + r6876503;
        double r6876517 = r6876516 * r6876504;
        double r6876518 = r6876515 + r6876517;
        double r6876519 = r6876507 * r6876518;
        double r6876520 = r6876510 + r6876519;
        double r6876521 = r6876520 - r6876511;
        return r6876521;
}

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))