Average Error: 0.0 → 0.0
Time: 1.9s
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 r134126 = x;
        double r134127 = y;
        double r134128 = r134126 * r134127;
        double r134129 = 1.0;
        double r134130 = r134126 - r134129;
        double r134131 = z;
        double r134132 = r134130 * r134131;
        double r134133 = r134128 + r134132;
        return r134133;
}

double f(double x, double y, double z) {
        double r134134 = x;
        double r134135 = y;
        double r134136 = 1.0;
        double r134137 = r134134 - r134136;
        double r134138 = z;
        double r134139 = r134137 * r134138;
        double r134140 = fma(r134134, r134135, r134139);
        return r134140;
}

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