Average Error: 0.0 → 0.0
Time: 4.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 r283406 = x;
        double r283407 = y;
        double r283408 = r283406 + r283407;
        double r283409 = r283406 * r283407;
        double r283410 = r283408 - r283409;
        return r283410;
}

double f(double x, double y) {
        double r283411 = 1.0;
        double r283412 = x;
        double r283413 = r283411 - r283412;
        double r283414 = y;
        double r283415 = fma(r283413, r283414, r283412);
        return r283415;
}

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