Average Error: 0.0 → 0.0
Time: 14.0s
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 r113099 = x;
        double r113100 = y;
        double r113101 = r113099 * r113100;
        double r113102 = 1.0;
        double r113103 = r113099 - r113102;
        double r113104 = z;
        double r113105 = r113103 * r113104;
        double r113106 = r113101 + r113105;
        return r113106;
}

double f(double x, double y, double z) {
        double r113107 = x;
        double r113108 = y;
        double r113109 = 1.0;
        double r113110 = r113107 - r113109;
        double r113111 = z;
        double r113112 = r113110 * r113111;
        double r113113 = fma(r113107, r113108, r113112);
        return r113113;
}

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