Average Error: 0.0 → 0.0
Time: 748.0ms
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 r139992 = x;
        double r139993 = y;
        double r139994 = r139992 * r139993;
        double r139995 = 1.0;
        double r139996 = r139992 - r139995;
        double r139997 = z;
        double r139998 = r139996 * r139997;
        double r139999 = r139994 + r139998;
        return r139999;
}

double f(double x, double y, double z) {
        double r140000 = x;
        double r140001 = y;
        double r140002 = 1.0;
        double r140003 = r140000 - r140002;
        double r140004 = z;
        double r140005 = r140003 * r140004;
        double r140006 = fma(r140000, r140001, r140005);
        return r140006;
}

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