Average Error: 0.0 → 0.0
Time: 4.5s
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 r118075 = x;
        double r118076 = y;
        double r118077 = r118075 + r118076;
        double r118078 = r118075 * r118076;
        double r118079 = r118077 - r118078;
        return r118079;
}

double f(double x, double y) {
        double r118080 = y;
        double r118081 = -r118080;
        double r118082 = x;
        double r118083 = r118082 + r118080;
        double r118084 = fma(r118081, r118082, r118083);
        return r118084;
}

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)))