| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 6720 |
\[\mathsf{fma}\left(d2, d1, d3 \cdot d1\right)
\]
(FPCore (d1 d2 d3) :precision binary64 (+ (* d1 d2) (* d1 d3)))
(FPCore (d1 d2 d3) :precision binary64 (fma d3 d1 (* d1 d2)))
double code(double d1, double d2, double d3) {
return (d1 * d2) + (d1 * d3);
}
double code(double d1, double d2, double d3) {
return fma(d3, d1, (d1 * d2));
}
function code(d1, d2, d3) return Float64(Float64(d1 * d2) + Float64(d1 * d3)) end
function code(d1, d2, d3) return fma(d3, d1, Float64(d1 * d2)) end
code[d1_, d2_, d3_] := N[(N[(d1 * d2), $MachinePrecision] + N[(d1 * d3), $MachinePrecision]), $MachinePrecision]
code[d1_, d2_, d3_] := N[(d3 * d1 + N[(d1 * d2), $MachinePrecision]), $MachinePrecision]
d1 \cdot d2 + d1 \cdot d3
\mathsf{fma}\left(d3, d1, d1 \cdot d2\right)
| Original | 0.0 |
|---|---|
| Target | 0.0 |
| Herbie | 0.0 |
Initial program 0.0
Applied egg-rr0.0
Final simplification0.0
| Alternative 1 | |
|---|---|
| Error | 0.0 |
| Cost | 6720 |
| Alternative 2 | |
|---|---|
| Error | 10.2 |
| Cost | 324 |
| Alternative 3 | |
|---|---|
| Error | 0.0 |
| Cost | 320 |
| Alternative 4 | |
|---|---|
| Error | 30.4 |
| Cost | 192 |
herbie shell --seed 2023039
(FPCore (d1 d2 d3)
:name "FastMath dist"
:precision binary64
:herbie-target
(* d1 (+ d2 d3))
(+ (* d1 d2) (* d1 d3)))