Average Error: 0.0 → 0.0
Time: 11.9s
Precision: 64
\[x \cdot y + \left(x - 1\right) \cdot z\]
\[\mathsf{fma}\left(x, y, 1 \cdot \left(z \cdot x - z\right)\right)\]
x \cdot y + \left(x - 1\right) \cdot z
\mathsf{fma}\left(x, y, 1 \cdot \left(z \cdot x - z\right)\right)
double f(double x, double y, double z) {
        double r6417121 = x;
        double r6417122 = y;
        double r6417123 = r6417121 * r6417122;
        double r6417124 = 1.0;
        double r6417125 = r6417121 - r6417124;
        double r6417126 = z;
        double r6417127 = r6417125 * r6417126;
        double r6417128 = r6417123 + r6417127;
        return r6417128;
}

double f(double x, double y, double z) {
        double r6417129 = x;
        double r6417130 = y;
        double r6417131 = 1.0;
        double r6417132 = z;
        double r6417133 = r6417132 * r6417129;
        double r6417134 = r6417133 - r6417132;
        double r6417135 = r6417131 * r6417134;
        double r6417136 = fma(r6417129, r6417130, r6417135);
        return r6417136;
}

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

    \[\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.6

    \[\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(z \cdot x - z\right)}\right)\]
  8. Final simplification0.0

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

Reproduce

herbie shell --seed 2019172 +o rules:numerics
(FPCore (x y z)
  :name "Graphics.Rendering.Chart.Drawing:drawTextsR from Chart-1.5.3"
  (+ (* x y) (* (- x 1.0) z)))