Average Error: 0.0 → 0.0
Time: 762.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 r151885 = x;
        double r151886 = y;
        double r151887 = r151885 * r151886;
        double r151888 = 1.0;
        double r151889 = r151885 - r151888;
        double r151890 = z;
        double r151891 = r151889 * r151890;
        double r151892 = r151887 + r151891;
        return r151892;
}

double f(double x, double y, double z) {
        double r151893 = x;
        double r151894 = y;
        double r151895 = 1.0;
        double r151896 = r151893 - r151895;
        double r151897 = z;
        double r151898 = r151896 * r151897;
        double r151899 = fma(r151893, r151894, r151898);
        return r151899;
}

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