Average Error: 0.0 → 0.0
Time: 5.3s
Precision: 64
\[\left(x + y\right) - x \cdot y\]
\[\mathsf{fma}\left(x, -y, y\right) + x\]
\left(x + y\right) - x \cdot y
\mathsf{fma}\left(x, -y, y\right) + x
double f(double x, double y) {
        double r202416 = x;
        double r202417 = y;
        double r202418 = r202416 + r202417;
        double r202419 = r202416 * r202417;
        double r202420 = r202418 - r202419;
        return r202420;
}

double f(double x, double y) {
        double r202421 = x;
        double r202422 = y;
        double r202423 = -r202422;
        double r202424 = fma(r202421, r202423, r202422);
        double r202425 = r202424 + r202421;
        return r202425;
}

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. Using strategy rm
  4. Applied fma-udef0.0

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

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

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

Reproduce

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