Average Error: 0.0 → 0.0
Time: 3.7s
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 r172301 = x;
        double r172302 = y;
        double r172303 = r172301 * r172302;
        double r172304 = 1.0;
        double r172305 = r172301 - r172304;
        double r172306 = z;
        double r172307 = r172305 * r172306;
        double r172308 = r172303 + r172307;
        return r172308;
}

double f(double x, double y, double z) {
        double r172309 = x;
        double r172310 = y;
        double r172311 = 1.0;
        double r172312 = r172309 - r172311;
        double r172313 = z;
        double r172314 = r172312 * r172313;
        double r172315 = fma(r172309, r172310, r172314);
        return r172315;
}

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