\[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.3 |
|---|
| 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 | 32.6 |
|---|
| Cost | 1905 |
|---|
\[\begin{array}{l}
t_0 := 6 \cdot \left(x \cdot z\right)\\
t_1 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -1.95 \cdot 10^{+90}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -2.1:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -3.1 \cdot 10^{-14}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -5.2 \cdot 10^{-199}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.4 \cdot 10^{-265}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{-296}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-245}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-195}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-130}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.00062:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+124} \lor \neg \left(z \leq 4.2 \cdot 10^{+177}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 32.5 |
|---|
| Cost | 1905 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -9 \cdot 10^{+79}:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\
\mathbf{elif}\;z \leq -0.68:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-13}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -2.4 \cdot 10^{-199}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -2 \cdot 10^{-265}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-294}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 2.65 \cdot 10^{-245}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 3.9 \cdot 10^{-195}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.62 \cdot 10^{-127}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.00062:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{+124} \lor \neg \left(z \leq 2 \cdot 10^{+178}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 32.5 |
|---|
| Cost | 1905 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+86}:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\
\mathbf{elif}\;z \leq -1:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -7.8 \cdot 10^{-15}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -1.32 \cdot 10^{-200}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-265}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-299}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-245}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-195}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.06 \cdot 10^{-125}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.00062:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+121} \lor \neg \left(z \leq 2.2 \cdot 10^{+178}\right):\\
\;\;\;\;y \cdot \left(z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 32.6 |
|---|
| Cost | 1905 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+86}:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\
\mathbf{elif}\;z \leq -0.31:\\
\;\;\;\;z \cdot \left(y \cdot -6\right)\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-15}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-200}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{-266}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-297}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-245}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-195}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 10^{-127}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.00062:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{+119} \lor \neg \left(z \leq 3.9 \cdot 10^{+177}\right):\\
\;\;\;\;y \cdot \left(z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 21.0 |
|---|
| Cost | 1768 |
|---|
\[\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 -110:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-15}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.45 \cdot 10^{-197}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -9.6 \cdot 10^{-265}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-296}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 3.15 \cdot 10^{-245}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-195}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{-130}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{-73}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 65000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 21.0 |
|---|
| Cost | 1768 |
|---|
\[\begin{array}{l}
t_0 := x \cdot \left(-3 + z \cdot 6\right)\\
\mathbf{if}\;z \leq -110:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\mathbf{elif}\;z \leq -3.4 \cdot 10^{-15}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -3.1 \cdot 10^{-200}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -5 \cdot 10^{-265}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{-296}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-246}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-195}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{-129}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-74}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1250000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 21.8 |
|---|
| Cost | 1504 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -2.15 \cdot 10^{-13}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.04 \cdot 10^{-196}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.02 \cdot 10^{-266}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{-298}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-246}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-195}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-129}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.55:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 32.8 |
|---|
| Cost | 1376 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -0.045:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -2.45 \cdot 10^{-200}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -2.25 \cdot 10^{-265}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-295}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-246}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-195}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-128}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.00062:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 19.0 |
|---|
| Cost | 1243 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{+79} \lor \neg \left(y \leq -7.8 \cdot 10^{-23} \lor \neg \left(y \leq -3.7 \cdot 10^{-103}\right) \land \left(y \leq 1.25 \cdot 10^{-60} \lor \neg \left(y \leq 7 \cdot 10^{-29}\right) \land y \leq 6.8 \cdot 10^{+38}\right)\right):\\
\;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 0.3 |
|---|
| Cost | 1088 |
|---|
\[x \cdot \left(1 + -6 \cdot \left(0.6666666666666666 - z\right)\right) + 6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)
\]
| Alternative 12 |
|---|
| Error | 0.3 |
|---|
| Cost | 832 |
|---|
\[x + \frac{\left(y - x\right) \cdot 6}{\frac{1}{0.6666666666666666 - z}}
\]
| Alternative 13 |
|---|
| Error | 1.8 |
|---|
| Cost | 712 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -0.58:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\mathbf{elif}\;z \leq 0.68:\\
\;\;\;\;y \cdot 4 + x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\end{array}
\]
| Alternative 14 |
|---|
| Error | 0.4 |
|---|
| Cost | 704 |
|---|
\[x + \left(0.6666666666666666 - z\right) \cdot \left(\left(y - x\right) \cdot 6\right)
\]
| Alternative 15 |
|---|
| Error | 33.6 |
|---|
| Cost | 456 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{+79}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+88}:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;y \cdot 4\\
\end{array}
\]
| Alternative 16 |
|---|
| Error | 43.2 |
|---|
| Cost | 192 |
|---|
\[y \cdot 4
\]