Average Error: 0.0 → 0.0
Time: 17.6s
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 r149526 = x;
        double r149527 = y;
        double r149528 = r149526 * r149527;
        double r149529 = 1.0;
        double r149530 = r149526 - r149529;
        double r149531 = z;
        double r149532 = r149530 * r149531;
        double r149533 = r149528 + r149532;
        return r149533;
}

double f(double x, double y, double z) {
        double r149534 = x;
        double r149535 = y;
        double r149536 = 1.0;
        double r149537 = r149534 - r149536;
        double r149538 = z;
        double r149539 = r149537 * r149538;
        double r149540 = fma(r149534, r149535, r149539);
        return r149540;
}

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