Average Error: 0.0 → 0.0
Time: 3.2s
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 r9244763 = x;
        double r9244764 = y;
        double r9244765 = r9244763 + r9244764;
        double r9244766 = r9244763 * r9244764;
        double r9244767 = r9244765 - r9244766;
        return r9244767;
}

double f(double x, double y) {
        double r9244768 = 1.0;
        double r9244769 = x;
        double r9244770 = r9244768 - r9244769;
        double r9244771 = y;
        double r9244772 = fma(r9244770, r9244771, r9244769);
        return r9244772;
}

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