Average Error: 0.0 → 0.0
Time: 1.2s
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 r144746 = x;
        double r144747 = y;
        double r144748 = r144746 * r144747;
        double r144749 = 1.0;
        double r144750 = r144746 - r144749;
        double r144751 = z;
        double r144752 = r144750 * r144751;
        double r144753 = r144748 + r144752;
        return r144753;
}

double f(double x, double y, double z) {
        double r144754 = x;
        double r144755 = y;
        double r144756 = 1.0;
        double r144757 = r144754 - r144756;
        double r144758 = z;
        double r144759 = r144757 * r144758;
        double r144760 = fma(r144754, r144755, r144759);
        return r144760;
}

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