\[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.5 |
|---|
| Cost | 1509 |
|---|
\[\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 -3 \cdot 10^{+78}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -4 \cdot 10^{+60}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -0.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-290}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-271}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-106}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 11:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{+53} \lor \neg \left(z \leq 9.2 \cdot 10^{+129}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 32.5 |
|---|
| Cost | 1509 |
|---|
\[\begin{array}{l}
t_0 := x \cdot \left(z \cdot 6\right)\\
t_1 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{+78}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -4 \cdot 10^{+60}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -0.5:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-290}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-268}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{-96}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 11:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.5 \cdot 10^{+50} \lor \neg \left(z \leq 1.8 \cdot 10^{+134}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 32.5 |
|---|
| Cost | 1509 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+78}:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{+60}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -0.5:\\
\;\;\;\;z \cdot \left(x \cdot 6\right)\\
\mathbf{elif}\;z \leq 7 \cdot 10^{-288}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-273}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-103}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 11:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+51} \lor \neg \left(z \leq 2.3 \cdot 10^{+133}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 32.5 |
|---|
| Cost | 1508 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+78}:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\
\mathbf{elif}\;z \leq -6.2 \cdot 10^{+60}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -0.5:\\
\;\;\;\;z \cdot \left(x \cdot 6\right)\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-288}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-270}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-106}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 11:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+50}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+134}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot -6\right)\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 32.5 |
|---|
| Cost | 1508 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+78}:\\
\;\;\;\;x \cdot \left(z \cdot 6\right)\\
\mathbf{elif}\;z \leq -6.2 \cdot 10^{+60}:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -0.5:\\
\;\;\;\;z \cdot \left(x \cdot 6\right)\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{-290}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-270}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-100}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 11:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+51}:\\
\;\;\;\;y \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{+128}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot -6\right)\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 21.4 |
|---|
| Cost | 1108 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{-18}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{-290}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-272}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{-100}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.58:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 21.2 |
|---|
| Cost | 1108 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{-18}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-288}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-273}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-105}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 14500000000000:\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 9 |
|---|
| 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 10 |
|---|
| Error | 32.8 |
|---|
| Cost | 980 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{-18}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 10^{-290}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{-273}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{-97}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 11:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 18.1 |
|---|
| Cost | 976 |
|---|
\[\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 -5.3 \cdot 10^{-30}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-110}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-170}:\\
\;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{+22}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 12 |
|---|
| Error | 18.1 |
|---|
| Cost | 976 |
|---|
\[\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 -3.2 \cdot 10^{-30}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1 \cdot 10^{-109}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-170}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{+22}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 13 |
|---|
| Error | 18.1 |
|---|
| Cost | 976 |
|---|
\[\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 -1.15 \cdot 10^{-29}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-110}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-170}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{+23}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
| Alternative 14 |
|---|
| Error | 0.4 |
|---|
| Cost | 832 |
|---|
\[x + \frac{\left(0.6666666666666666 - z\right) \cdot 6}{\frac{1}{y - x}}
\]
| Alternative 15 |
|---|
| Error | 1.7 |
|---|
| 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.5:\\
\;\;\;\;y \cdot 4 + x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\end{array}
\]
| Alternative 16 |
|---|
| Error | 0.4 |
|---|
| Cost | 704 |
|---|
\[x + \left(0.6666666666666666 - z\right) \cdot \left(\left(y - x\right) \cdot 6\right)
\]
| Alternative 17 |
|---|
| Error | 33.3 |
|---|
| Cost | 456 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y \leq -9.6 \cdot 10^{+53}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;y \leq 8000000:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;y \cdot 4\\
\end{array}
\]
| Alternative 18 |
|---|
| Error | 43.2 |
|---|
| Cost | 192 |
|---|
\[y \cdot 4
\]