\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\]
↓
\[\mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 4\right), x\right)
\]
(FPCore (x y z)
:precision binary64
(+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
↓
(FPCore (x y z) :precision binary64 (fma (- y x) (fma z -6.0 4.0) x))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
↓
double code(double x, double y, double z) {
return fma((y - x), fma(z, -6.0, 4.0), x);
}
function code(x, y, z)
return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z)))
end
↓
function code(x, y, z)
return fma(Float64(y - x), fma(z, -6.0, 4.0), x)
end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
↓
code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] * N[(z * -6.0 + 4.0), $MachinePrecision] + x), $MachinePrecision]
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
↓
\mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 4\right), x\right)
Alternatives
| Alternative 1 |
|---|
| Error | 0.47% |
|---|
| Cost | 7360 |
|---|
\[\mathsf{fma}\left(1 + -6 \cdot \left(0.6666666666666666 - z\right), x, \left(0.6666666666666666 - z\right) \cdot \left(y \cdot 6\right)\right)
\]
| Alternative 2 |
|---|
| Error | 0.63% |
|---|
| Cost | 6976 |
|---|
\[\mathsf{fma}\left(\frac{y - x}{0.16666666666666666}, 0.6666666666666666 - z, x\right)
\]
| Alternative 3 |
|---|
| Error | 51.36% |
|---|
| Cost | 1376 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
t_1 := 6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -1.1 \cdot 10^{+219}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -27500:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{-131}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.75 \cdot 10^{-163}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{-293}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-239}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.58 \cdot 10^{-12}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 10^{+67}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 51.43% |
|---|
| Cost | 1376 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
t_1 := x \cdot \left(z \cdot 6\right)\\
\mathbf{if}\;z \leq -5.8 \cdot 10^{+215}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -27500:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.16 \cdot 10^{-137}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.22 \cdot 10^{-163}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-293}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-241}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.58 \cdot 10^{-12}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+65}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 51.28% |
|---|
| Cost | 1376 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+217}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -460000:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\
\mathbf{elif}\;z \leq -7 \cdot 10^{-138}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -5.1 \cdot 10^{-163}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -2.3 \cdot 10^{-292}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 3.45 \cdot 10^{-239}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.58 \cdot 10^{-12}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{+66}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot 6\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 51.38% |
|---|
| Cost | 1376 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+216}:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -27500:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{-135}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.25 \cdot 10^{-163}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -5.2 \cdot 10^{-292}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-240}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.58 \cdot 10^{-12}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+61}:\\
\;\;\;\;y \cdot \left(z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot 6\right)\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 50.98% |
|---|
| Cost | 1244 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -0.052:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{-89}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -2.7 \cdot 10^{-132}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1 \cdot 10^{-163}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-292}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-240}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.58 \cdot 10^{-12}:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 28.53% |
|---|
| Cost | 1243 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{+77} \lor \neg \left(x \leq -2.2 \cdot 10^{+21}\right) \land \left(x \leq -1.65 \cdot 10^{-23} \lor \neg \left(x \leq 5.4 \cdot 10^{-89}\right) \land \left(x \leq 7.5 \cdot 10^{-45} \lor \neg \left(x \leq 3.3 \cdot 10^{+17}\right)\right)\right):\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 28.44% |
|---|
| Cost | 1243 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{+77} \lor \neg \left(x \leq -2.6 \cdot 10^{+22}\right) \land \left(x \leq -2.4 \cdot 10^{-24} \lor \neg \left(x \leq 5.2 \cdot 10^{-89}\right) \land \left(x \leq 2.4 \cdot 10^{-42} \lor \neg \left(x \leq 6.2 \cdot 10^{+15}\right)\right)\right):\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 33.08% |
|---|
| Cost | 1240 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -6.8 \cdot 10^{-17}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-133}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -5.4 \cdot 10^{-163}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -1.46 \cdot 10^{-291}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-239}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.6:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 32.22% |
|---|
| Cost | 1240 |
|---|
\[\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
t_1 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -1450000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.06 \cdot 10^{-133}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -2.3 \cdot 10^{-163}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -6.2 \cdot 10^{-292}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-238}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 12000000000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 0.48% |
|---|
| Cost | 832 |
|---|
\[x + \frac{\left(y - x\right) \cdot 6}{\frac{1}{0.6666666666666666 - z}}
\]
| Alternative 13 |
|---|
| Error | 2.69% |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -0.58:\\
\;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 0.65:\\
\;\;\;\;y \cdot 4 + x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\end{array}
\]
| Alternative 14 |
|---|
| Error | 0.62% |
|---|
| Cost | 704 |
|---|
\[x + \left(0.6666666666666666 - z\right) \cdot \left(\left(y - x\right) \cdot 6\right)
\]
| Alternative 15 |
|---|
| Error | 53.68% |
|---|
| Cost | 456 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+79}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;x \leq 2750:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;x \cdot -3\\
\end{array}
\]
| Alternative 16 |
|---|
| Error | 67.97% |
|---|
| Cost | 192 |
|---|
\[y \cdot 4
\]