Average Error: 0.2 → 0.1
Time: 15.9s
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 r2756530 = a;
        double r2756531 = r2756530 * r2756530;
        double r2756532 = b;
        double r2756533 = r2756532 * r2756532;
        double r2756534 = r2756531 + r2756533;
        double r2756535 = 2.0;
        double r2756536 = pow(r2756534, r2756535);
        double r2756537 = 4.0;
        double r2756538 = r2756537 * r2756533;
        double r2756539 = r2756536 + r2756538;
        double r2756540 = 1.0;
        double r2756541 = r2756539 - r2756540;
        return r2756541;
}

double f(double a, double b) {
        double r2756542 = b;
        double r2756543 = r2756542 * r2756542;
        double r2756544 = 4.0;
        double r2756545 = r2756543 * r2756544;
        double r2756546 = a;
        double r2756547 = r2756546 * r2756546;
        double r2756548 = 2.0;
        double r2756549 = r2756547 * r2756548;
        double r2756550 = fma(r2756542, r2756542, r2756549);
        double r2756551 = pow(r2756546, r2756544);
        double r2756552 = fma(r2756543, r2756550, r2756551);
        double r2756553 = r2756545 + r2756552;
        double r2756554 = 1.0;
        double r2756555 = r2756553 - r2756554;
        return r2756555;
}

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 -inf 0.0

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

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

    \[\leadsto \left(\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, 2 \cdot \left(a \cdot a\right)\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\]
  8. Applied pow10.2

    \[\leadsto \left(\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, 2 \cdot \left(a \cdot a\right)\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\]
  9. Applied pow-sqr0.2

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

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

    \[\leadsto \left(\mathsf{fma}\left(b \cdot b, \mathsf{fma}\left(b, b, 2 \cdot \left(a \cdot a\right)\right), {a}^{\color{blue}{4}}\right) + 4 \cdot \left(b \cdot b\right)\right) - 1\]
  12. 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 2019153 +o rules:numerics
(FPCore (a b)
  :name "Bouland and Aaronson, Equation (26)"
  (- (+ (pow (+ (* a a) (* b b)) 2) (* 4 (* b b))) 1))