Average Error: 0.2 → 0.2
Time: 21.5s
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(b, b, a \cdot a\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(b, b, a \cdot a\right), -1\right)\right)
double f(double a, double b) {
        double r5592636 = a;
        double r5592637 = r5592636 * r5592636;
        double r5592638 = b;
        double r5592639 = r5592638 * r5592638;
        double r5592640 = r5592637 + r5592639;
        double r5592641 = 2.0;
        double r5592642 = pow(r5592640, r5592641);
        double r5592643 = 4.0;
        double r5592644 = r5592643 * r5592639;
        double r5592645 = r5592642 + r5592644;
        double r5592646 = 1.0;
        double r5592647 = r5592645 - r5592646;
        return r5592647;
}

double f(double a, double b) {
        double r5592648 = b;
        double r5592649 = r5592648 * r5592648;
        double r5592650 = 4.0;
        double r5592651 = a;
        double r5592652 = r5592651 * r5592651;
        double r5592653 = fma(r5592648, r5592648, r5592652);
        double r5592654 = -1.0;
        double r5592655 = fma(r5592653, r5592653, r5592654);
        double r5592656 = fma(r5592649, r5592650, r5592655);
        return r5592656;
}

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. 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(b, b, a \cdot a\right), -1\right)\right)\]

Reproduce

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