\[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 | 32.4 |
|---|
| Cost | 1244 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -1.52 \cdot 10^{+87}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -0.0145:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-146}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-277}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-189}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-138}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.52:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 32.4 |
|---|
| Cost | 1244 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -1.75 \cdot 10^{+89}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -0.0145:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\
\mathbf{elif}\;z \leq -4 \cdot 10^{-146}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.72 \cdot 10^{-277}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-189}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-140}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.64:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 32.4 |
|---|
| Cost | 1244 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -6 \cdot 10^{+87}:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -0.0145:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\
\mathbf{elif}\;z \leq -1.95 \cdot 10^{-146}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{-274}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-189}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-140}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.65:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot -6\right)\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 32.7 |
|---|
| Cost | 1112 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -0.0145:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -4.3 \cdot 10^{-146}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-276}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-190}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-138}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.64:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 17.3 |
|---|
| Cost | 1108 |
|---|
\[\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
t_1 := x \cdot \left(-3 + z \cdot 6\right)\\
\mathbf{if}\;x \leq -24000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.72 \cdot 10^{-68}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 25:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.42 \cdot 10^{+32}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+77}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 17.3 |
|---|
| Cost | 1108 |
|---|
\[\begin{array}{l}
t_0 := y \cdot \left(4 + z \cdot -6\right)\\
t_1 := x \cdot \left(-3 + z \cdot 6\right)\\
\mathbf{if}\;x \leq -160000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 6.8 \cdot 10^{-68}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 23:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+32}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{+77}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 23.1 |
|---|
| Cost | 976 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -6.2 \cdot 10^{+63}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{+45}:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\
\mathbf{elif}\;x \leq -170000000:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+77}:\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot -3\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 0.2 |
|---|
| Cost | 960 |
|---|
\[\left(x + \left(y - x\right) \cdot \left(z \cdot -6\right)\right) + \left(y - x\right) \cdot 4
\]
| Alternative 9 |
|---|
| Error | 0.3 |
|---|
| Cost | 832 |
|---|
\[x + \frac{\left(y - x\right) \cdot 6}{\frac{1}{0.6666666666666666 - z}}
\]
| Alternative 10 |
|---|
| Error | 16.4 |
|---|
| Cost | 713 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -2100000 \lor \neg \left(x \leq 9.5 \cdot 10^{-69}\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 11 |
|---|
| Error | 1.9 |
|---|
| Cost | 713 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -0.58 \lor \neg \left(z \leq 0.52\right):\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - x\right) \cdot 4\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 0.4 |
|---|
| Cost | 704 |
|---|
\[x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)
\]
| Alternative 13 |
|---|
| Error | 33.7 |
|---|
| Cost | 456 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.38 \cdot 10^{-30}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;y \leq 0.00065:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;y \cdot 4\\
\end{array}
\]
| Alternative 14 |
|---|
| Error | 43.2 |
|---|
| Cost | 192 |
|---|
\[y \cdot 4
\]