Average Error: 0.0 → 0.0
Time: 4.6s
Precision: 64
\[\left(x + y\right) - x \cdot y\]
\[\mathsf{fma}\left(-y, x, x + y\right)\]
\left(x + y\right) - x \cdot y
\mathsf{fma}\left(-y, x, x + y\right)
double f(double x, double y) {
        double r156888 = x;
        double r156889 = y;
        double r156890 = r156888 + r156889;
        double r156891 = r156888 * r156889;
        double r156892 = r156890 - r156891;
        return r156892;
}

double f(double x, double y) {
        double r156893 = y;
        double r156894 = -r156893;
        double r156895 = x;
        double r156896 = r156895 + r156893;
        double r156897 = fma(r156894, r156895, r156896);
        return r156897;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[\left(x + y\right) - x \cdot y\]
  2. Taylor expanded around 0 0.0

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(-y, x, x + y\right)}\]
  4. Final simplification0.0

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

Reproduce

herbie shell --seed 2019323 +o rules:numerics
(FPCore (x y)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, A"
  :precision binary64
  (- (+ x y) (* x y)))