Average Error: 0.0 → 0.0
Time: 26.9s
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 r269830 = x;
        double r269831 = y;
        double r269832 = r269830 + r269831;
        double r269833 = r269830 * r269831;
        double r269834 = r269832 - r269833;
        return r269834;
}

double f(double x, double y) {
        double r269835 = 1.0;
        double r269836 = y;
        double r269837 = r269835 - r269836;
        double r269838 = x;
        double r269839 = fma(r269837, r269838, r269836);
        return r269839;
}

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. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{\left(x + y\right) - x \cdot y}\]
  4. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(1 - y, x, y\right)}\]
  5. Final simplification0.0

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

Reproduce

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