Average Error: 0.0 → 0.0
Time: 976.0ms
Precision: 64
\[0.5 \cdot \left(x \cdot x - y\right)\]
\[0.5 \cdot \mathsf{fma}\left(x \cdot 1, x, -y\right)\]
0.5 \cdot \left(x \cdot x - y\right)
0.5 \cdot \mathsf{fma}\left(x \cdot 1, x, -y\right)
double code(double x, double y) {
	return ((double) (0.5 * ((double) (((double) (x * x)) - y))));
}
double code(double x, double y) {
	return ((double) (0.5 * ((double) fma(((double) (x * 1.0)), x, ((double) -(y))))));
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.0

    \[0.5 \cdot \left(x \cdot x - y\right)\]
  2. Using strategy rm
  3. Applied *-un-lft-identity0.0

    \[\leadsto 0.5 \cdot \left(x \cdot \color{blue}{\left(1 \cdot x\right)} - y\right)\]
  4. Applied associate-*r*0.0

    \[\leadsto 0.5 \cdot \left(\color{blue}{\left(x \cdot 1\right) \cdot x} - y\right)\]
  5. Applied fma-neg0.0

    \[\leadsto 0.5 \cdot \color{blue}{\mathsf{fma}\left(x \cdot 1, x, -y\right)}\]
  6. Final simplification0.0

    \[\leadsto 0.5 \cdot \mathsf{fma}\left(x \cdot 1, x, -y\right)\]

Reproduce

herbie shell --seed 2020114 +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)))