Average Error: 0.0 → 0.0
Time: 4.7s
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 r168656 = x;
        double r168657 = y;
        double r168658 = r168656 + r168657;
        double r168659 = r168656 * r168657;
        double r168660 = r168658 - r168659;
        return r168660;
}

double f(double x, double y) {
        double r168661 = y;
        double r168662 = -r168661;
        double r168663 = x;
        double r168664 = r168663 + r168661;
        double r168665 = fma(r168662, r168663, r168664);
        return r168665;
}

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