Average Error: 0.0 → 0.0
Time: 4.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 r207926 = x;
        double r207927 = y;
        double r207928 = r207926 * r207927;
        double r207929 = 1.0;
        double r207930 = r207926 - r207929;
        double r207931 = z;
        double r207932 = r207930 * r207931;
        double r207933 = r207928 + r207932;
        return r207933;
}

double f(double x, double y, double z) {
        double r207934 = x;
        double r207935 = y;
        double r207936 = 1.0;
        double r207937 = r207934 - r207936;
        double r207938 = z;
        double r207939 = r207937 * r207938;
        double r207940 = fma(r207934, r207935, r207939);
        return r207940;
}

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