Average Error: 0.0 → 0.0
Time: 17.8s
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 r113204 = x;
        double r113205 = y;
        double r113206 = r113204 * r113205;
        double r113207 = 1.0;
        double r113208 = r113204 - r113207;
        double r113209 = z;
        double r113210 = r113208 * r113209;
        double r113211 = r113206 + r113210;
        return r113211;
}

double f(double x, double y, double z) {
        double r113212 = x;
        double r113213 = y;
        double r113214 = 1.0;
        double r113215 = r113212 - r113214;
        double r113216 = z;
        double r113217 = r113215 * r113216;
        double r113218 = fma(r113212, r113213, r113217);
        return r113218;
}

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