Average Error: 0.0 → 0.0
Time: 1.8m
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 r144385 = 0.5;
        double r144386 = x;
        double r144387 = r144386 * r144386;
        double r144388 = y;
        double r144389 = r144387 - r144388;
        double r144390 = r144385 * r144389;
        return r144390;
}

double f(double x, double y) {
        double r144391 = x;
        double r144392 = y;
        double r144393 = -r144392;
        double r144394 = fma(r144391, r144391, r144393);
        double r144395 = 0.5;
        double r144396 = r144394 * r144395;
        return r144396;
}

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