Average Error: 0.0 → 0.0
Time: 6.0s
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 r225636 = x;
        double r225637 = y;
        double r225638 = r225636 + r225637;
        double r225639 = r225636 * r225637;
        double r225640 = r225638 - r225639;
        return r225640;
}

double f(double x, double y) {
        double r225641 = x;
        double r225642 = y;
        double r225643 = -r225642;
        double r225644 = fma(r225641, r225643, r225642);
        double r225645 = r225644 + r225641;
        return r225645;
}

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