\[ \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
\]
↓
\[d1 \cdot \left(d2 + \left(\left(d4 - d1\right) - d3\right)\right)
\]
(FPCore (d1 d2 d3 d4)
:precision binary64
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
↓
(FPCore (d1 d2 d3 d4) :precision binary64 (* d1 (+ d2 (- (- d4 d1) d3))))
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 d1 * (d2 + ((d4 - d1) - d3));
}
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
end function
↓
real(8) function code(d1, d2, d3, d4)
real(8), intent (in) :: d1
real(8), intent (in) :: d2
real(8), intent (in) :: d3
real(8), intent (in) :: d4
code = d1 * (d2 + ((d4 - d1) - d3))
end function
public static double code(double d1, double d2, double d3, double d4) {
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
}
↓
public static double code(double d1, double d2, double d3, double d4) {
return d1 * (d2 + ((d4 - d1) - d3));
}
def code(d1, d2, d3, d4):
return (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1)
↓
def code(d1, d2, d3, d4):
return d1 * (d2 + ((d4 - d1) - d3))
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(d1 * Float64(d2 + Float64(Float64(d4 - d1) - d3)))
end
function tmp = code(d1, d2, d3, d4)
tmp = (((d1 * d2) - (d1 * d3)) + (d4 * d1)) - (d1 * d1);
end
↓
function tmp = code(d1, d2, d3, d4)
tmp = d1 * (d2 + ((d4 - d1) - d3));
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[(d1 * N[(d2 + N[(N[(d4 - d1), $MachinePrecision] - d3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
↓
d1 \cdot \left(d2 + \left(\left(d4 - d1\right) - d3\right)\right)
Alternatives
| Alternative 1 |
|---|
| Error | 44.43% |
|---|
| Cost | 784 |
|---|
\[\begin{array}{l}
t_0 := d3 \cdot \left(-d1\right)\\
\mathbf{if}\;d4 \leq -1.25 \cdot 10^{-150}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 9 \cdot 10^{-186}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 1.55 \cdot 10^{-149}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 7.8 \cdot 10^{+46}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 7.59% |
|---|
| Cost | 713 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d1 \leq -1.05 \cdot 10^{+14} \lor \neg \left(d1 \leq 1.48 \cdot 10^{-18}\right):\\
\;\;\;\;d1 \cdot \left(\left(d4 - d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + \left(d4 - d3\right)\right)\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 19.35% |
|---|
| Cost | 648 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d2 \leq -2.3 \cdot 10^{-12}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{elif}\;d2 \leq -3.4 \cdot 10^{-101}:\\
\;\;\;\;d1 \cdot \left(\left(-d3\right) - d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 28.41% |
|---|
| Cost | 585 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d3 \leq -4 \cdot 10^{+51} \lor \neg \left(d3 \leq 7.6 \cdot 10^{+160}\right):\\
\;\;\;\;d3 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 9.86% |
|---|
| Cost | 580 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d1 \leq 1.9 \cdot 10^{+79}:\\
\;\;\;\;d1 \cdot \left(d2 + \left(d4 - d3\right)\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(-d3\right) - d1\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 48.34% |
|---|
| Cost | 520 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d2 \leq -5.8 \cdot 10^{-12}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d2 \leq -3.4 \cdot 10^{-101}:\\
\;\;\;\;d1 \cdot \left(-d1\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 21.87% |
|---|
| Cost | 452 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d4 \leq 7.2 \cdot 10^{+46}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 18.58% |
|---|
| Cost | 452 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d4 \leq 2.35 \cdot 10^{-14}:\\
\;\;\;\;d1 \cdot \left(d2 - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 47.69% |
|---|
| Cost | 324 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d4 \leq 2.35 \cdot 10^{-14}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 68.18% |
|---|
| Cost | 192 |
|---|
\[d1 \cdot d4
\]