Average Error: 0.0 → 0.0
Time: 9.4s
Precision: 64
\[x \cdot y + \left(x - 1\right) \cdot z\]
\[\mathsf{fma}\left(x, y, 1 \cdot \left(x \cdot z - z\right)\right)\]
x \cdot y + \left(x - 1\right) \cdot z
\mathsf{fma}\left(x, y, 1 \cdot \left(x \cdot z - z\right)\right)
double f(double x, double y, double z) {
        double r132991 = x;
        double r132992 = y;
        double r132993 = r132991 * r132992;
        double r132994 = 1.0;
        double r132995 = r132991 - r132994;
        double r132996 = z;
        double r132997 = r132995 * r132996;
        double r132998 = r132993 + r132997;
        return r132998;
}

double f(double x, double y, double z) {
        double r132999 = x;
        double r133000 = y;
        double r133001 = 1.0;
        double r133002 = z;
        double r133003 = r132999 * r133002;
        double r133004 = r133003 - r133002;
        double r133005 = r133001 * r133004;
        double r133006 = fma(r132999, r133000, r133005);
        return r133006;
}

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. Using strategy rm
  4. Applied flip--7.8

    \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\frac{x \cdot x - 1 \cdot 1}{x + 1}} \cdot z\right)\]
  5. Applied associate-*l/10.1

    \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\frac{\left(x \cdot x - 1 \cdot 1\right) \cdot z}{x + 1}}\right)\]
  6. Taylor expanded around 0 0.0

    \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{1 \cdot \left(x \cdot z\right) - 1 \cdot z}\right)\]
  7. Simplified0.0

    \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{1 \cdot \left(x \cdot z - z\right)}\right)\]
  8. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(x, y, 1 \cdot \left(x \cdot z - z\right)\right)\]

Reproduce

herbie shell --seed 2019303 +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)))