Average Error: 0.0 → 0.0
Time: 3.4s
Precision: 64
\[x \cdot y + \left(x - 1\right) \cdot z\]
\[\mathsf{fma}\left(x, y, \left(x - 1\right) \cdot z\right)\]
x \cdot y + \left(x - 1\right) \cdot z
\mathsf{fma}\left(x, y, \left(x - 1\right) \cdot z\right)
double f(double x, double y, double z) {
        double r134933 = x;
        double r134934 = y;
        double r134935 = r134933 * r134934;
        double r134936 = 1.0;
        double r134937 = r134933 - r134936;
        double r134938 = z;
        double r134939 = r134937 * r134938;
        double r134940 = r134935 + r134939;
        return r134940;
}

double f(double x, double y, double z) {
        double r134941 = x;
        double r134942 = y;
        double r134943 = 1.0;
        double r134944 = r134941 - r134943;
        double r134945 = z;
        double r134946 = r134944 * r134945;
        double r134947 = fma(r134941, r134942, r134946);
        return r134947;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Derivation

  1. Initial program 0.0

    \[x \cdot y + \left(x - 1\right) \cdot z\]
  2. Simplified0.0

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

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

Reproduce

herbie shell --seed 2020047 +o rules:numerics
(FPCore (x y z)
  :name "Graphics.Rendering.Chart.Drawing:drawTextsR from Chart-1.5.3"
  :precision binary64
  (+ (* x y) (* (- x 1) z)))