Average Error: 0.0 → 0.0
Time: 10.8s
Precision: binary64
Cost: 6784
\[0.5 \cdot \left(x \cdot x - y\right) \]
\[\frac{\mathsf{fma}\left(x, x, -y\right)}{2} \]
(FPCore (x y) :precision binary64 (* 0.5 (- (* x x) y)))
(FPCore (x y) :precision binary64 (/ (fma x x (- y)) 2.0))
double code(double x, double y) {
	return 0.5 * ((x * x) - y);
}
double code(double x, double y) {
	return fma(x, x, -y) / 2.0;
}
function code(x, y)
	return Float64(0.5 * Float64(Float64(x * x) - y))
end
function code(x, y)
	return Float64(fma(x, x, Float64(-y)) / 2.0)
end
code[x_, y_] := N[(0.5 * N[(N[(x * x), $MachinePrecision] - y), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(N[(x * x + (-y)), $MachinePrecision] / 2.0), $MachinePrecision]
0.5 \cdot \left(x \cdot x - y\right)
\frac{\mathsf{fma}\left(x, x, -y\right)}{2}

Error

Derivation

  1. Initial program 0.0

    \[0.5 \cdot \left(x \cdot x - y\right) \]
  2. Applied egg-rr0.0

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, x, -y\right)}{2}} \]

Alternatives

Alternative 1
Error11.7
Cost1620
\[\begin{array}{l} t_0 := 0.5 \cdot \left(x \cdot x\right)\\ \mathbf{if}\;x \cdot x \leq 7 \cdot 10^{-35}:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{elif}\;x \cdot x \leq 6.5 \cdot 10^{-7}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \cdot x \leq 1.65 \cdot 10^{+25}:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{elif}\;x \cdot x \leq 4.8 \cdot 10^{+94}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;x \cdot x \leq 1.22 \cdot 10^{+123}:\\ \;\;\;\;-0.5 \cdot y\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error0.0
Cost448
\[0.5 \cdot \left(x \cdot x - y\right) \]
Alternative 3
Error21.3
Cost192
\[-0.5 \cdot y \]

Error

Reproduce

herbie shell --seed 2023010 
(FPCore (x y)
  :name "System.Random.MWC.Distributions:standard from mwc-random-0.13.3.2"
  :precision binary64
  (* 0.5 (- (* x x) y)))