Average Error: 0.0 → 0.0
Time: 1.6s
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 r2514 = x;
        double r2515 = y;
        double r2516 = r2514 + r2515;
        double r2517 = z;
        double r2518 = r2516 * r2517;
        return r2518;
}

double f(double x, double y, double z) {
        double r2519 = x;
        double r2520 = z;
        double r2521 = y;
        double r2522 = r2520 * r2521;
        double r2523 = fma(r2519, r2520, r2522);
        return r2523;
}

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 2020033 +o rules:numerics
(FPCore (x y z)
  :name "Text.Parsec.Token:makeTokenParser from parsec-3.1.9, B"
  :precision binary64
  (* (+ x y) z))