Average Error: 0.0 → 0.0
Time: 2.6s
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 r211234 = x;
        double r211235 = y;
        double r211236 = r211234 * r211235;
        double r211237 = 1.0;
        double r211238 = r211234 - r211237;
        double r211239 = z;
        double r211240 = r211238 * r211239;
        double r211241 = r211236 + r211240;
        return r211241;
}

double f(double x, double y, double z) {
        double r211242 = x;
        double r211243 = y;
        double r211244 = 1.0;
        double r211245 = r211242 - r211244;
        double r211246 = z;
        double r211247 = r211245 * r211246;
        double r211248 = fma(r211242, r211243, r211247);
        return r211248;
}

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 2019362 +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)))