Average Error: 0.2 → 0.2
Time: 12.9s
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, b \cdot 4, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} - 1\right)\]
\left({\left(a \cdot a + b \cdot b\right)}^{2} + 4 \cdot \left(b \cdot b\right)\right) - 1
\mathsf{fma}\left(b, b \cdot 4, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2} - 1\right)
double f(double a, double b) {
        double r204788 = a;
        double r204789 = r204788 * r204788;
        double r204790 = b;
        double r204791 = r204790 * r204790;
        double r204792 = r204789 + r204791;
        double r204793 = 2.0;
        double r204794 = pow(r204792, r204793);
        double r204795 = 4.0;
        double r204796 = r204795 * r204791;
        double r204797 = r204794 + r204796;
        double r204798 = 1.0;
        double r204799 = r204797 - r204798;
        return r204799;
}

double f(double a, double b) {
        double r204800 = b;
        double r204801 = 4.0;
        double r204802 = r204800 * r204801;
        double r204803 = a;
        double r204804 = r204800 * r204800;
        double r204805 = fma(r204803, r204803, r204804);
        double r204806 = 2.0;
        double r204807 = pow(r204805, r204806);
        double r204808 = 1.0;
        double r204809 = r204807 - r204808;
        double r204810 = fma(r204800, r204802, r204809);
        return r204810;
}

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(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right) - 1}\]
  3. Using strategy rm
  4. Applied *-un-lft-identity0.2

    \[\leadsto \mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right) - \color{blue}{1 \cdot 1}\]
  5. Applied *-un-lft-identity0.2

    \[\leadsto \color{blue}{1 \cdot \mathsf{fma}\left(4 \cdot b, b, {\left(\mathsf{fma}\left(a, a, b \cdot b\right)\right)}^{2}\right)} - 1 \cdot 1\]
  6. Applied distribute-lft-out--0.2

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

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

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

Reproduce

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