Average Error: 0.0 → 0.0
Time: 1.8s
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 r224016 = x;
        double r224017 = y;
        double r224018 = r224016 * r224017;
        double r224019 = 1.0;
        double r224020 = r224016 - r224019;
        double r224021 = z;
        double r224022 = r224020 * r224021;
        double r224023 = r224018 + r224022;
        return r224023;
}

double f(double x, double y, double z) {
        double r224024 = x;
        double r224025 = y;
        double r224026 = 1.0;
        double r224027 = r224024 - r224026;
        double r224028 = z;
        double r224029 = r224027 * r224028;
        double r224030 = fma(r224024, r224025, r224029);
        return r224030;
}

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