Average Error: 0.0 → 0.0
Time: 6.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 r16235 = x;
        double r16236 = y;
        double r16237 = r16235 * r16236;
        double r16238 = 1.0;
        double r16239 = r16235 - r16238;
        double r16240 = z;
        double r16241 = r16239 * r16240;
        double r16242 = r16237 + r16241;
        return r16242;
}

double f(double x, double y, double z) {
        double r16243 = x;
        double r16244 = y;
        double r16245 = 1.0;
        double r16246 = r16243 - r16245;
        double r16247 = z;
        double r16248 = r16246 * r16247;
        double r16249 = fma(r16243, r16244, r16248);
        return r16249;
}

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