Average Error: 0.0 → 0.0
Time: 1.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 r137595 = x;
        double r137596 = y;
        double r137597 = r137595 * r137596;
        double r137598 = 1.0;
        double r137599 = r137595 - r137598;
        double r137600 = z;
        double r137601 = r137599 * r137600;
        double r137602 = r137597 + r137601;
        return r137602;
}

double f(double x, double y, double z) {
        double r137603 = x;
        double r137604 = y;
        double r137605 = 1.0;
        double r137606 = r137603 - r137605;
        double r137607 = z;
        double r137608 = r137606 * r137607;
        double r137609 = fma(r137603, r137604, r137608);
        return r137609;
}

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