| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 13120 |
\[0.5 \cdot \mathsf{fma}\left(\sqrt{z}, y, x\right)
\]
(FPCore (x y z) :precision binary64 (* (/ 1.0 2.0) (+ x (* y (sqrt z)))))
(FPCore (x y z) :precision binary64 (fma (* y (/ (sqrt z) (sqrt 2.0))) (sqrt 0.5) (* 0.5 x)))
double code(double x, double y, double z) {
return (1.0 / 2.0) * (x + (y * sqrt(z)));
}
double code(double x, double y, double z) {
return fma((y * (sqrt(z) / sqrt(2.0))), sqrt(0.5), (0.5 * x));
}
function code(x, y, z) return Float64(Float64(1.0 / 2.0) * Float64(x + Float64(y * sqrt(z)))) end
function code(x, y, z) return fma(Float64(y * Float64(sqrt(z) / sqrt(2.0))), sqrt(0.5), Float64(0.5 * x)) end
code[x_, y_, z_] := N[(N[(1.0 / 2.0), $MachinePrecision] * N[(x + N[(y * N[Sqrt[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := N[(N[(y * N[(N[Sqrt[z], $MachinePrecision] / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sqrt[0.5], $MachinePrecision] + N[(0.5 * x), $MachinePrecision]), $MachinePrecision]
\frac{1}{2} \cdot \left(x + y \cdot \sqrt{z}\right)
\mathsf{fma}\left(y \cdot \frac{\sqrt{z}}{\sqrt{2}}, \sqrt{0.5}, 0.5 \cdot x\right)
Initial program 0.2
Applied egg-rr0.5
Simplified0.4
Applied egg-rr0.2
| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 13120 |
| Alternative 2 | |
|---|---|
| Error | 16.2 |
| Cost | 7248 |
| Alternative 3 | |
|---|---|
| Error | 0.2 |
| Cost | 6848 |
| Alternative 4 | |
|---|---|
| Error | 30.1 |
| Cost | 192 |
herbie shell --seed 2023010
(FPCore (x y z)
:name "Diagrams.Solve.Polynomial:quadForm from diagrams-solve-0.1, B"
:precision binary64
(* (/ 1.0 2.0) (+ x (* y (sqrt z)))))