| Alternative 1 | |
|---|---|
| Error | 0.29% |
| Cost | 832 |
\[\left(x \cdot x\right) \cdot 3 + \left(x \cdot x\right) \cdot \left(x \cdot -2\right)
\]
(FPCore (x) :precision binary64 (* (* x x) (- 3.0 (* x 2.0))))
(FPCore (x) :precision binary64 (fma (* x x) (* x -2.0) (* x (* x 3.0))))
double code(double x) {
return (x * x) * (3.0 - (x * 2.0));
}
double code(double x) {
return fma((x * x), (x * -2.0), (x * (x * 3.0)));
}
function code(x) return Float64(Float64(x * x) * Float64(3.0 - Float64(x * 2.0))) end
function code(x) return fma(Float64(x * x), Float64(x * -2.0), Float64(x * Float64(x * 3.0))) end
code[x_] := N[(N[(x * x), $MachinePrecision] * N[(3.0 - N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(N[(x * x), $MachinePrecision] * N[(x * -2.0), $MachinePrecision] + N[(x * N[(x * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)
\mathsf{fma}\left(x \cdot x, x \cdot -2, x \cdot \left(x \cdot 3\right)\right)
| Original | 0.28% |
|---|---|
| Target | 0.25% |
| Herbie | 0.26% |
Initial program 0.28
Simplified0.25
[Start]0.28 | \[ \left(x \cdot x\right) \cdot \left(3 - x \cdot 2\right)
\] |
|---|---|
associate-*l* [=>]0.25 | \[ \color{blue}{x \cdot \left(x \cdot \left(3 - x \cdot 2\right)\right)}
\] |
Applied egg-rr0.29
Applied egg-rr0.26
Final simplification0.26
| Alternative 1 | |
|---|---|
| Error | 0.29% |
| Cost | 832 |
| Alternative 2 | |
|---|---|
| Error | 3.19% |
| Cost | 713 |
| Alternative 3 | |
|---|---|
| Error | 0.26% |
| Cost | 704 |
| Alternative 4 | |
|---|---|
| Error | 0.25% |
| Cost | 576 |
| Alternative 5 | |
|---|---|
| Error | 25.64% |
| Cost | 320 |
| Alternative 6 | |
|---|---|
| Error | 25.61% |
| Cost | 320 |
| Alternative 7 | |
|---|---|
| Error | 95.37% |
| Cost | 192 |
herbie shell --seed 2023121
(FPCore (x)
:name "Data.Spline.Key:interpolateKeys from smoothie-0.4.0.2"
:precision binary64
:herbie-target
(* x (* x (- 3.0 (* x 2.0))))
(* (* x x) (- 3.0 (* x 2.0))))