Average Error: 0.0 → 0.0
Time: 1.4s
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 r1164 = x;
        double r1165 = y;
        double r1166 = r1164 + r1165;
        double r1167 = r1164 * r1165;
        double r1168 = r1166 - r1167;
        return r1168;
}

double f(double x, double y) {
        double r1169 = 1.0;
        double r1170 = x;
        double r1171 = r1169 - r1170;
        double r1172 = y;
        double r1173 = fma(r1171, r1172, r1170);
        return r1173;
}

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