Average Error: 0.0 → 0.0
Time: 2.9s
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 r191545 = x;
        double r191546 = y;
        double r191547 = r191545 * r191546;
        double r191548 = 1.0;
        double r191549 = r191545 - r191548;
        double r191550 = z;
        double r191551 = r191549 * r191550;
        double r191552 = r191547 + r191551;
        return r191552;
}

double f(double x, double y, double z) {
        double r191553 = x;
        double r191554 = y;
        double r191555 = 1.0;
        double r191556 = z;
        double r191557 = r191553 * r191556;
        double r191558 = r191557 - r191556;
        double r191559 = r191555 * r191558;
        double r191560 = fma(r191553, r191554, r191559);
        return r191560;
}

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

    \[\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 2019352 +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)))