(FPCore (x y) :precision binary64 (+ x (/ (- x y) 2.0)))
(FPCore (x y) :precision binary64 (fma (- x y) 0.5 x))
double code(double x, double y) {
return x + ((x - y) / 2.0);
}
double code(double x, double y) {
return fma((x - y), 0.5, x);
}
function code(x, y) return Float64(x + Float64(Float64(x - y) / 2.0)) end
function code(x, y) return fma(Float64(x - y), 0.5, x) end
code[x_, y_] := N[(x + N[(N[(x - y), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(N[(x - y), $MachinePrecision] * 0.5 + x), $MachinePrecision]
x + \frac{x - y}{2}
\mathsf{fma}\left(x - y, 0.5, x\right)




Bits error versus x




Bits error versus y
| Original | 0.1 |
|---|---|
| Target | 0.1 |
| Herbie | 0.1 |
Initial program 0.1
Simplified0.1
Final simplification0.1
herbie shell --seed 2022133
(FPCore (x y)
:name "Graphics.Rendering.Chart.Axis.Types:hBufferRect from Chart-1.5.3"
:precision binary64
:herbie-target
(- (* 1.5 x) (* 0.5 y))
(+ x (/ (- x y) 2.0)))