Average Error: 0.0 → 0.0
Time: 2.6s
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 r158103 = x;
        double r158104 = y;
        double r158105 = r158103 * r158104;
        double r158106 = 1.0;
        double r158107 = r158103 - r158106;
        double r158108 = z;
        double r158109 = r158107 * r158108;
        double r158110 = r158105 + r158109;
        return r158110;
}

double f(double x, double y, double z) {
        double r158111 = x;
        double r158112 = y;
        double r158113 = 1.0;
        double r158114 = r158111 - r158113;
        double r158115 = z;
        double r158116 = r158114 * r158115;
        double r158117 = fma(r158111, r158112, r158116);
        return r158117;
}

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