Average Error: 0.0 → 0.0
Time: 1.4s
Precision: 64
\[\left(x + y\right) \cdot z\]
\[\mathsf{fma}\left(x, z, z \cdot y\right)\]
\left(x + y\right) \cdot z
\mathsf{fma}\left(x, z, z \cdot y\right)
double f(double x, double y, double z) {
        double r882 = x;
        double r883 = y;
        double r884 = r882 + r883;
        double r885 = z;
        double r886 = r884 * r885;
        return r886;
}

double f(double x, double y, double z) {
        double r887 = x;
        double r888 = z;
        double r889 = y;
        double r890 = r888 * r889;
        double r891 = fma(r887, r888, r890);
        return r891;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.0

    \[\left(x + y\right) \cdot z\]
  2. Taylor expanded around inf 0.0

    \[\leadsto \color{blue}{x \cdot z + z \cdot y}\]
  3. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, z, z \cdot y\right)}\]
  4. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(x, z, z \cdot y\right)\]

Reproduce

herbie shell --seed 2020035 +o rules:numerics
(FPCore (x y z)
  :name "Text.Parsec.Token:makeTokenParser from parsec-3.1.9, B"
  :precision binary64
  (* (+ x y) z))