Average Error: 0.0 → 0.0
Time: 5.9s
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 r124353 = x;
        double r124354 = y;
        double r124355 = r124353 * r124354;
        double r124356 = 1.0;
        double r124357 = r124353 - r124356;
        double r124358 = z;
        double r124359 = r124357 * r124358;
        double r124360 = r124355 + r124359;
        return r124360;
}

double f(double x, double y, double z) {
        double r124361 = x;
        double r124362 = y;
        double r124363 = 1.0;
        double r124364 = r124361 - r124363;
        double r124365 = z;
        double r124366 = r124364 * r124365;
        double r124367 = fma(r124361, r124362, r124366);
        return r124367;
}

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