Average Error: 0.0 → 0.0
Time: 1.3s
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 r132005 = x;
        double r132006 = y;
        double r132007 = r132005 * r132006;
        double r132008 = 1.0;
        double r132009 = r132005 - r132008;
        double r132010 = z;
        double r132011 = r132009 * r132010;
        double r132012 = r132007 + r132011;
        return r132012;
}

double f(double x, double y, double z) {
        double r132013 = x;
        double r132014 = y;
        double r132015 = 1.0;
        double r132016 = r132013 - r132015;
        double r132017 = z;
        double r132018 = r132016 * r132017;
        double r132019 = fma(r132013, r132014, r132018);
        return r132019;
}

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