Average Error: 0.0 → 0.0
Time: 1.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 r147109 = x;
        double r147110 = y;
        double r147111 = r147109 * r147110;
        double r147112 = 1.0;
        double r147113 = r147109 - r147112;
        double r147114 = z;
        double r147115 = r147113 * r147114;
        double r147116 = r147111 + r147115;
        return r147116;
}

double f(double x, double y, double z) {
        double r147117 = x;
        double r147118 = y;
        double r147119 = 1.0;
        double r147120 = r147117 - r147119;
        double r147121 = z;
        double r147122 = r147120 * r147121;
        double r147123 = fma(r147117, r147118, r147122);
        return r147123;
}

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