Average Error: 0.0 → 0.0
Time: 2.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 r180041 = x;
        double r180042 = y;
        double r180043 = r180041 * r180042;
        double r180044 = 1.0;
        double r180045 = r180041 - r180044;
        double r180046 = z;
        double r180047 = r180045 * r180046;
        double r180048 = r180043 + r180047;
        return r180048;
}

double f(double x, double y, double z) {
        double r180049 = x;
        double r180050 = y;
        double r180051 = 1.0;
        double r180052 = r180049 - r180051;
        double r180053 = z;
        double r180054 = r180052 * r180053;
        double r180055 = fma(r180049, r180050, r180054);
        return r180055;
}

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