Average Error: 0.0 → 0.0
Time: 2.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 r135626 = x;
        double r135627 = y;
        double r135628 = r135626 * r135627;
        double r135629 = 1.0;
        double r135630 = r135626 - r135629;
        double r135631 = z;
        double r135632 = r135630 * r135631;
        double r135633 = r135628 + r135632;
        return r135633;
}

double f(double x, double y, double z) {
        double r135634 = x;
        double r135635 = y;
        double r135636 = 1.0;
        double r135637 = r135634 - r135636;
        double r135638 = z;
        double r135639 = r135637 * r135638;
        double r135640 = fma(r135634, r135635, r135639);
        return r135640;
}

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