Average Error: 0.0 → 0.0
Time: 5.1s
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 r8804 = 0.5;
        double r8805 = x;
        double r8806 = r8805 * r8805;
        double r8807 = y;
        double r8808 = r8806 - r8807;
        double r8809 = r8804 * r8808;
        return r8809;
}

double f(double x, double y) {
        double r8810 = 0.5;
        double r8811 = x;
        double r8812 = y;
        double r8813 = -r8812;
        double r8814 = fma(r8811, r8811, r8813);
        double r8815 = r8810 * r8814;
        return r8815;
}

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 2019198 +o rules:numerics
(FPCore (x y)
  :name "System.Random.MWC.Distributions:standard from mwc-random-0.13.3.2"
  (* 0.5 (- (* x x) y)))