Average Error: 0.0 → 0.0
Time: 4.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 r163914 = x;
        double r163915 = y;
        double r163916 = r163914 * r163915;
        double r163917 = 1.0;
        double r163918 = r163914 - r163917;
        double r163919 = z;
        double r163920 = r163918 * r163919;
        double r163921 = r163916 + r163920;
        return r163921;
}

double f(double x, double y, double z) {
        double r163922 = x;
        double r163923 = y;
        double r163924 = 1.0;
        double r163925 = r163922 - r163924;
        double r163926 = z;
        double r163927 = r163925 * r163926;
        double r163928 = fma(r163922, r163923, r163927);
        return r163928;
}

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