Average Error: 0.0 → 0.0
Time: 2.2s
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 r148529 = x;
        double r148530 = y;
        double r148531 = r148529 * r148530;
        double r148532 = 1.0;
        double r148533 = r148529 - r148532;
        double r148534 = z;
        double r148535 = r148533 * r148534;
        double r148536 = r148531 + r148535;
        return r148536;
}

double f(double x, double y, double z) {
        double r148537 = x;
        double r148538 = y;
        double r148539 = 1.0;
        double r148540 = r148537 - r148539;
        double r148541 = z;
        double r148542 = r148540 * r148541;
        double r148543 = fma(r148537, r148538, r148542);
        return r148543;
}

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