Average Error: 0.0 → 0.0
Time: 4.6s
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 r140651 = 0.5;
        double r140652 = x;
        double r140653 = r140652 * r140652;
        double r140654 = y;
        double r140655 = r140653 - r140654;
        double r140656 = r140651 * r140655;
        return r140656;
}

double f(double x, double y) {
        double r140657 = x;
        double r140658 = y;
        double r140659 = -r140658;
        double r140660 = fma(r140657, r140657, r140659);
        double r140661 = 0.5;
        double r140662 = r140660 * r140661;
        return r140662;
}

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