Average Error: 0.0 → 0.0
Time: 26.2s
Precision: 64
\[\left(x + y\right) - x \cdot y\]
\[\mathsf{fma}\left(y, 1 - x, x\right)\]
\left(x + y\right) - x \cdot y
\mathsf{fma}\left(y, 1 - x, x\right)
double f(double x, double y) {
        double r264298 = x;
        double r264299 = y;
        double r264300 = r264298 + r264299;
        double r264301 = r264298 * r264299;
        double r264302 = r264300 - r264301;
        return r264302;
}

double f(double x, double y) {
        double r264303 = y;
        double r264304 = 1.0;
        double r264305 = x;
        double r264306 = r264304 - r264305;
        double r264307 = fma(r264303, r264306, r264305);
        return r264307;
}

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

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

Reproduce

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