Average Error: 0.0 → 0.0
Time: 40.0s
Precision: 64
\[0.5 \cdot \left(x \cdot x - y\right)\]
\[\mathsf{fma}\left(x, x, -y\right) \cdot 0.5\]
0.5 \cdot \left(x \cdot x - y\right)
\mathsf{fma}\left(x, x, -y\right) \cdot 0.5
double f(double x, double y) {
        double r144221 = 0.5;
        double r144222 = x;
        double r144223 = r144222 * r144222;
        double r144224 = y;
        double r144225 = r144223 - r144224;
        double r144226 = r144221 * r144225;
        return r144226;
}

double f(double x, double y) {
        double r144227 = x;
        double r144228 = y;
        double r144229 = -r144228;
        double r144230 = fma(r144227, r144227, r144229);
        double r144231 = 0.5;
        double r144232 = r144230 * r144231;
        return r144232;
}

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 \mathsf{fma}\left(x, x, -y\right) \cdot 0.5\]

Reproduce

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