Average Error: 0.0 → 0.0
Time: 850.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 r225199 = x;
        double r225200 = y;
        double r225201 = r225199 + r225200;
        double r225202 = r225199 * r225200;
        double r225203 = r225201 - r225202;
        return r225203;
}

double f(double x, double y) {
        double r225204 = 1.0;
        double r225205 = x;
        double r225206 = r225204 - r225205;
        double r225207 = y;
        double r225208 = fma(r225206, r225207, r225205);
        return r225208;
}

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