Average Error: 0.0 → 0.0
Time: 1.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 r218791 = x;
        double r218792 = y;
        double r218793 = r218791 + r218792;
        double r218794 = r218791 * r218792;
        double r218795 = r218793 - r218794;
        return r218795;
}

double f(double x, double y) {
        double r218796 = 1.0;
        double r218797 = x;
        double r218798 = r218796 - r218797;
        double r218799 = y;
        double r218800 = fma(r218798, r218799, r218797);
        return r218800;
}

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