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 r139777 = x;
        double r139778 = y;
        double r139779 = r139777 * r139778;
        double r139780 = 1.0;
        double r139781 = r139777 - r139780;
        double r139782 = z;
        double r139783 = r139781 * r139782;
        double r139784 = r139779 + r139783;
        return r139784;
}

double f(double x, double y, double z) {
        double r139785 = x;
        double r139786 = y;
        double r139787 = 1.0;
        double r139788 = r139785 - r139787;
        double r139789 = z;
        double r139790 = r139788 * r139789;
        double r139791 = fma(r139785, r139786, r139790);
        return r139791;
}

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