Average Error: 0.0 → 0.0
Time: 2.2m
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 r144373 = 0.5;
        double r144374 = x;
        double r144375 = r144374 * r144374;
        double r144376 = y;
        double r144377 = r144375 - r144376;
        double r144378 = r144373 * r144377;
        return r144378;
}

double f(double x, double y) {
        double r144379 = x;
        double r144380 = y;
        double r144381 = -r144380;
        double r144382 = fma(r144379, r144379, r144381);
        double r144383 = 0.5;
        double r144384 = r144382 * r144383;
        return r144384;
}

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