| Alternative 1 | |
|---|---|
| Error | 16.2 |
| Cost | 713 |
\[\begin{array}{l}
\mathbf{if}\;t \leq -2.45 \cdot 10^{-112} \lor \neg \left(t \leq 4.9 \cdot 10^{+154}\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\end{array}
\]
(FPCore (x y z t a b) :precision binary64 (+ (+ (* x y) (* z t)) (* a b)))
(FPCore (x y z t a b) :precision binary64 (+ (fma x y (* z t)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, (z * t)) + (a * b);
}
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) end
function code(x, y, z, t, a, b) return Float64(fma(x, y, Float64(z * t)) + Float64(a * b)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\left(x \cdot y + z \cdot t\right) + a \cdot b
\mathsf{fma}\left(x, y, z \cdot t\right) + a \cdot b
Initial program 0.0
Simplified0.0
[Start]0.0 | \[ \left(x \cdot y + z \cdot t\right) + a \cdot b
\] |
|---|---|
fma-def [=>]0.0 | \[ \color{blue}{\mathsf{fma}\left(x, y, z \cdot t\right)} + a \cdot b
\] |
Final simplification0.0
| Alternative 1 | |
|---|---|
| Error | 16.2 |
| Cost | 713 |
| Alternative 2 | |
|---|---|
| Error | 0.0 |
| Cost | 704 |
| Alternative 3 | |
|---|---|
| Error | 36.6 |
| Cost | 456 |
| Alternative 4 | |
|---|---|
| Error | 21.2 |
| Cost | 448 |
| Alternative 5 | |
|---|---|
| Error | 42.1 |
| Cost | 192 |
herbie shell --seed 2022354
(FPCore (x y z t a b)
:name "Linear.V3:$cdot from linear-1.19.1.3, B"
:precision binary64
(+ (+ (* x y) (* z t)) (* a b)))