(FPCore (x eps) :precision binary64 (- (pow (+ x eps) 2.0) (pow x 2.0)))
(FPCore (x eps) :precision binary64 (fma eps eps (* eps (* x 2.0))))
double code(double x, double eps) {
return pow((x + eps), 2.0) - pow(x, 2.0);
}
double code(double x, double eps) {
return fma(eps, eps, (eps * (x * 2.0)));
}
function code(x, eps) return Float64((Float64(x + eps) ^ 2.0) - (x ^ 2.0)) end
function code(x, eps) return fma(eps, eps, Float64(eps * Float64(x * 2.0))) end
code[x_, eps_] := N[(N[Power[N[(x + eps), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[x, 2.0], $MachinePrecision]), $MachinePrecision]
code[x_, eps_] := N[(eps * eps + N[(eps * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
{\left(x + \varepsilon\right)}^{2} - {x}^{2}
\mathsf{fma}\left(\varepsilon, \varepsilon, \varepsilon \cdot \left(x \cdot 2\right)\right)



Bits error versus x



Bits error versus eps
Initial program 16.6
Simplified0.0
Taylor expanded in eps around 0 0.0
Applied egg-rr0.0
Final simplification0.0
herbie shell --seed 2022170
(FPCore (x eps)
:name "ENA, Section 1.4, Exercise 4b, n=2"
:precision binary64
:pre (and (and (<= -1000000000.0 x) (<= x 1000000000.0)) (and (<= -1.0 eps) (<= eps 1.0)))
(- (pow (+ x eps) 2.0) (pow x 2.0)))