Average Error: 0.0 → 0.0
Time: 3.5s
Precision: 64
\[\left(x + y\right) - x \cdot y\]
\[\mathsf{fma}\left(y, 1 - x, x\right)\]
\left(x + y\right) - x \cdot y
\mathsf{fma}\left(y, 1 - x, x\right)
double f(double x, double y) {
        double r209487 = x;
        double r209488 = y;
        double r209489 = r209487 + r209488;
        double r209490 = r209487 * r209488;
        double r209491 = r209489 - r209490;
        return r209491;
}

double f(double x, double y) {
        double r209492 = y;
        double r209493 = 1.0;
        double r209494 = x;
        double r209495 = r209493 - r209494;
        double r209496 = fma(r209492, r209495, r209494);
        return r209496;
}

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(y, 1 - x, x\right)}\]
  3. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(y, 1 - x, x\right)\]

Reproduce

herbie shell --seed 2020045 +o rules:numerics
(FPCore (x y)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, A"
  :precision binary64
  (- (+ x y) (* x y)))