Average Error: 0.0 → 0.0
Time: 6.5s
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 r166550 = x;
        double r166551 = y;
        double r166552 = r166550 * r166551;
        double r166553 = 1.0;
        double r166554 = r166550 - r166553;
        double r166555 = z;
        double r166556 = r166554 * r166555;
        double r166557 = r166552 + r166556;
        return r166557;
}

double f(double x, double y, double z) {
        double r166558 = x;
        double r166559 = y;
        double r166560 = 1.0;
        double r166561 = r166558 - r166560;
        double r166562 = z;
        double r166563 = r166561 * r166562;
        double r166564 = fma(r166558, r166559, r166563);
        return r166564;
}

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