Average Error: 0.0 → 0.0
Time: 2.4s
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 r141042 = x;
        double r141043 = y;
        double r141044 = r141042 * r141043;
        double r141045 = 1.0;
        double r141046 = r141042 - r141045;
        double r141047 = z;
        double r141048 = r141046 * r141047;
        double r141049 = r141044 + r141048;
        return r141049;
}

double f(double x, double y, double z) {
        double r141050 = x;
        double r141051 = y;
        double r141052 = 1.0;
        double r141053 = r141050 - r141052;
        double r141054 = z;
        double r141055 = r141053 * r141054;
        double r141056 = fma(r141050, r141051, r141055);
        return r141056;
}

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