Average Error: 0.0 → 0.0
Time: 8.0s
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 r195300 = x;
        double r195301 = y;
        double r195302 = r195300 + r195301;
        double r195303 = r195300 * r195301;
        double r195304 = r195302 - r195303;
        return r195304;
}

double f(double x, double y) {
        double r195305 = 1.0;
        double r195306 = x;
        double r195307 = r195305 - r195306;
        double r195308 = y;
        double r195309 = fma(r195307, r195308, r195306);
        return r195309;
}

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