Average Error: 0.0 → 0.0
Time: 869.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 r173502 = x;
        double r173503 = y;
        double r173504 = r173502 + r173503;
        double r173505 = r173502 * r173503;
        double r173506 = r173504 - r173505;
        return r173506;
}

double f(double x, double y) {
        double r173507 = 1.0;
        double r173508 = x;
        double r173509 = r173507 - r173508;
        double r173510 = y;
        double r173511 = fma(r173509, r173510, r173508);
        return r173511;
}

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