Average Error: 0.0 → 0.0
Time: 3.9s
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 r142180 = x;
        double r142181 = y;
        double r142182 = r142180 + r142181;
        double r142183 = r142180 * r142181;
        double r142184 = r142182 - r142183;
        return r142184;
}

double f(double x, double y) {
        double r142185 = 1.0;
        double r142186 = x;
        double r142187 = r142185 - r142186;
        double r142188 = y;
        double r142189 = fma(r142187, r142188, r142186);
        return r142189;
}

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