Average Error: 0.2 → 0.2
Time: 13.0s
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\]
\[\mathsf{fma}\left(4, \mathsf{fma}\left(1, \mathsf{fma}\left(a, a, b \cdot b\right), {a}^{3}\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\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
\mathsf{fma}\left(4, \mathsf{fma}\left(1, \mathsf{fma}\left(a, a, b \cdot b\right), {a}^{3}\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right) - 1
double f(double a, double b) {
        double r187175 = a;
        double r187176 = r187175 * r187175;
        double r187177 = b;
        double r187178 = r187177 * r187177;
        double r187179 = r187176 + r187178;
        double r187180 = 2.0;
        double r187181 = pow(r187179, r187180);
        double r187182 = 4.0;
        double r187183 = 1.0;
        double r187184 = r187183 + r187175;
        double r187185 = r187176 * r187184;
        double r187186 = 3.0;
        double r187187 = r187186 * r187175;
        double r187188 = r187183 - r187187;
        double r187189 = r187178 * r187188;
        double r187190 = r187185 + r187189;
        double r187191 = r187182 * r187190;
        double r187192 = r187181 + r187191;
        double r187193 = r187192 - r187183;
        return r187193;
}

double f(double a, double b) {
        double r187194 = 4.0;
        double r187195 = 1.0;
        double r187196 = a;
        double r187197 = b;
        double r187198 = r187197 * r187197;
        double r187199 = fma(r187196, r187196, r187198);
        double r187200 = 3.0;
        double r187201 = pow(r187196, r187200);
        double r187202 = fma(r187195, r187199, r187201);
        double r187203 = 2.0;
        double r187204 = pow(r187199, r187203);
        double r187205 = fma(r187194, r187202, r187204);
        double r187206 = r187205 - r187195;
        return r187206;
}

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. Simplified0.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(4, \mathsf{fma}\left(a \cdot a, 1 + a, \left(b \cdot b\right) \cdot \left(1 - 3 \cdot a\right)\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right) - 1}\]
  3. Taylor expanded around 0 0.2

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

    \[\leadsto \mathsf{fma}\left(4, \color{blue}{\mathsf{fma}\left(1, \mathsf{fma}\left(a, a, b \cdot b\right), {a}^{3}\right)}, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right) - 1\]
  5. Final simplification0.2

    \[\leadsto \mathsf{fma}\left(4, \mathsf{fma}\left(1, \mathsf{fma}\left(a, a, b \cdot b\right), {a}^{3}\right), {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right) - 1\]

Reproduce

herbie shell --seed 2020047 +o rules:numerics
(FPCore (a b)
  :name "Bouland and Aaronson, Equation (25)"
  :precision binary64
  (- (+ (pow (+ (* a a) (* b b)) 2) (* 4 (+ (* (* a a) (+ 1 a)) (* (* b b) (- 1 (* 3 a)))))) 1))