Average Error: 0.0 → 0.0
Time: 11.1s
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 r230643 = x;
        double r230644 = y;
        double r230645 = r230643 + r230644;
        double r230646 = r230643 * r230644;
        double r230647 = r230645 - r230646;
        return r230647;
}

double f(double x, double y) {
        double r230648 = y;
        double r230649 = 1.0;
        double r230650 = x;
        double r230651 = r230649 - r230650;
        double r230652 = fma(r230648, r230651, r230650);
        return r230652;
}

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 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)))