Average Error: 0.0 → 0.0
Time: 912.0ms
Precision: 64
\[\left(x + y\right) - x \cdot y\]
\[\mathsf{fma}\left(1 - x, y, x\right)\]
\left(x + y\right) - x \cdot y
\mathsf{fma}\left(1 - x, y, x\right)
double f(double x, double y) {
        double r204079 = x;
        double r204080 = y;
        double r204081 = r204079 + r204080;
        double r204082 = r204079 * r204080;
        double r204083 = r204081 - r204082;
        return r204083;
}

double f(double x, double y) {
        double r204084 = 1.0;
        double r204085 = x;
        double r204086 = r204084 - r204085;
        double r204087 = y;
        double r204088 = fma(r204086, r204087, r204085);
        return r204088;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[\left(x + y\right) - x \cdot y\]
  2. Simplified0.0

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

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

Reproduce

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