Average Error: 0.0 → 0.0
Time: 12.3s
Precision: 64
\[x \cdot y + \left(x - 1.0\right) \cdot z\]
\[\mathsf{fma}\left(x, y, \left(x - 1.0\right) \cdot z\right)\]
x \cdot y + \left(x - 1.0\right) \cdot z
\mathsf{fma}\left(x, y, \left(x - 1.0\right) \cdot z\right)
double f(double x, double y, double z) {
        double r6887249 = x;
        double r6887250 = y;
        double r6887251 = r6887249 * r6887250;
        double r6887252 = 1.0;
        double r6887253 = r6887249 - r6887252;
        double r6887254 = z;
        double r6887255 = r6887253 * r6887254;
        double r6887256 = r6887251 + r6887255;
        return r6887256;
}

double f(double x, double y, double z) {
        double r6887257 = x;
        double r6887258 = y;
        double r6887259 = 1.0;
        double r6887260 = r6887257 - r6887259;
        double r6887261 = z;
        double r6887262 = r6887260 * r6887261;
        double r6887263 = fma(r6887257, r6887258, r6887262);
        return r6887263;
}

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.0\right) \cdot z\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(z, x - 1.0, x \cdot y\right)}\]
  3. Using strategy rm
  4. Applied add-sqr-sqrt32.5

    \[\leadsto \color{blue}{\sqrt{\mathsf{fma}\left(z, x - 1.0, x \cdot y\right)} \cdot \sqrt{\mathsf{fma}\left(z, x - 1.0, x \cdot y\right)}}\]
  5. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{\left(x \cdot z + x \cdot y\right) - 1.0 \cdot z}\]
  6. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, z \cdot \left(x - 1.0\right)\right)}\]
  7. Final simplification0.0

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

Reproduce

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