Average Error: 0.0 → 0.0
Time: 9.3s
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 r11465 = 0.5;
        double r11466 = x;
        double r11467 = r11466 * r11466;
        double r11468 = y;
        double r11469 = r11467 - r11468;
        double r11470 = r11465 * r11469;
        return r11470;
}

double f(double x, double y) {
        double r11471 = 0.5;
        double r11472 = x;
        double r11473 = y;
        double r11474 = -r11473;
        double r11475 = fma(r11472, r11472, r11474);
        double r11476 = r11471 * r11475;
        return r11476;
}

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