Average Error: 0.0 → 0.0
Time: 950.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 r255569 = x;
        double r255570 = y;
        double r255571 = r255569 + r255570;
        double r255572 = r255569 * r255570;
        double r255573 = r255571 - r255572;
        return r255573;
}

double f(double x, double y) {
        double r255574 = 1.0;
        double r255575 = x;
        double r255576 = r255574 - r255575;
        double r255577 = y;
        double r255578 = fma(r255576, r255577, r255575);
        return r255578;
}

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