Average Error: 0.0 → 0.0
Time: 5.1s
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 r178087 = x;
        double r178088 = y;
        double r178089 = r178087 + r178088;
        double r178090 = r178087 * r178088;
        double r178091 = r178089 - r178090;
        return r178091;
}

double f(double x, double y) {
        double r178092 = y;
        double r178093 = -r178092;
        double r178094 = x;
        double r178095 = r178094 + r178092;
        double r178096 = fma(r178093, r178094, r178095);
        return r178096;
}

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