Average Error: 0.0 → 0.0
Time: 775.0ms
Precision: 64
\[\left(x + y\right) - x \cdot y\]
\[\mathsf{fma}\left(1 - x, y, x\right)\]
\left(x + y\right) - x \cdot y
\mathsf{fma}\left(1 - x, y, x\right)
double f(double x, double y) {
        double r292258 = x;
        double r292259 = y;
        double r292260 = r292258 + r292259;
        double r292261 = r292258 * r292259;
        double r292262 = r292260 - r292261;
        return r292262;
}

double f(double x, double y) {
        double r292263 = 1.0;
        double r292264 = x;
        double r292265 = r292263 - r292264;
        double r292266 = y;
        double r292267 = fma(r292265, r292266, r292264);
        return r292267;
}

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. Final simplification0.0

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

Reproduce

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