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

herbie shell --seed 2022298
(FPCore (x)
:name "Diagrams.Tangent:$catParam from diagrams-lib-1.3.0.3, D"
:precision binary64
:herbie-target
(+ 3.0 (- (* (* 9.0 x) x) (* 12.0 x)))
(* 3.0 (+ (- (* (* x 3.0) x) (* x 4.0)) 1.0)))