Average Error: 0.0 → 0.0
Time: 734.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 r140903 = x;
        double r140904 = y;
        double r140905 = r140903 * r140904;
        double r140906 = 1.0;
        double r140907 = r140903 - r140906;
        double r140908 = z;
        double r140909 = r140907 * r140908;
        double r140910 = r140905 + r140909;
        return r140910;
}

double f(double x, double y, double z) {
        double r140911 = x;
        double r140912 = y;
        double r140913 = 1.0;
        double r140914 = r140911 - r140913;
        double r140915 = z;
        double r140916 = r140914 * r140915;
        double r140917 = fma(r140911, r140912, r140916);
        return r140917;
}

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