Average Error: 0.0 → 0.0
Time: 7.4s
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 r13715733 = x;
        double r13715734 = y;
        double r13715735 = r13715733 + r13715734;
        double r13715736 = r13715733 * r13715734;
        double r13715737 = r13715735 - r13715736;
        return r13715737;
}

double f(double x, double y) {
        double r13715738 = 1.0;
        double r13715739 = x;
        double r13715740 = r13715738 - r13715739;
        double r13715741 = y;
        double r13715742 = fma(r13715740, r13715741, r13715739);
        return r13715742;
}

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