Average Error: 0.0 → 0.0
Time: 3.5s
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 r142465 = x;
        double r142466 = y;
        double r142467 = r142465 + r142466;
        double r142468 = r142465 * r142466;
        double r142469 = r142467 - r142468;
        return r142469;
}

double f(double x, double y) {
        double r142470 = 1.0;
        double r142471 = x;
        double r142472 = r142470 - r142471;
        double r142473 = y;
        double r142474 = fma(r142472, r142473, r142471);
        return r142474;
}

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