| Alternative 1 | |
|---|---|
| Error | 16.68% |
| Cost | 1097 |
\[\begin{array}{l}
t_0 := z \cdot \left(y \cdot z\right)\\
\mathbf{if}\;t_0 \leq -4 \cdot 10^{-40} \lor \neg \left(t_0 \leq 5000000000\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\]
(FPCore (x y z) :precision binary64 (+ x (* (* y z) z)))
(FPCore (x y z) :precision binary64 (fma (* y z) z x))
double code(double x, double y, double z) {
return x + ((y * z) * z);
}
double code(double x, double y, double z) {
return fma((y * z), z, x);
}
function code(x, y, z) return Float64(x + Float64(Float64(y * z) * z)) end
function code(x, y, z) return fma(Float64(y * z), z, x) end
code[x_, y_, z_] := N[(x + N[(N[(y * z), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(y * z), $MachinePrecision] * z + x), $MachinePrecision]
x + \left(y \cdot z\right) \cdot z
\mathsf{fma}\left(y \cdot z, z, x\right)
Initial program 0.14
Simplified9.83
[Start]0.14 | \[ x + \left(y \cdot z\right) \cdot z
\] |
|---|---|
associate-*l* [=>]9.83 | \[ x + \color{blue}{y \cdot \left(z \cdot z\right)}
\] |
Applied egg-rr0.13
Final simplification0.13
| Alternative 1 | |
|---|---|
| Error | 16.68% |
| Cost | 1097 |
| Alternative 2 | |
|---|---|
| Error | 2.9% |
| Cost | 713 |
| Alternative 3 | |
|---|---|
| Error | 29.71% |
| Cost | 585 |
| Alternative 4 | |
|---|---|
| Error | 0.14% |
| Cost | 448 |
| Alternative 5 | |
|---|---|
| Error | 33.01% |
| Cost | 64 |
herbie shell --seed 2023121
(FPCore (x y z)
:name "Statistics.Sample:robustSumVarWeighted from math-functions-0.1.5.2"
:precision binary64
(+ x (* (* y z) z)))