Average Error: 0.0 → 0.0
Time: 5.1s
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 r829 = x;
        double r830 = y;
        double r831 = r829 * r830;
        double r832 = 1.0;
        double r833 = r829 - r832;
        double r834 = z;
        double r835 = r833 * r834;
        double r836 = r831 + r835;
        return r836;
}

double f(double x, double y, double z) {
        double r837 = x;
        double r838 = y;
        double r839 = 1.0;
        double r840 = r837 - r839;
        double r841 = z;
        double r842 = r840 * r841;
        double r843 = fma(r837, r838, r842);
        return r843;
}

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