Average Error: 0.0 → 0.0
Time: 7.8s
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 r14412691 = x;
        double r14412692 = y;
        double r14412693 = r14412691 + r14412692;
        double r14412694 = r14412691 * r14412692;
        double r14412695 = r14412693 - r14412694;
        return r14412695;
}

double f(double x, double y) {
        double r14412696 = 1.0;
        double r14412697 = x;
        double r14412698 = r14412696 - r14412697;
        double r14412699 = y;
        double r14412700 = fma(r14412698, r14412699, r14412697);
        return r14412700;
}

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