Average Error: 0.0 → 0.0
Time: 765.0ms
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 r106020 = x;
        double r106021 = y;
        double r106022 = r106020 * r106021;
        double r106023 = 1.0;
        double r106024 = r106020 - r106023;
        double r106025 = z;
        double r106026 = r106024 * r106025;
        double r106027 = r106022 + r106026;
        return r106027;
}

double f(double x, double y, double z) {
        double r106028 = x;
        double r106029 = y;
        double r106030 = 1.0;
        double r106031 = r106028 - r106030;
        double r106032 = z;
        double r106033 = r106031 * r106032;
        double r106034 = fma(r106028, r106029, r106033);
        return r106034;
}

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