Average Error: 0.0 → 0.0
Time: 824.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 r227901 = x;
        double r227902 = y;
        double r227903 = r227901 + r227902;
        double r227904 = r227901 * r227902;
        double r227905 = r227903 - r227904;
        return r227905;
}

double f(double x, double y) {
        double r227906 = 1.0;
        double r227907 = x;
        double r227908 = r227906 - r227907;
        double r227909 = y;
        double r227910 = fma(r227908, r227909, r227907);
        return r227910;
}

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