Average Error: 0.0 → 0.0
Time: 4.8s
Precision: 64
\[x \cdot y + \left(x - 1\right) \cdot z\]
\[\mathsf{fma}\left(z, x - 1, x \cdot y\right)\]
x \cdot y + \left(x - 1\right) \cdot z
\mathsf{fma}\left(z, x - 1, x \cdot y\right)
double f(double x, double y, double z) {
        double r114963 = x;
        double r114964 = y;
        double r114965 = r114963 * r114964;
        double r114966 = 1.0;
        double r114967 = r114963 - r114966;
        double r114968 = z;
        double r114969 = r114967 * r114968;
        double r114970 = r114965 + r114969;
        return r114970;
}

double f(double x, double y, double z) {
        double r114971 = z;
        double r114972 = x;
        double r114973 = 1.0;
        double r114974 = r114972 - r114973;
        double r114975 = y;
        double r114976 = r114972 * r114975;
        double r114977 = fma(r114971, r114974, r114976);
        return r114977;
}

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. Taylor expanded around 0 0.0

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

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

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

Reproduce

herbie shell --seed 2019350 +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)))