Average Error: 0.0 → 0.0
Time: 12.4s
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 r107852 = x;
        double r107853 = y;
        double r107854 = r107852 * r107853;
        double r107855 = 1.0;
        double r107856 = r107852 - r107855;
        double r107857 = z;
        double r107858 = r107856 * r107857;
        double r107859 = r107854 + r107858;
        return r107859;
}

double f(double x, double y, double z) {
        double r107860 = x;
        double r107861 = y;
        double r107862 = 1.0;
        double r107863 = r107860 - r107862;
        double r107864 = z;
        double r107865 = r107863 * r107864;
        double r107866 = fma(r107860, r107861, r107865);
        return r107866;
}

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