Average Error: 0.0 → 0.0
Time: 8.6s
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 r10663722 = x;
        double r10663723 = y;
        double r10663724 = r10663722 + r10663723;
        double r10663725 = r10663722 * r10663723;
        double r10663726 = r10663724 - r10663725;
        return r10663726;
}

double f(double x, double y) {
        double r10663727 = 1.0;
        double r10663728 = x;
        double r10663729 = r10663727 - r10663728;
        double r10663730 = y;
        double r10663731 = fma(r10663729, r10663730, r10663728);
        return r10663731;
}

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