Average Error: 0.0 → 0.0
Time: 39.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 r150508 = 0.5;
        double r150509 = x;
        double r150510 = r150509 * r150509;
        double r150511 = y;
        double r150512 = r150510 - r150511;
        double r150513 = r150508 * r150512;
        return r150513;
}

double f(double x, double y) {
        double r150514 = x;
        double r150515 = y;
        double r150516 = -r150515;
        double r150517 = fma(r150514, r150514, r150516);
        double r150518 = 0.5;
        double r150519 = r150517 * r150518;
        return r150519;
}

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