Average Error: 0.2 → 0.2
Time: 24.8s
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 r5885043 = a;
        double r5885044 = r5885043 * r5885043;
        double r5885045 = b;
        double r5885046 = r5885045 * r5885045;
        double r5885047 = r5885044 + r5885046;
        double r5885048 = 2.0;
        double r5885049 = pow(r5885047, r5885048);
        double r5885050 = 4.0;
        double r5885051 = r5885050 * r5885046;
        double r5885052 = r5885049 + r5885051;
        double r5885053 = 1.0;
        double r5885054 = r5885052 - r5885053;
        return r5885054;
}

double f(double a, double b) {
        double r5885055 = b;
        double r5885056 = r5885055 * r5885055;
        double r5885057 = 4.0;
        double r5885058 = a;
        double r5885059 = r5885058 * r5885058;
        double r5885060 = fma(r5885055, r5885055, r5885059);
        double r5885061 = -1.0;
        double r5885062 = fma(r5885060, r5885060, r5885061);
        double r5885063 = fma(r5885056, r5885057, r5885062);
        return r5885063;
}

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 2019158 +o rules:numerics
(FPCore (a b)
  :name "Bouland and Aaronson, Equation (26)"
  (- (+ (pow (+ (* a a) (* b b)) 2) (* 4 (* b b))) 1))