Average Error: 0.0 → 0.0
Time: 9.0s
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 r133824 = x;
        double r133825 = y;
        double r133826 = r133824 * r133825;
        double r133827 = 1.0;
        double r133828 = r133824 - r133827;
        double r133829 = z;
        double r133830 = r133828 * r133829;
        double r133831 = r133826 + r133830;
        return r133831;
}

double f(double x, double y, double z) {
        double r133832 = x;
        double r133833 = y;
        double r133834 = 1.0;
        double r133835 = z;
        double r133836 = r133832 * r133835;
        double r133837 = r133836 - r133835;
        double r133838 = r133834 * r133837;
        double r133839 = fma(r133832, r133833, r133838);
        return r133839;
}

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