Average Error: 0.0 → 0.0
Time: 4.2s
Precision: 64
\[\left(x + y\right) - x \cdot y\]
\[\mathsf{fma}\left(-y, x, x + y\right)\]
\left(x + y\right) - x \cdot y
\mathsf{fma}\left(-y, x, x + y\right)
double f(double x, double y) {
        double r110084 = x;
        double r110085 = y;
        double r110086 = r110084 + r110085;
        double r110087 = r110084 * r110085;
        double r110088 = r110086 - r110087;
        return r110088;
}

double f(double x, double y) {
        double r110089 = y;
        double r110090 = -r110089;
        double r110091 = x;
        double r110092 = r110091 + r110089;
        double r110093 = fma(r110090, r110091, r110092);
        return r110093;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[\left(x + y\right) - x \cdot y\]
  2. Taylor expanded around 0 0.0

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

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

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

Reproduce

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