Average Error: 0.0 → 0.0
Time: 2.1s
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 r129559 = x;
        double r129560 = y;
        double r129561 = r129559 * r129560;
        double r129562 = 1.0;
        double r129563 = r129559 - r129562;
        double r129564 = z;
        double r129565 = r129563 * r129564;
        double r129566 = r129561 + r129565;
        return r129566;
}

double f(double x, double y, double z) {
        double r129567 = x;
        double r129568 = y;
        double r129569 = 1.0;
        double r129570 = r129567 - r129569;
        double r129571 = z;
        double r129572 = r129570 * r129571;
        double r129573 = fma(r129567, r129568, r129572);
        return r129573;
}

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