Average Error: 0.0 → 0.0
Time: 40.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 r150500 = 0.5;
        double r150501 = x;
        double r150502 = r150501 * r150501;
        double r150503 = y;
        double r150504 = r150502 - r150503;
        double r150505 = r150500 * r150504;
        return r150505;
}

double f(double x, double y) {
        double r150506 = x;
        double r150507 = y;
        double r150508 = -r150507;
        double r150509 = fma(r150506, r150506, r150508);
        double r150510 = 0.5;
        double r150511 = r150509 * r150510;
        return r150511;
}

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