Average Error: 0.0 → 0.0
Time: 5.4s
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 r8650 = 0.5;
        double r8651 = x;
        double r8652 = r8651 * r8651;
        double r8653 = y;
        double r8654 = r8652 - r8653;
        double r8655 = r8650 * r8654;
        return r8655;
}

double f(double x, double y) {
        double r8656 = 0.5;
        double r8657 = x;
        double r8658 = y;
        double r8659 = -r8658;
        double r8660 = fma(r8657, r8657, r8659);
        double r8661 = r8656 * r8660;
        return r8661;
}

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