Average Error: 0.0 → 0.0
Time: 919.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 r258809 = x;
        double r258810 = y;
        double r258811 = r258809 + r258810;
        double r258812 = r258809 * r258810;
        double r258813 = r258811 - r258812;
        return r258813;
}

double f(double x, double y) {
        double r258814 = 1.0;
        double r258815 = x;
        double r258816 = r258814 - r258815;
        double r258817 = y;
        double r258818 = fma(r258816, r258817, r258815);
        return r258818;
}

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