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 r141667 = x;
        double r141668 = y;
        double r141669 = r141667 * r141668;
        double r141670 = 1.0;
        double r141671 = r141667 - r141670;
        double r141672 = z;
        double r141673 = r141671 * r141672;
        double r141674 = r141669 + r141673;
        return r141674;
}

double f(double x, double y, double z) {
        double r141675 = x;
        double r141676 = y;
        double r141677 = 1.0;
        double r141678 = r141675 - r141677;
        double r141679 = z;
        double r141680 = r141678 * r141679;
        double r141681 = fma(r141675, r141676, r141680);
        return r141681;
}

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