Average Error: 0.0 → 0.0
Time: 3.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 r163521 = x;
        double r163522 = y;
        double r163523 = r163521 * r163522;
        double r163524 = 1.0;
        double r163525 = r163521 - r163524;
        double r163526 = z;
        double r163527 = r163525 * r163526;
        double r163528 = r163523 + r163527;
        return r163528;
}

double f(double x, double y, double z) {
        double r163529 = x;
        double r163530 = y;
        double r163531 = 1.0;
        double r163532 = r163529 - r163531;
        double r163533 = z;
        double r163534 = r163532 * r163533;
        double r163535 = fma(r163529, r163530, r163534);
        return r163535;
}

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