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 r147852 = 0.5;
        double r147853 = x;
        double r147854 = r147853 * r147853;
        double r147855 = y;
        double r147856 = r147854 - r147855;
        double r147857 = r147852 * r147856;
        return r147857;
}

double f(double x, double y) {
        double r147858 = x;
        double r147859 = y;
        double r147860 = -r147859;
        double r147861 = fma(r147858, r147858, r147860);
        double r147862 = 0.5;
        double r147863 = r147861 * r147862;
        return r147863;
}

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