\[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 | 18.2 |
|---|
| Cost | 1243 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+42} \lor \neg \left(x \leq -1.4 \cdot 10^{-69} \lor \neg \left(x \leq -7.5 \cdot 10^{-126}\right) \land \left(x \leq 4 \cdot 10^{-63} \lor \neg \left(x \leq 7.5 \cdot 10^{-53}\right) \land x \leq 3.4 \cdot 10^{-22}\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 2 |
|---|
| Error | 18.0 |
|---|
| Cost | 1243 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+42} \lor \neg \left(x \leq -4.2 \cdot 10^{-69} \lor \neg \left(x \leq -3.5 \cdot 10^{-118}\right) \land \left(x \leq 10^{-62} \lor \neg \left(x \leq 5.9 \cdot 10^{-53}\right) \land x \leq 2.85 \cdot 10^{-30}\right)\right):\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\
\end{array}
\]
| Alternative 3 |
|---|
| 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 4 |
|---|
| Error | 32.8 |
|---|
| Cost | 848 |
|---|
\[\begin{array}{l}
t_0 := 6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -3 \cdot 10^{+91}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -0.66:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-287}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 32.8 |
|---|
| Cost | 848 |
|---|
\[\begin{array}{l}
t_0 := 6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -4.3 \cdot 10^{+90}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -0.66:\\
\;\;\;\;y \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;z \leq 5.5 \cdot 10^{-288}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 32.8 |
|---|
| Cost | 848 |
|---|
\[\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+91}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -0.66:\\
\;\;\;\;y \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{-288}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot 6\right)\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 21.3 |
|---|
| Cost | 844 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -1.4 \cdot 10^{-10}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 10^{-287}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 8 |
|---|
| Error | 21.8 |
|---|
| Cost | 844 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -3.1 \cdot 10^{+41}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-288}:\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 32.2 |
|---|
| Cost | 716 |
|---|
\[\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -0.66:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-287}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.55:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
| Alternative 10 |
|---|
| Error | 1.8 |
|---|
| 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.55:\\
\;\;\;\;x \cdot -3 + y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\left(y - x\right) \cdot -6\right)\\
\end{array}
\]
| Alternative 11 |
|---|
| Error | 0.4 |
|---|
| Cost | 704 |
|---|
\[x + \left(0.6666666666666666 - z\right) \cdot \left(\left(y - x\right) \cdot 6\right)
\]
| Alternative 12 |
|---|
| Error | 0.2 |
|---|
| Cost | 704 |
|---|
\[x + \left(y - x\right) \cdot \frac{z + -0.6666666666666666}{-0.16666666666666666}
\]
| Alternative 13 |
|---|
| Error | 0.2 |
|---|
| Cost | 704 |
|---|
\[x + \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)
\]
| Alternative 14 |
|---|
| Error | 33.7 |
|---|
| Cost | 456 |
|---|
\[\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-34}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;x \leq 8.6 \cdot 10^{-27}:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;x \cdot -3\\
\end{array}
\]
| Alternative 15 |
|---|
| Error | 43.2 |
|---|
| Cost | 192 |
|---|
\[x \cdot -3
\]