Average Error: 0.0 → 0.0
Time: 21.5s
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 r25177788 = x;
        double r25177789 = y;
        double r25177790 = r25177788 * r25177789;
        double r25177791 = 1.0;
        double r25177792 = r25177788 - r25177791;
        double r25177793 = z;
        double r25177794 = r25177792 * r25177793;
        double r25177795 = r25177790 + r25177794;
        return r25177795;
}

double f(double x, double y, double z) {
        double r25177796 = x;
        double r25177797 = y;
        double r25177798 = 1.0;
        double r25177799 = z;
        double r25177800 = r25177796 * r25177799;
        double r25177801 = r25177800 - r25177799;
        double r25177802 = r25177798 * r25177801;
        double r25177803 = fma(r25177796, r25177797, r25177802);
        return r25177803;
}

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

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

    \[\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 2019173 +o rules:numerics
(FPCore (x y z)
  :name "Graphics.Rendering.Chart.Drawing:drawTextsR from Chart-1.5.3"
  (+ (* x y) (* (- x 1.0) z)))