Average Error: 0.0 → 0.0
Time: 899.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 r245669 = x;
        double r245670 = y;
        double r245671 = r245669 + r245670;
        double r245672 = r245669 * r245670;
        double r245673 = r245671 - r245672;
        return r245673;
}

double f(double x, double y) {
        double r245674 = 1.0;
        double r245675 = x;
        double r245676 = r245674 - r245675;
        double r245677 = y;
        double r245678 = fma(r245676, r245677, r245675);
        return r245678;
}

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 2020021 +o rules:numerics
(FPCore (x y)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, A"
  :precision binary64
  (- (+ x y) (* x y)))