Average Error: 0.0 → 0.0
Time: 11.6s
Precision: 64
\[x \cdot y + \left(x - 1\right) \cdot z\]
\[\mathsf{fma}\left(x - 1, z, x \cdot y\right)\]
x \cdot y + \left(x - 1\right) \cdot z
\mathsf{fma}\left(x - 1, z, x \cdot y\right)
double f(double x, double y, double z) {
        double r115048 = x;
        double r115049 = y;
        double r115050 = r115048 * r115049;
        double r115051 = 1.0;
        double r115052 = r115048 - r115051;
        double r115053 = z;
        double r115054 = r115052 * r115053;
        double r115055 = r115050 + r115054;
        return r115055;
}

double f(double x, double y, double z) {
        double r115056 = x;
        double r115057 = 1.0;
        double r115058 = r115056 - r115057;
        double r115059 = z;
        double r115060 = y;
        double r115061 = r115056 * r115060;
        double r115062 = fma(r115058, r115059, r115061);
        return r115062;
}

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. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{\left(x \cdot z + x \cdot y\right) - 1 \cdot z}\]
  3. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x - 1, z, x \cdot y\right)}\]
  4. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(x - 1, z, x \cdot y\right)\]

Reproduce

herbie shell --seed 2019325 +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)))