Average Error: 0.0 → 0.0
Time: 1.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 r165474 = x;
        double r165475 = y;
        double r165476 = r165474 * r165475;
        double r165477 = 1.0;
        double r165478 = r165474 - r165477;
        double r165479 = z;
        double r165480 = r165478 * r165479;
        double r165481 = r165476 + r165480;
        return r165481;
}

double f(double x, double y, double z) {
        double r165482 = x;
        double r165483 = y;
        double r165484 = 1.0;
        double r165485 = r165482 - r165484;
        double r165486 = z;
        double r165487 = r165485 * r165486;
        double r165488 = fma(r165482, r165483, r165487);
        return r165488;
}

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