Average Error: 0.0 → 0.0
Time: 5.5s
Precision: 64
\[0.5 \cdot \left(x \cdot x - y\right)\]
\[0.5 \cdot \mathsf{fma}\left(x, x, -y\right)\]
0.5 \cdot \left(x \cdot x - y\right)
0.5 \cdot \mathsf{fma}\left(x, x, -y\right)
double f(double x, double y) {
        double r182151 = 0.5;
        double r182152 = x;
        double r182153 = r182152 * r182152;
        double r182154 = y;
        double r182155 = r182153 - r182154;
        double r182156 = r182151 * r182155;
        return r182156;
}

double f(double x, double y) {
        double r182157 = 0.5;
        double r182158 = x;
        double r182159 = y;
        double r182160 = -r182159;
        double r182161 = fma(r182158, r182158, r182160);
        double r182162 = r182157 * r182161;
        return r182162;
}

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 0.5 \cdot \mathsf{fma}\left(x, x, -y\right)\]

Reproduce

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