Average Error: 0.0 → 0.0
Time: 1.8s
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 r167340 = x;
        double r167341 = y;
        double r167342 = r167340 * r167341;
        double r167343 = 1.0;
        double r167344 = r167340 - r167343;
        double r167345 = z;
        double r167346 = r167344 * r167345;
        double r167347 = r167342 + r167346;
        return r167347;
}

double f(double x, double y, double z) {
        double r167348 = x;
        double r167349 = y;
        double r167350 = 1.0;
        double r167351 = z;
        double r167352 = r167348 * r167351;
        double r167353 = r167352 - r167351;
        double r167354 = r167350 * r167353;
        double r167355 = fma(r167348, r167349, r167354);
        return r167355;
}

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 flip3--12.0

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

    \[\leadsto \mathsf{fma}\left(x, y, \color{blue}{\frac{\left({x}^{3} - {1}^{3}\right) \cdot z}{x \cdot x + \left(1 \cdot 1 + x \cdot 1\right)}}\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 2020083 +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)))