Average Error: 0.0 → 0.0
Time: 5.4s
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 r8803 = 0.5;
        double r8804 = x;
        double r8805 = r8804 * r8804;
        double r8806 = y;
        double r8807 = r8805 - r8806;
        double r8808 = r8803 * r8807;
        return r8808;
}

double f(double x, double y) {
        double r8809 = 0.5;
        double r8810 = x;
        double r8811 = y;
        double r8812 = -r8811;
        double r8813 = fma(r8810, r8810, r8812);
        double r8814 = r8809 * r8813;
        return r8814;
}

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