Average Error: 0.0 → 0.0
Time: 14.2s
Precision: 64
\[\left(x + y\right) - x \cdot y\]
\[\mathsf{fma}\left(1 - y, x, y\right)\]
\left(x + y\right) - x \cdot y
\mathsf{fma}\left(1 - y, x, y\right)
double f(double x, double y) {
        double r9900333 = x;
        double r9900334 = y;
        double r9900335 = r9900333 + r9900334;
        double r9900336 = r9900333 * r9900334;
        double r9900337 = r9900335 - r9900336;
        return r9900337;
}

double f(double x, double y) {
        double r9900338 = 1.0;
        double r9900339 = y;
        double r9900340 = r9900338 - r9900339;
        double r9900341 = x;
        double r9900342 = fma(r9900340, r9900341, r9900339);
        return r9900342;
}

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 - y, x, y\right)}\]
  3. Final simplification0.0

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

Reproduce

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