Average Error: 0.0 → 0.0
Time: 40.4s
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 r144223 = 0.5;
        double r144224 = x;
        double r144225 = r144224 * r144224;
        double r144226 = y;
        double r144227 = r144225 - r144226;
        double r144228 = r144223 * r144227;
        return r144228;
}

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

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