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 r85518 = x;
        double r85519 = y;
        double r85520 = r85518 * r85519;
        double r85521 = 1.0;
        double r85522 = r85518 - r85521;
        double r85523 = z;
        double r85524 = r85522 * r85523;
        double r85525 = r85520 + r85524;
        return r85525;
}

double f(double x, double y, double z) {
        double r85526 = x;
        double r85527 = y;
        double r85528 = 1.0;
        double r85529 = r85526 - r85528;
        double r85530 = z;
        double r85531 = r85529 * r85530;
        double r85532 = fma(r85526, r85527, r85531);
        return r85532;
}

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