Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
\]
↓
\[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
\]
(FPCore (re im)
:precision binary64
(* (* 0.5 (cos re)) (+ (exp (- im)) (exp im)))) ↓
(FPCore (re im)
:precision binary64
(* (* 0.5 (cos re)) (+ (exp (- im)) (exp im)))) double code(double re, double im) {
return (0.5 * cos(re)) * (exp(-im) + exp(im));
}
↓
double code(double re, double im) {
return (0.5 * cos(re)) * (exp(-im) + exp(im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp(-im) + exp(im))
end function
↓
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp(-im) + exp(im))
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp(-im) + Math.exp(im));
}
↓
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp(-im) + Math.exp(im));
}
def code(re, im):
return (0.5 * math.cos(re)) * (math.exp(-im) + math.exp(im))
↓
def code(re, im):
return (0.5 * math.cos(re)) * (math.exp(-im) + math.exp(im))
function code(re, im)
return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im)))
end
↓
function code(re, im)
return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(-im)) + exp(im)))
end
function tmp = code(re, im)
tmp = (0.5 * cos(re)) * (exp(-im) + exp(im));
end
↓
function tmp = code(re, im)
tmp = (0.5 * cos(re)) * (exp(-im) + exp(im));
end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
↓
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
↓
\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
Alternatives Alternative 1 Accuracy 100.0% Cost 19712
\[\left(0.5 \cdot \cos re\right) \cdot \left(e^{-im} + e^{im}\right)
\]
Alternative 2 Accuracy 93.0% Cost 14357
\[\begin{array}{l}
t_0 := e^{-im} + e^{im}\\
t_1 := \left(0.5 \cdot \cos re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{if}\;im \leq -9.6 \cdot 10^{+158}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -2 \cdot 10^{+71}:\\
\;\;\;\;0.5 \cdot t_0\\
\mathbf{elif}\;im \leq -0.00043 \lor \neg \left(im \leq 33.5\right) \land im \leq 1.34 \cdot 10^{+154}:\\
\;\;\;\;t_0 \cdot \left(0.5 \cdot \left(1 + -0.5 \cdot \left(re \cdot re\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 3 Accuracy 93.0% Cost 13714
\[\begin{array}{l}
\mathbf{if}\;im \leq -9.6 \cdot 10^{+158} \lor \neg \left(im \leq -0.00043 \lor \neg \left(im \leq 0.031\right) \land im \leq 1.34 \cdot 10^{+154}\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} + e^{im}\right)\\
\end{array}
\]
Alternative 4 Accuracy 86.2% Cost 8341
\[\begin{array}{l}
t_0 := 2 + \left(im \cdot im + 0.08333333333333333 \cdot {im}^{4}\right)\\
t_1 := \left(0.5 \cdot \cos re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{if}\;im \leq -9.6 \cdot 10^{+158}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -7.5 \cdot 10^{+78}:\\
\;\;\;\;0.5 \cdot t_0\\
\mathbf{elif}\;im \leq -0.00043 \lor \neg \left(im \leq 33.5\right) \land im \leq 1.5 \cdot 10^{+154}:\\
\;\;\;\;\left(0.5 \cdot \left(1 + -0.5 \cdot \left(re \cdot re\right)\right)\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 5 Accuracy 86.3% Cost 8085
\[\begin{array}{l}
t_0 := 0.08333333333333333 \cdot {im}^{4}\\
t_1 := \left(0.5 \cdot \cos re\right) \cdot \left(2 + im \cdot im\right)\\
\mathbf{if}\;im \leq -9.6 \cdot 10^{+158}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -2 \cdot 10^{+78}:\\
\;\;\;\;0.5 \cdot \left(2 + \left(im \cdot im + t_0\right)\right)\\
\mathbf{elif}\;im \leq -410 \lor \neg \left(im \leq 33.5\right) \land im \leq 1.34 \cdot 10^{+154}:\\
\;\;\;\;\left(0.5 \cdot \left(1 + -0.5 \cdot \left(re \cdot re\right)\right)\right) \cdot \left(2 + t_0\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 6 Accuracy 85.5% Cost 7960
\[\begin{array}{l}
t_0 := 0.5 \cdot \left(2 + \left(im \cdot im + 0.08333333333333333 \cdot {im}^{4}\right)\right)\\
t_1 := 2 + im \cdot im\\
t_2 := \left(0.5 \cdot \cos re\right) \cdot t_1\\
t_3 := t_1 \cdot \left(0.5 \cdot \left(1 + -0.5 \cdot \left(re \cdot re\right)\right)\right)\\
\mathbf{if}\;im \leq -9.6 \cdot 10^{+158}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq -1.15 \cdot 10^{+77}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -380:\\
\;\;\;\;t_3\\
\mathbf{elif}\;im \leq 33.5:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq 1.5 \cdot 10^{+58}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;im \leq 1.34 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\]
Alternative 7 Accuracy 73.1% Cost 7057
\[\begin{array}{l}
t_0 := \left(2 + im \cdot im\right) \cdot \left(0.5 \cdot \left(1 + -0.5 \cdot \left(re \cdot re\right)\right)\right)\\
\mathbf{if}\;im \leq -0.000215:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 33.5:\\
\;\;\;\;\cos re\\
\mathbf{elif}\;im \leq 1.6 \cdot 10^{+57} \lor \neg \left(im \leq 4.2 \cdot 10^{+116}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;{re}^{-2}\\
\end{array}
\]
Alternative 8 Accuracy 75.8% Cost 6976
\[\left(0.5 \cdot \cos re\right) \cdot \left(2 + im \cdot im\right)
\]
Alternative 9 Accuracy 72.9% Cost 6729
\[\begin{array}{l}
\mathbf{if}\;im \leq -0.00036 \lor \neg \left(im \leq 33.5\right):\\
\;\;\;\;\left(2 + im \cdot im\right) \cdot \left(0.5 \cdot \left(1 + -0.5 \cdot \left(re \cdot re\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos re\\
\end{array}
\]
Alternative 10 Accuracy 49.1% Cost 960
\[\left(2 + im \cdot im\right) \cdot \left(0.5 \cdot \left(1 + -0.5 \cdot \left(re \cdot re\right)\right)\right)
\]
Alternative 11 Accuracy 34.2% Cost 585
\[\begin{array}{l}
\mathbf{if}\;im \leq -520 \lor \neg \left(im \leq 600\right):\\
\;\;\;\;-2 - re \cdot re\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\]
Alternative 12 Accuracy 34.4% Cost 585
\[\begin{array}{l}
\mathbf{if}\;im \leq -320 \lor \neg \left(im \leq 550\right):\\
\;\;\;\;re - re \cdot re\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\]
Alternative 13 Accuracy 47.8% Cost 580
\[\begin{array}{l}
\mathbf{if}\;re \leq -4.3 \cdot 10^{+158}:\\
\;\;\;\;-2 - re \cdot re\\
\mathbf{else}:\\
\;\;\;\;1 + 0.5 \cdot \left(im \cdot im\right)\\
\end{array}
\]
Alternative 14 Accuracy 32.7% Cost 448
\[1 + -0.5 \cdot \left(re \cdot re\right)
\]
Alternative 15 Accuracy 28.6% Cost 64
\[1
\]