Average Error: 0.0 → 0.0
Time: 7.0s
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 r94188 = x;
        double r94189 = y;
        double r94190 = r94188 * r94189;
        double r94191 = 1.0;
        double r94192 = r94188 - r94191;
        double r94193 = z;
        double r94194 = r94192 * r94193;
        double r94195 = r94190 + r94194;
        return r94195;
}

double f(double x, double y, double z) {
        double r94196 = x;
        double r94197 = y;
        double r94198 = 1.0;
        double r94199 = r94196 - r94198;
        double r94200 = z;
        double r94201 = r94199 * r94200;
        double r94202 = fma(r94196, r94197, r94201);
        return r94202;
}

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