Average Error: 0.0 → 0.0
Time: 5.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 r150421 = x;
        double r150422 = y;
        double r150423 = r150421 + r150422;
        double r150424 = r150421 * r150422;
        double r150425 = r150423 - r150424;
        return r150425;
}

double f(double x, double y) {
        double r150426 = x;
        double r150427 = y;
        double r150428 = -r150427;
        double r150429 = fma(r150426, r150428, r150427);
        double r150430 = r150429 + r150426;
        return r150430;
}

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