Average Error: 0.0 → 0.0
Time: 1.3s
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 r222006 = x;
        double r222007 = y;
        double r222008 = r222006 * r222007;
        double r222009 = 1.0;
        double r222010 = r222006 - r222009;
        double r222011 = z;
        double r222012 = r222010 * r222011;
        double r222013 = r222008 + r222012;
        return r222013;
}

double f(double x, double y, double z) {
        double r222014 = x;
        double r222015 = y;
        double r222016 = 1.0;
        double r222017 = r222014 - r222016;
        double r222018 = z;
        double r222019 = r222017 * r222018;
        double r222020 = fma(r222014, r222015, r222019);
        return r222020;
}

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