Average Error: 0.0 → 0.0
Time: 2.0s
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 r171185 = x;
        double r171186 = y;
        double r171187 = r171185 * r171186;
        double r171188 = 1.0;
        double r171189 = r171185 - r171188;
        double r171190 = z;
        double r171191 = r171189 * r171190;
        double r171192 = r171187 + r171191;
        return r171192;
}

double f(double x, double y, double z) {
        double r171193 = x;
        double r171194 = y;
        double r171195 = 1.0;
        double r171196 = r171193 - r171195;
        double r171197 = z;
        double r171198 = r171196 * r171197;
        double r171199 = fma(r171193, r171194, r171198);
        return r171199;
}

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