Average Error: 0 → 0
Time: 864.0ms
Precision: 64
\[x \cdot 2 - y\]
\[\mathsf{fma}\left(x, 2, -y\right)\]
x \cdot 2 - y
\mathsf{fma}\left(x, 2, -y\right)
double f(double x, double y) {
        double r151687 = x;
        double r151688 = 2.0;
        double r151689 = r151687 * r151688;
        double r151690 = y;
        double r151691 = r151689 - r151690;
        return r151691;
}

double f(double x, double y) {
        double r151692 = x;
        double r151693 = 2.0;
        double r151694 = y;
        double r151695 = -r151694;
        double r151696 = fma(r151692, r151693, r151695);
        return r151696;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0

    \[x \cdot 2 - y\]
  2. Simplified0

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

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

Reproduce

herbie shell --seed 2019179 +o rules:numerics
(FPCore (x y)
  :name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, C"
  (- (* x 2.0) y))