| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 704 |
\[\left(x \cdot 2\right) \cdot 3 + -9 \cdot \left(x \cdot x\right)
\]
(FPCore (x) :precision binary64 (* (* 3.0 (- 2.0 (* x 3.0))) x))
(FPCore (x) :precision binary64 (fma x 6.0 (* x (* x -9.0))))
double code(double x) {
return (3.0 * (2.0 - (x * 3.0))) * x;
}
double code(double x) {
return fma(x, 6.0, (x * (x * -9.0)));
}
function code(x) return Float64(Float64(3.0 * Float64(2.0 - Float64(x * 3.0))) * x) end
function code(x) return fma(x, 6.0, Float64(x * Float64(x * -9.0))) end
code[x_] := N[(N[(3.0 * N[(2.0 - N[(x * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]
code[x_] := N[(x * 6.0 + N[(x * N[(x * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(3 \cdot \left(2 - x \cdot 3\right)\right) \cdot x
\mathsf{fma}\left(x, 6, x \cdot \left(x \cdot -9\right)\right)
| Original | 0.2 |
|---|---|
| Target | 0.2 |
| Herbie | 0.1 |
Initial program 0.2
Applied egg-rr11.4
Applied egg-rr0.1
Final simplification0.1
| Alternative 1 | |
|---|---|
| Error | 0.2 |
| Cost | 704 |
| Alternative 2 | |
|---|---|
| Error | 1.9 |
| Cost | 584 |
| Alternative 3 | |
|---|---|
| Error | 0.2 |
| Cost | 448 |
| Alternative 4 | |
|---|---|
| Error | 21.4 |
| Cost | 192 |

herbie shell --seed 2022217
(FPCore (x)
:name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, E"
:precision binary64
:herbie-target
(- (* 6.0 x) (* 9.0 (* x x)))
(* (* 3.0 (- 2.0 (* x 3.0))) x))