Average Error: 0.0 → 0.0
Time: 1.7s
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 r1934 = x;
        double r1935 = y;
        double r1936 = r1934 + r1935;
        double r1937 = z;
        double r1938 = r1936 * r1937;
        return r1938;
}

double f(double x, double y, double z) {
        double r1939 = x;
        double r1940 = z;
        double r1941 = y;
        double r1942 = r1940 * r1941;
        double r1943 = fma(r1939, r1940, r1942);
        return r1943;
}

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 pow10.0

    \[\leadsto \left(x + y\right) \cdot \color{blue}{{z}^{1}}\]
  4. Applied pow10.0

    \[\leadsto \color{blue}{{\left(x + y\right)}^{1}} \cdot {z}^{1}\]
  5. Applied pow-prod-down0.0

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

    \[\leadsto {\color{blue}{\left(\mathsf{fma}\left(x, z, z \cdot y\right)\right)}}^{1}\]
  7. 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))