Average Error: 0.0 → 0.0
Time: 841.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 r231903 = x;
        double r231904 = y;
        double r231905 = r231903 + r231904;
        double r231906 = r231903 * r231904;
        double r231907 = r231905 - r231906;
        return r231907;
}

double f(double x, double y) {
        double r231908 = 1.0;
        double r231909 = x;
        double r231910 = r231908 - r231909;
        double r231911 = y;
        double r231912 = fma(r231910, r231911, r231909);
        return r231912;
}

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