Average Error: 0.0 → 0.0
Time: 4.2s
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 r140274 = x;
        double r140275 = y;
        double r140276 = r140274 * r140275;
        double r140277 = 1.0;
        double r140278 = r140274 - r140277;
        double r140279 = z;
        double r140280 = r140278 * r140279;
        double r140281 = r140276 + r140280;
        return r140281;
}

double f(double x, double y, double z) {
        double r140282 = x;
        double r140283 = y;
        double r140284 = 1.0;
        double r140285 = r140282 - r140284;
        double r140286 = z;
        double r140287 = r140285 * r140286;
        double r140288 = fma(r140282, r140283, r140287);
        return r140288;
}

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