Average Error: 0.0 → 0.0
Time: 5.1s
Precision: 64
\[\left(x + y\right) - x \cdot y\]
\[\mathsf{fma}\left(y, 1 - x, x\right)\]
\left(x + y\right) - x \cdot y
\mathsf{fma}\left(y, 1 - x, x\right)
double f(double x, double y) {
        double r200560 = x;
        double r200561 = y;
        double r200562 = r200560 + r200561;
        double r200563 = r200560 * r200561;
        double r200564 = r200562 - r200563;
        return r200564;
}

double f(double x, double y) {
        double r200565 = y;
        double r200566 = 1.0;
        double r200567 = x;
        double r200568 = r200566 - r200567;
        double r200569 = fma(r200565, r200568, r200567);
        return r200569;
}

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(y, 1 - x, x\right)}\]
  3. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(y, 1 - x, x\right)\]

Reproduce

herbie shell --seed 2020047 +o rules:numerics
(FPCore (x y)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, A"
  :precision binary64
  (- (+ x y) (* x y)))