\[ \begin{array}{c}[d2, d4] = \mathsf{sort}([d2, d4])\\ \end{array} \]
\[\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\]
↓
\[\mathsf{fma}\left(d4 - \left(d1 + d3\right), d1, d1 \cdot d2\right)
\]
(FPCore (d1 d2 d3 d4)
:precision binary64
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
↓
(FPCore (d1 d2 d3 d4) :precision binary64 (fma (- d4 (+ d1 d3)) d1 (* d1 d2)))
double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
↓
double code(double d1, double d2, double d3, double d4) {
return fma((d4 - (d1 + d3)), d1, (d1 * d2));
}
function code(d1, d2, d3, d4)
return Float64(Float64(Float64(Float64(d1 * d2) - Float64(d1 * d3)) + Float64(d4 * d1)) - Float64(d1 * d1))
end
↓
function code(d1, d2, d3, d4)
return fma(Float64(d4 - Float64(d1 + d3)), d1, Float64(d1 * d2))
end
code[d1_, d2_, d3_, d4_] := N[(N[(N[(N[(d1 * d2), $MachinePrecision] - N[(d1 * d3), $MachinePrecision]), $MachinePrecision] + N[(d4 * d1), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
↓
code[d1_, d2_, d3_, d4_] := N[(N[(d4 - N[(d1 + d3), $MachinePrecision]), $MachinePrecision] * d1 + N[(d1 * d2), $MachinePrecision]), $MachinePrecision]
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
↓
\mathsf{fma}\left(d4 - \left(d1 + d3\right), d1, d1 \cdot d2\right)
Alternatives
| Alternative 1 |
|---|
| Error | 19.4 |
|---|
| Cost | 1115 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d3 \leq -1.72 \cdot 10^{+199} \lor \neg \left(d3 \leq -1.95 \cdot 10^{+169} \lor \neg \left(d3 \leq -9.2 \cdot 10^{+52}\right) \land \left(d3 \leq 1.46 \cdot 10^{+96} \lor \neg \left(d3 \leq 2.8 \cdot 10^{+117}\right) \land d3 \leq 9.5 \cdot 10^{+175}\right)\right):\\
\;\;\;\;d3 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 28.0 |
|---|
| Cost | 784 |
|---|
\[\begin{array}{l}
t_0 := d3 \cdot \left(-d1\right)\\
\mathbf{if}\;d4 \leq -1.25 \cdot 10^{-174}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq -2.65 \cdot 10^{-217}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 4.9 \cdot 10^{-248}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 2.3 \cdot 10^{+86}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d4 \cdot d1\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 6.9 |
|---|
| Cost | 580 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d1 \leq -2.2 \cdot 10^{+89}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d3\right)\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 2.7 |
|---|
| Cost | 580 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d4 \leq 28000000:\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 + d2\right) - d3\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 0.0 |
|---|
| Cost | 576 |
|---|
\[d1 \cdot \left(\left(d2 - d3\right) + \left(d4 - d1\right)\right)
\]
| Alternative 6 |
|---|
| Error | 14.4 |
|---|
| Cost | 452 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d4 \leq 4.2 \cdot 10^{+85}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 + d2\right)\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 12.2 |
|---|
| Cost | 452 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d4 \leq 3.3 \cdot 10^{-48}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 30.0 |
|---|
| Cost | 324 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d4 \leq 10^{-46}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d4 \cdot d1\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 43.2 |
|---|
| Cost | 192 |
|---|
\[d4 \cdot d1
\]