Average Error: 0.0 → 0.0
Time: 39.7s
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 r150505 = 0.5;
        double r150506 = x;
        double r150507 = r150506 * r150506;
        double r150508 = y;
        double r150509 = r150507 - r150508;
        double r150510 = r150505 * r150509;
        return r150510;
}

double f(double x, double y) {
        double r150511 = x;
        double r150512 = y;
        double r150513 = -r150512;
        double r150514 = fma(r150511, r150511, r150513);
        double r150515 = 0.5;
        double r150516 = r150514 * r150515;
        return r150516;
}

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