Math FPCore C Fortran Java Python Julia MATLAB Wolfram TeX \[\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)
\]
↓
\[\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -2 \cdot 10^{+14} \lor \neg \left(t_0 \leq 0.001\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left({im}^{5} \cdot -0.008333333333333333 - im\right)\right)\\
\end{array}
\]
(FPCore (re im)
:precision binary64
(* (* 0.5 (cos re)) (- (exp (- 0.0 im)) (exp im)))) ↓
(FPCore (re im)
:precision binary64
(let* ((t_0 (- (exp (- im)) (exp im))))
(if (or (<= t_0 -2e+14) (not (<= t_0 0.001)))
(* (* 0.5 (cos re)) t_0)
(*
(cos re)
(+
(* (pow im 3.0) -0.16666666666666666)
(- (* (pow im 5.0) -0.008333333333333333) im)))))) double code(double re, double im) {
return (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
}
↓
double code(double re, double im) {
double t_0 = exp(-im) - exp(im);
double tmp;
if ((t_0 <= -2e+14) || !(t_0 <= 0.001)) {
tmp = (0.5 * cos(re)) * t_0;
} else {
tmp = cos(re) * ((pow(im, 3.0) * -0.16666666666666666) + ((pow(im, 5.0) * -0.008333333333333333) - im));
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = (0.5d0 * cos(re)) * (exp((0.0d0 - im)) - exp(im))
end function
↓
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: t_0
real(8) :: tmp
t_0 = exp(-im) - exp(im)
if ((t_0 <= (-2d+14)) .or. (.not. (t_0 <= 0.001d0))) then
tmp = (0.5d0 * cos(re)) * t_0
else
tmp = cos(re) * (((im ** 3.0d0) * (-0.16666666666666666d0)) + (((im ** 5.0d0) * (-0.008333333333333333d0)) - im))
end if
code = tmp
end function
public static double code(double re, double im) {
return (0.5 * Math.cos(re)) * (Math.exp((0.0 - im)) - Math.exp(im));
}
↓
public static double code(double re, double im) {
double t_0 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_0 <= -2e+14) || !(t_0 <= 0.001)) {
tmp = (0.5 * Math.cos(re)) * t_0;
} else {
tmp = Math.cos(re) * ((Math.pow(im, 3.0) * -0.16666666666666666) + ((Math.pow(im, 5.0) * -0.008333333333333333) - im));
}
return tmp;
}
def code(re, im):
return (0.5 * math.cos(re)) * (math.exp((0.0 - im)) - math.exp(im))
↓
def code(re, im):
t_0 = math.exp(-im) - math.exp(im)
tmp = 0
if (t_0 <= -2e+14) or not (t_0 <= 0.001):
tmp = (0.5 * math.cos(re)) * t_0
else:
tmp = math.cos(re) * ((math.pow(im, 3.0) * -0.16666666666666666) + ((math.pow(im, 5.0) * -0.008333333333333333) - im))
return tmp
function code(re, im)
return Float64(Float64(0.5 * cos(re)) * Float64(exp(Float64(0.0 - im)) - exp(im)))
end
↓
function code(re, im)
t_0 = Float64(exp(Float64(-im)) - exp(im))
tmp = 0.0
if ((t_0 <= -2e+14) || !(t_0 <= 0.001))
tmp = Float64(Float64(0.5 * cos(re)) * t_0);
else
tmp = Float64(cos(re) * Float64(Float64((im ^ 3.0) * -0.16666666666666666) + Float64(Float64((im ^ 5.0) * -0.008333333333333333) - im)));
end
return tmp
end
function tmp = code(re, im)
tmp = (0.5 * cos(re)) * (exp((0.0 - im)) - exp(im));
end
↓
function tmp_2 = code(re, im)
t_0 = exp(-im) - exp(im);
tmp = 0.0;
if ((t_0 <= -2e+14) || ~((t_0 <= 0.001)))
tmp = (0.5 * cos(re)) * t_0;
else
tmp = cos(re) * (((im ^ 3.0) * -0.16666666666666666) + (((im ^ 5.0) * -0.008333333333333333) - im));
end
tmp_2 = tmp;
end
code[re_, im_] := N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
↓
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -2e+14], N[Not[LessEqual[t$95$0, 0.001]], $MachinePrecision]], N[(N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], N[(N[Cos[re], $MachinePrecision] * N[(N[(N[Power[im, 3.0], $MachinePrecision] * -0.16666666666666666), $MachinePrecision] + N[(N[(N[Power[im, 5.0], $MachinePrecision] * -0.008333333333333333), $MachinePrecision] - im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\left(0.5 \cdot \cos re\right) \cdot \left(e^{0 - im} - e^{im}\right)
↓
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -2 \cdot 10^{+14} \lor \neg \left(t_0 \leq 0.001\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left({im}^{5} \cdot -0.008333333333333333 - im\right)\right)\\
\end{array}
Alternatives Alternative 1 Accuracy 99.7% Cost 46281
\[\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -2 \cdot 10^{+14} \lor \neg \left(t_0 \leq 0.001\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 + \left({im}^{5} \cdot -0.008333333333333333 - im\right)\right)\\
\end{array}
\]
Alternative 2 Accuracy 99.7% Cost 45961
\[\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -2 \cdot 10^{+14} \lor \neg \left(t_0 \leq 0.001\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\end{array}
\]
Alternative 3 Accuracy 97.1% Cost 14096
\[\begin{array}{l}
t_0 := \left(e^{-im} - e^{im}\right) \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
t_1 := -0.008333333333333333 \cdot \left(\cos re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -1.05 \cdot 10^{+68}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.082:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 33.5:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 4 Accuracy 91.1% Cost 13712
\[\begin{array}{l}
t_0 := \left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(-0.5 \cdot \left(re \cdot re\right) + 1\right)\\
t_1 := -0.008333333333333333 \cdot \left(\cos re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -4.5 \cdot 10^{+61}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.00043:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 33.5:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.5 \cdot 10^{+58}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 5 Accuracy 96.8% Cost 13712
\[\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := -0.008333333333333333 \cdot \left(\cos re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -6.5 \cdot 10^{+59}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.00043:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.0058:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 6 Accuracy 97.0% Cost 13712
\[\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := -0.008333333333333333 \cdot \left(\cos re \cdot {im}^{5}\right)\\
\mathbf{if}\;im \leq -6.5 \cdot 10^{+59}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.038:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.58:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 7 Accuracy 86.9% Cost 7956
\[\begin{array}{l}
t_0 := {im}^{5} \cdot -0.008333333333333333\\
t_1 := \frac{\cos re \cdot \left(3814697265625 - im \cdot im\right)}{im + 1953125}\\
t_2 := \left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(-0.5 \cdot \left(re \cdot re\right) + 1\right)\\
\mathbf{if}\;im \leq -9.6 \cdot 10^{+158}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -0.00043:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq 33.5:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.5 \cdot 10^{+58}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;im \leq 1.34 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 8 Accuracy 86.2% Cost 7764
\[\begin{array}{l}
t_0 := {im}^{5} \cdot -0.008333333333333333\\
t_1 := \frac{\cos re \cdot \left(3814697265625 - im \cdot im\right)}{im + 1953125}\\
\mathbf{if}\;im \leq -9.6 \cdot 10^{+158}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -6.8 \cdot 10^{+53}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 33.5:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.4 \cdot 10^{+58}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im\\
\mathbf{elif}\;im \leq 1.34 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 9 Accuracy 79.9% Cost 7180
\[\begin{array}{l}
t_0 := {im}^{5} \cdot -0.008333333333333333\\
\mathbf{if}\;im \leq -6.8 \cdot 10^{+53}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 33.5:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 9 \cdot 10^{+57}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;t_0 - im\\
\end{array}
\]
Alternative 10 Accuracy 39.2% Cost 7108
\[\begin{array}{l}
\mathbf{if}\;\cos re \leq -0.01:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;-im\\
\end{array}
\]
Alternative 11 Accuracy 79.9% Cost 7052
\[\begin{array}{l}
t_0 := {im}^{5} \cdot -0.008333333333333333\\
\mathbf{if}\;im \leq -6.8 \cdot 10^{+53}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 33.5:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.5 \cdot 10^{+58}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 12 Accuracy 56.6% Cost 6921
\[\begin{array}{l}
\mathbf{if}\;im \leq -4.4 \cdot 10^{+61} \lor \neg \left(im \leq 1.15 \cdot 10^{+58}\right):\\
\;\;\;\;{im}^{5} \cdot -0.008333333333333333\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right) - im\\
\end{array}
\]
Alternative 13 Accuracy 35.1% Cost 840
\[\begin{array}{l}
t_0 := 0.5 + re \cdot \left(re \cdot -0.25\right)\\
\mathbf{if}\;im \leq -55:\\
\;\;\;\;t_0 \cdot 27\\
\mathbf{elif}\;im \leq 550:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot -3\\
\end{array}
\]
Alternative 14 Accuracy 31.9% Cost 708
\[\begin{array}{l}
\mathbf{if}\;re \leq 2.1 \cdot 10^{+159}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot -3\\
\end{array}
\]
Alternative 15 Accuracy 29.7% Cost 128
\[-im
\]