Average Error: 0.0 → 0.0
Time: 5.2s
Precision: 64
\[\left(x + y\right) - x \cdot y\]
\[\mathsf{fma}\left(-y, x, x + y\right)\]
\left(x + y\right) - x \cdot y
\mathsf{fma}\left(-y, x, x + y\right)
double f(double x, double y) {
        double r153691 = x;
        double r153692 = y;
        double r153693 = r153691 + r153692;
        double r153694 = r153691 * r153692;
        double r153695 = r153693 - r153694;
        return r153695;
}

double f(double x, double y) {
        double r153696 = y;
        double r153697 = -r153696;
        double r153698 = x;
        double r153699 = r153698 + r153696;
        double r153700 = fma(r153697, r153698, r153699);
        return r153700;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[\left(x + y\right) - x \cdot y\]
  2. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{\left(x + y\right) - x \cdot y}\]
  3. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(-y, x, x + y\right)}\]
  4. Final simplification0.0

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

Reproduce

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