Average Error: 0.0 → 0.0
Time: 10.9s
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 r125397 = x;
        double r125398 = y;
        double r125399 = r125397 * r125398;
        double r125400 = 1.0;
        double r125401 = r125397 - r125400;
        double r125402 = z;
        double r125403 = r125401 * r125402;
        double r125404 = r125399 + r125403;
        return r125404;
}

double f(double x, double y, double z) {
        double r125405 = x;
        double r125406 = y;
        double r125407 = 1.0;
        double r125408 = r125405 - r125407;
        double r125409 = z;
        double r125410 = r125408 * r125409;
        double r125411 = fma(r125405, r125406, r125410);
        return r125411;
}

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