Average Error: 0.0 → 0.0
Time: 10.5s
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 r127394 = x;
        double r127395 = y;
        double r127396 = r127394 * r127395;
        double r127397 = 1.0;
        double r127398 = r127394 - r127397;
        double r127399 = z;
        double r127400 = r127398 * r127399;
        double r127401 = r127396 + r127400;
        return r127401;
}

double f(double x, double y, double z) {
        double r127402 = x;
        double r127403 = y;
        double r127404 = 1.0;
        double r127405 = r127402 - r127404;
        double r127406 = z;
        double r127407 = r127405 * r127406;
        double r127408 = fma(r127402, r127403, r127407);
        return r127408;
}

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