\[\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
\]
↓
\[\mathsf{fma}\left(d1, d2 - d3, d1 \cdot \left(d4 - d1\right)\right)
\]
(FPCore (d1 d2 d3 d4)
:precision binary64
(- (+ (- (* d1 d2) (* d1 d3)) (* d4 d1)) (* d1 d1)))
↓
(FPCore (d1 d2 d3 d4) :precision binary64 (fma d1 (- d2 d3) (* d1 (- d4 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(d1, (d2 - d3), (d1 * (d4 - 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 fma(d1, Float64(d2 - d3), Float64(d1 * Float64(d4 - 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[(d1 * N[(d2 - d3), $MachinePrecision] + N[(d1 * N[(d4 - d1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(d1 \cdot d2 - d1 \cdot d3\right) + d4 \cdot d1\right) - d1 \cdot d1
↓
\mathsf{fma}\left(d1, d2 - d3, d1 \cdot \left(d4 - d1\right)\right)
Alternatives
| Alternative 1 |
|---|
| Error | 18.0 |
|---|
| Cost | 1112 |
|---|
\[\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
t_1 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d3 \leq -3.6 \cdot 10^{+115}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -9.8 \cdot 10^{+31}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -5.7 \cdot 10^{-26}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{elif}\;d3 \leq -4.3 \cdot 10^{-72}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -1.4 \cdot 10^{-101}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d3 \leq 1.05 \cdot 10^{+103}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 17.7 |
|---|
| Cost | 848 |
|---|
\[\begin{array}{l}
t_0 := d1 \cdot \left(-d3\right)\\
t_1 := d1 \cdot \left(d2 + d4\right)\\
\mathbf{if}\;d3 \leq -3.5 \cdot 10^{+115}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -2.9 \cdot 10^{+33}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;d3 \leq -4.7 \cdot 10^{-26}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{elif}\;d3 \leq 1.2 \cdot 10^{+105}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 15.6 |
|---|
| Cost | 848 |
|---|
\[\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d3 \leq -1 \cdot 10^{+48}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d3 \leq -5.8 \cdot 10^{-26}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\mathbf{elif}\;d3 \leq -7.8 \cdot 10^{-103}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d3 \leq 4 \cdot 10^{+82}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 20.5 |
|---|
| Cost | 716 |
|---|
\[\begin{array}{l}
t_0 := d1 \cdot \left(d2 - d3\right)\\
\mathbf{if}\;d4 \leq 1.5 \cdot 10^{-260}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;d4 \leq 2.7 \cdot 10^{-161}:\\
\;\;\;\;d1 \cdot \left(d2 - d1\right)\\
\mathbf{elif}\;d4 \leq 21000000000000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d3\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 5.8 |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d1 \leq -7.6 \cdot 10^{+56}:\\
\;\;\;\;d1 \cdot \left(\left(-d1\right) - d3\right)\\
\mathbf{elif}\;d1 \leq 5.5 \cdot 10^{+97}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d4 - d1\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 17.3 |
|---|
| Cost | 585 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d3 \leq -1.45 \cdot 10^{+114} \lor \neg \left(d3 \leq 4.45 \cdot 10^{+102}\right):\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(d2 + d4\right)\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 10.4 |
|---|
| Cost | 580 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d2 \leq -8.5 \cdot 10^{-55}:\\
\;\;\;\;d1 \cdot \left(\left(d2 + d4\right) - d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot \left(\left(d4 - d3\right) - d1\right)\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 0.0 |
|---|
| Cost | 576 |
|---|
\[d1 \cdot \left(\left(d2 - d3\right) + \left(d4 - d1\right)\right)
\]
| Alternative 9 |
|---|
| Error | 37.4 |
|---|
| Cost | 520 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d4 \leq 3.8 \cdot 10^{-159}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{elif}\;d4 \leq 2.3 \cdot 10^{+84}:\\
\;\;\;\;d1 \cdot \left(-d3\right)\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 37.4 |
|---|
| Cost | 324 |
|---|
\[\begin{array}{l}
\mathbf{if}\;d4 \leq 1.25 \cdot 10^{+18}:\\
\;\;\;\;d1 \cdot d2\\
\mathbf{else}:\\
\;\;\;\;d1 \cdot d4\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 43.6 |
|---|
| Cost | 192 |
|---|
\[d1 \cdot d4
\]