Average Error: 0.0 → 0.0
Time: 9.2s
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 r109512 = x;
        double r109513 = y;
        double r109514 = r109512 * r109513;
        double r109515 = 1.0;
        double r109516 = r109512 - r109515;
        double r109517 = z;
        double r109518 = r109516 * r109517;
        double r109519 = r109514 + r109518;
        return r109519;
}

double f(double x, double y, double z) {
        double r109520 = x;
        double r109521 = y;
        double r109522 = 1.0;
        double r109523 = r109520 - r109522;
        double r109524 = z;
        double r109525 = r109523 * r109524;
        double r109526 = fma(r109520, r109521, r109525);
        return r109526;
}

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