Average Error: 0.2 → 0.1
Time: 13.7s
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 r3047331 = a;
        double r3047332 = r3047331 * r3047331;
        double r3047333 = b;
        double r3047334 = r3047333 * r3047333;
        double r3047335 = r3047332 + r3047334;
        double r3047336 = 2.0;
        double r3047337 = pow(r3047335, r3047336);
        double r3047338 = 4.0;
        double r3047339 = r3047338 * r3047334;
        double r3047340 = r3047337 + r3047339;
        double r3047341 = 1.0;
        double r3047342 = r3047340 - r3047341;
        return r3047342;
}

double f(double a, double b) {
        double r3047343 = b;
        double r3047344 = r3047343 * r3047343;
        double r3047345 = 4.0;
        double r3047346 = r3047344 * r3047345;
        double r3047347 = a;
        double r3047348 = r3047347 * r3047347;
        double r3047349 = 2.0;
        double r3047350 = r3047348 * r3047349;
        double r3047351 = fma(r3047343, r3047343, r3047350);
        double r3047352 = pow(r3047347, r3047345);
        double r3047353 = fma(r3047344, r3047351, r3047352);
        double r3047354 = r3047346 + r3047353;
        double r3047355 = 1.0;
        double r3047356 = r3047354 - r3047355;
        return r3047356;
}

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, 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(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, 2 \cdot \left(a \cdot a\right)\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, 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\]
  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(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, 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\]
  10. Applied pow-prod-up0.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(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, 2 \cdot \left(a \cdot a\right)\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, 2 \cdot \left(a \cdot a\right)\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 2019153 +o rules:numerics
(FPCore (a b)
  :name "Bouland and Aaronson, Equation (26)"
  (- (+ (pow (+ (* a a) (* b b)) 2) (* 4 (* b b))) 1))