Average Error: 0.0 → 0.0
Time: 4.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 r162041 = x;
        double r162042 = y;
        double r162043 = r162041 * r162042;
        double r162044 = 1.0;
        double r162045 = r162041 - r162044;
        double r162046 = z;
        double r162047 = r162045 * r162046;
        double r162048 = r162043 + r162047;
        return r162048;
}

double f(double x, double y, double z) {
        double r162049 = x;
        double r162050 = y;
        double r162051 = 1.0;
        double r162052 = r162049 - r162051;
        double r162053 = z;
        double r162054 = r162052 * r162053;
        double r162055 = fma(r162049, r162050, r162054);
        return r162055;
}

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