Average Error: 0.0 → 0.0
Time: 830.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 r280251 = x;
        double r280252 = y;
        double r280253 = r280251 + r280252;
        double r280254 = r280251 * r280252;
        double r280255 = r280253 - r280254;
        return r280255;
}

double f(double x, double y) {
        double r280256 = 1.0;
        double r280257 = x;
        double r280258 = r280256 - r280257;
        double r280259 = y;
        double r280260 = fma(r280258, r280259, r280257);
        return r280260;
}

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