Average Error: 0.0 → 0.0
Time: 596.0ms
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 r180971 = x;
        double r180972 = y;
        double r180973 = r180971 + r180972;
        double r180974 = r180971 * r180972;
        double r180975 = r180973 - r180974;
        return r180975;
}

double f(double x, double y) {
        double r180976 = 1.0;
        double r180977 = x;
        double r180978 = r180976 - r180977;
        double r180979 = y;
        double r180980 = fma(r180978, r180979, r180977);
        return r180980;
}

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