\[ \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(d2, d1, d1 \cdot \left(d4 - d3\right)\right) - d1 \cdot d1
\]
(FPCore (d1 d2 d3 d4)
:precision binary64
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
↓
(FPCore (d1 d2 d3 d4)
:precision binary64
(- (fma d2 d1 (* d1 (- d4 d3))) (* d1 d1)))
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(d2, d1, (d1 * (d4 - d3))) - (d1 * d1);
}
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 Float64(fma(d2, d1, Float64(d1 * Float64(d4 - d3))) - Float64(d1 * d1))
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[(d2 * d1 + N[(d1 * N[(d4 - d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(d1 * d1), $MachinePrecision]), $MachinePrecision]
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
↓
\mathsf{fma}\left(d2, d1, d1 \cdot \left(d4 - d3\right)\right) - d1 \cdot d1
Alternatives
| Alternative 1 |
|---|
| Accuracy | 52.9% |
|---|
| Cost | 1313 |
|---|
\[\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d2 \leq -1.1 \cdot 10^{+102}:\\
\;\;\;\;d2 \cdot d1\\
\mathbf{elif}\;d2 \leq -0.03:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -8.8 \cdot 10^{-52}:\\
\;\;\;\;d1 \cdot d4\\
\mathbf{elif}\;d2 \leq -1.5 \cdot 10^{-86}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -4.6 \cdot 10^{-126}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{elif}\;d2 \leq -3 \cdot 10^{-306} \lor \neg \left(d2 \leq 8 \cdot 10^{-140}\right) \land d2 \leq 1.5 \cdot 10^{-67}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\]
| Alternative 2 |
|---|
| Accuracy | 78.7% |
|---|
| Cost | 1308 |
|---|
\[\begin{array}{l}
t_0 := d1 \cdot \left(d4 - d1\right)\\
t_1 := d1 \cdot \left(d4 - d3\right)\\
\mathbf{if}\;d2 \leq -1.15 \cdot 10^{+70}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -1.55 \cdot 10^{-13}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d2 \leq -1.55 \cdot 10^{-16}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d2 \leq -4.9 \cdot 10^{-52}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -5.4 \cdot 10^{-82}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d2 \leq -3.3 \cdot 10^{-127}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -1.75 \cdot 10^{-134}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 3 |
|---|
| Accuracy | 78.5% |
|---|
| Cost | 1244 |
|---|
\[\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
t_1 := d1 \cdot \left(d4 - d1\right)\\
t_2 := d1 \cdot \left(d4 - d3\right)\\
\mathbf{if}\;d2 \leq -1.28 \cdot 10^{+70}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d2 \leq -1.55 \cdot 10^{-13}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d2 \leq -1.22 \cdot 10^{-16}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d2 \leq -7.6 \cdot 10^{-51}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d2 \leq -5.4 \cdot 10^{-82}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;d2 \leq -3 \cdot 10^{-127}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d2 \leq -1.9 \cdot 10^{-134}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 4 |
|---|
| Accuracy | 65.6% |
|---|
| Cost | 980 |
|---|
\[\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d1\right)\\
t_1 := d1 \cdot \left(-d3\right)\\
\mathbf{if}\;d4 \leq 1.9 \cdot 10^{-289}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 2.5 \cdot 10^{-235}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 1.7 \cdot 10^{-79}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.4 \cdot 10^{-29}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d4 \leq 1.12 \cdot 10^{-13}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Accuracy | 76.7% |
|---|
| Cost | 716 |
|---|
\[\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 3 \cdot 10^{-131}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.2 \cdot 10^{-95}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 4.2 \cdot 10^{+81}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Accuracy | 52.5% |
|---|
| Cost | 588 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d4 \leq 3.1 \cdot 10^{-137}:\\
\;\;\;\;d2 \cdot d1\\
\mathbf{elif}\;d4 \leq 2.3 \cdot 10^{-70}:\\
\;\;\;\;-d1 \cdot d1\\
\mathbf{elif}\;d4 \leq 15000000000000:\\
\;\;\;\;d2 \cdot d1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\]
| Alternative 7 |
|---|
| Accuracy | 72.2% |
|---|
| Cost | 585 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d3 \leq -4.1 \cdot 10^{+133} \lor \neg \left(d3 \leq 2.2 \cdot 10^{+95}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\]
| Alternative 8 |
|---|
| Accuracy | 90.5% |
|---|
| Cost | 580 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d2 \leq -8.5 \cdot 10^{+102}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - \left(d1 + d3\right)\right)\\
\end{array}
\]
| Alternative 9 |
|---|
| Accuracy | 95.6% |
|---|
| Cost | 580 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d2 \leq -3.3 \cdot 10^{+44}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - \left(d1 + d3\right)\right)\\
\end{array}
\]
| Alternative 10 |
|---|
| Accuracy | 95.3% |
|---|
| Cost | 580 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d4 \leq 2.65 \cdot 10^{-71}:\\
\;\;\;\;d1 \cdot \left(d2 - \left(d1 + d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\end{array}
\]
| Alternative 11 |
|---|
| Accuracy | 100.0% |
|---|
| Cost | 576 |
|---|
\[d1 \cdot \left(\left(d2 - d3\right) + \left(d4 - d1\right)\right)
\]
| Alternative 12 |
|---|
| Accuracy | 51.7% |
|---|
| Cost | 324 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d2 \leq -9 \cdot 10^{+69}:\\
\;\;\;\;d2 \cdot d1\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\]
| Alternative 13 |
|---|
| Accuracy | 32.0% |
|---|
| Cost | 192 |
|---|
\[d1 \cdot d4
\]