Average Error: 0.0 → 0.0
Time: 2.0s
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 r8052 = 0.5;
        double r8053 = x;
        double r8054 = r8053 * r8053;
        double r8055 = y;
        double r8056 = r8054 - r8055;
        double r8057 = r8052 * r8056;
        return r8057;
}

double f(double x, double y) {
        double r8058 = x;
        double r8059 = y;
        double r8060 = -r8059;
        double r8061 = fma(r8058, r8058, r8060);
        double r8062 = 0.5;
        double r8063 = r8061 * r8062;
        return r8063;
}

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. Simplified0.0

    \[\leadsto \color{blue}{\mathsf{fma}\left(x, x, -y\right) \cdot 0.5}\]
  3. Final simplification0.0

    \[\leadsto \mathsf{fma}\left(x, x, -y\right) \cdot 0.5\]

Reproduce

herbie shell --seed 2019179 +o rules:numerics
(FPCore (x y)
  :name "System.Random.MWC.Distributions:standard from mwc-random-0.13.3.2"
  (* 0.5 (- (* x x) y)))