Average Error: 0.0 → 0.0
Time: 3.7s
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 r162940 = x;
        double r162941 = y;
        double r162942 = r162940 * r162941;
        double r162943 = 1.0;
        double r162944 = r162940 - r162943;
        double r162945 = z;
        double r162946 = r162944 * r162945;
        double r162947 = r162942 + r162946;
        return r162947;
}

double f(double x, double y, double z) {
        double r162948 = x;
        double r162949 = y;
        double r162950 = 1.0;
        double r162951 = r162948 - r162950;
        double r162952 = z;
        double r162953 = r162951 * r162952;
        double r162954 = fma(r162948, r162949, r162953);
        return r162954;
}

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