Average Error: 0.0 → 0.0
Time: 6.9s
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 r11799027 = x;
        double r11799028 = y;
        double r11799029 = r11799027 + r11799028;
        double r11799030 = r11799027 * r11799028;
        double r11799031 = r11799029 - r11799030;
        return r11799031;
}

double f(double x, double y) {
        double r11799032 = 1.0;
        double r11799033 = x;
        double r11799034 = r11799032 - r11799033;
        double r11799035 = y;
        double r11799036 = fma(r11799034, r11799035, r11799033);
        return r11799036;
}

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