Average Error: 0.0 → 0.0
Time: 1.3s
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 r925 = x;
        double r926 = y;
        double r927 = r925 + r926;
        double r928 = z;
        double r929 = r927 * r928;
        return r929;
}

double f(double x, double y, double z) {
        double r930 = x;
        double r931 = z;
        double r932 = y;
        double r933 = r931 * r932;
        double r934 = fma(r930, r931, r933);
        return r934;
}

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. Using strategy rm
  3. Applied *-un-lft-identity0.0

    \[\leadsto \color{blue}{\left(1 \cdot \left(x + y\right)\right)} \cdot z\]
  4. Applied associate-*l*0.0

    \[\leadsto \color{blue}{1 \cdot \left(\left(x + y\right) \cdot z\right)}\]
  5. Simplified0.0

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

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

Reproduce

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