Average Error: 0.0 → 0.0
Time: 2.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 r12615 = x;
        double r12616 = y;
        double r12617 = r12615 + r12616;
        double r12618 = r12615 * r12616;
        double r12619 = r12617 - r12618;
        return r12619;
}

double f(double x, double y) {
        double r12620 = 1.0;
        double r12621 = x;
        double r12622 = r12620 - r12621;
        double r12623 = y;
        double r12624 = fma(r12622, r12623, r12621);
        return r12624;
}

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