Average Error: 0.0 → 0.0
Time: 5.6s
Precision: 64
\[0.5 \cdot \left(x \cdot x - y\right)\]
\[0.5 \cdot \mathsf{fma}\left(x, x, -y\right)\]
0.5 \cdot \left(x \cdot x - y\right)
0.5 \cdot \mathsf{fma}\left(x, x, -y\right)
double f(double x, double y) {
        double r8631 = 0.5;
        double r8632 = x;
        double r8633 = r8632 * r8632;
        double r8634 = y;
        double r8635 = r8633 - r8634;
        double r8636 = r8631 * r8635;
        return r8636;
}

double f(double x, double y) {
        double r8637 = 0.5;
        double r8638 = x;
        double r8639 = y;
        double r8640 = -r8639;
        double r8641 = fma(r8638, r8638, r8640);
        double r8642 = r8637 * r8641;
        return r8642;
}

Error

Bits error versus x

Bits error versus y

Derivation

  1. Initial program 0.0

    \[0.5 \cdot \left(x \cdot x - y\right)\]
  2. Using strategy rm
  3. Applied fma-neg0.0

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

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

Reproduce

herbie shell --seed 2019325 +o rules:numerics
(FPCore (x y)
  :name "System.Random.MWC.Distributions:standard from mwc-random-0.13.3.2"
  :precision binary64
  (* 0.5 (- (* x x) y)))