Average Error: 0.0 → 0.0
Time: 639.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 r234876 = x;
        double r234877 = y;
        double r234878 = r234876 + r234877;
        double r234879 = r234876 * r234877;
        double r234880 = r234878 - r234879;
        return r234880;
}

double f(double x, double y) {
        double r234881 = 1.0;
        double r234882 = x;
        double r234883 = r234881 - r234882;
        double r234884 = y;
        double r234885 = fma(r234883, r234884, r234882);
        return r234885;
}

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