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 r1941 = x;
        double r1942 = y;
        double r1943 = r1941 + r1942;
        double r1944 = z;
        double r1945 = r1943 * r1944;
        return r1945;
}

double f(double x, double y, double z) {
        double r1946 = x;
        double r1947 = z;
        double r1948 = y;
        double r1949 = r1947 * r1948;
        double r1950 = fma(r1946, r1947, r1949);
        return r1950;
}

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