Average Error: 0.0 → 0.0
Time: 3.3s
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 r134424 = x;
        double r134425 = y;
        double r134426 = r134424 * r134425;
        double r134427 = 1.0;
        double r134428 = r134424 - r134427;
        double r134429 = z;
        double r134430 = r134428 * r134429;
        double r134431 = r134426 + r134430;
        return r134431;
}

double f(double x, double y, double z) {
        double r134432 = x;
        double r134433 = y;
        double r134434 = 1.0;
        double r134435 = r134432 - r134434;
        double r134436 = z;
        double r134437 = r134435 * r134436;
        double r134438 = fma(r134432, r134433, r134437);
        return r134438;
}

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