\[e^{re} \cdot \cos im
\]
↓
\[e^{re} \cdot \cos im
\]
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
↓
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
↓
double code(double re, double im) {
return exp(re) * cos(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
↓
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
↓
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im):
return math.exp(re) * math.cos(im)
↓
def code(re, im):
return math.exp(re) * math.cos(im)
function code(re, im)
return Float64(exp(re) * cos(im))
end
↓
function code(re, im)
return Float64(exp(re) * cos(im))
end
function tmp = code(re, im)
tmp = exp(re) * cos(im);
end
↓
function tmp = code(re, im)
tmp = exp(re) * cos(im);
end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
↓
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
e^{re} \cdot \cos im
↓
e^{re} \cdot \cos im
Alternatives
| Alternative 1 |
|---|
| Error | 0.7% |
|---|
| Cost | 13892 |
|---|
\[\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.98:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(\left(re + 1\right) + \left(re \cdot re\right) \cdot \left(re \cdot 0.16666666666666666 + 0.5\right)\right)\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 0.8% |
|---|
| Cost | 13636 |
|---|
\[\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.98:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(\left(re + 1\right) + re \cdot \left(re \cdot 0.5\right)\right)\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 1.02% |
|---|
| Cost | 13252 |
|---|
\[\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.98:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im \cdot \left(re + 1\right)\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 1.62% |
|---|
| Cost | 12996 |
|---|
\[\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.9999995:\\
\;\;\;\;e^{re}\\
\mathbf{else}:\\
\;\;\;\;\cos im\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 26.55% |
|---|
| Cost | 6596 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -540:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;\cos im\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 55.88% |
|---|
| Cost | 452 |
|---|
\[\begin{array}{l}
\mathbf{if}\;re \leq -2.1:\\
\;\;\;\;-0.5 \cdot \left(im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;re + 1\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 63.65% |
|---|
| Cost | 64 |
|---|
\[1
\]