\[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.71% |
|---|
| Cost | 1504 |
|---|
\[\begin{array}{l}
t_0 := x \cdot \left(-3 + z \cdot 6\right)\\
t_1 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -280000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.8 \cdot 10^{-54}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -5.8 \cdot 10^{-139}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-204}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-304}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-13}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 10.5:\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
\mathbf{elif}\;z \leq 110000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 32.71% |
|---|
| Cost | 1504 |
|---|
\[\begin{array}{l}
t_0 := x \cdot \left(-3 + z \cdot 6\right)\\
t_1 := z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\mathbf{if}\;z \leq -255000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.4 \cdot 10^{-54}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-138}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.35 \cdot 10^{-203}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-307}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-13}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 12:\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
\mathbf{elif}\;z \leq 165000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 32.86% |
|---|
| Cost | 1504 |
|---|
\[\begin{array}{l}
t_0 := x \cdot \left(-3 + z \cdot 6\right)\\
t_1 := y \cdot \left(4 + z \cdot -6\right)\\
t_2 := z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\mathbf{if}\;z \leq -48000000:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -1.42 \cdot 10^{-55}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -3.9 \cdot 10^{-143}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{-204}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{-305}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-13}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 9.2:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 150000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 33.02% |
|---|
| Cost | 1372 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -0.058:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{-55}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{-138}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.75 \cdot 10^{-202}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-304}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 4.15 \cdot 10^{-13}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 2050000:\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 51.28% |
|---|
| Cost | 1244 |
|---|
\[\begin{array}{l}
t_0 := 6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -0.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -8.8 \cdot 10^{-55}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -6.5 \cdot 10^{-137}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.85 \cdot 10^{-203}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-303}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+145}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 51.52% |
|---|
| Cost | 1244 |
|---|
\[\begin{array}{l}
t_0 := x \cdot \left(z \cdot 6\right)\\
\mathbf{if}\;z \leq -0.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -4.1 \cdot 10^{-55}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-142}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.42 \cdot 10^{-202}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 4.9 \cdot 10^{-307}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{+148}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 51.44% |
|---|
| Cost | 1244 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -0.5:\\
\;\;\;\;z \cdot \left(x \cdot 6\right)\\
\mathbf{elif}\;z \leq -4.8 \cdot 10^{-55}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{-137}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.26 \cdot 10^{-205}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-307}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+148}:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 33.57% |
|---|
| Cost | 1240 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -0.04:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.6 \cdot 10^{-55}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{-142}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -4.8 \cdot 10^{-202}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-305}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 50.92% |
|---|
| Cost | 1112 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -2450:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.7 \cdot 10^{-55}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -2 \cdot 10^{-139}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -2.05 \cdot 10^{-205}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-307}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 2.96% |
|---|
| Cost | 713 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -0.6 \lor \neg \left(z \leq 0.63\right):\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 4 + x \cdot -3\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 2.96% |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -0.55:\\
\;\;\;\;z \cdot \left(x \cdot 6 + y \cdot -6\right)\\
\mathbf{elif}\;z \leq 0.52:\\
\;\;\;\;y \cdot 4 + x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 0.69% |
|---|
| Cost | 704 |
|---|
\[x + \left(0.6666666666666666 - z\right) \cdot \left(\left(y - x\right) \cdot 6\right)
\]
| Alternative 13 |
|---|
| Error | 0.33% |
|---|
| Cost | 704 |
|---|
\[x + \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)
\]
| Alternative 14 |
|---|
| Error | 53.11% |
|---|
| Cost | 456 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -3700000000:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{+87}:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;y \cdot 4\\
\end{array}
\]
| Alternative 15 |
|---|
| Error | 67.66% |
|---|
| Cost | 192 |
|---|
\[y \cdot 4
\]