Average Error: 0.0 → 0.0
Time: 2.8s
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 r132313 = x;
        double r132314 = y;
        double r132315 = r132313 + r132314;
        double r132316 = r132313 * r132314;
        double r132317 = r132315 - r132316;
        return r132317;
}

double f(double x, double y) {
        double r132318 = 1.0;
        double r132319 = x;
        double r132320 = r132318 - r132319;
        double r132321 = y;
        double r132322 = fma(r132320, r132321, r132319);
        return r132322;
}

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