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}\\
t_1 := 0.5 \cdot \cos re\\
\mathbf{if}\;t_0 \leq -4000 \lor \neg \left(t_0 \leq 5 \cdot 10^{-7}\right):\\
\;\;\;\;t_1 \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(im \cdot -2 + \left(-0.016666666666666666 \cdot {im}^{5} + -0.3333333333333333 \cdot {im}^{3}\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))) (t_1 (* 0.5 (cos re))))
(if (or (<= t_0 -4000.0) (not (<= t_0 5e-7)))
(* t_1 t_0)
(*
t_1
(+
(* im -2.0)
(+
(* -0.016666666666666666 (pow im 5.0))
(* -0.3333333333333333 (pow im 3.0)))))))) 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 t_1 = 0.5 * cos(re);
double tmp;
if ((t_0 <= -4000.0) || !(t_0 <= 5e-7)) {
tmp = t_1 * t_0;
} else {
tmp = t_1 * ((im * -2.0) + ((-0.016666666666666666 * pow(im, 5.0)) + (-0.3333333333333333 * pow(im, 3.0))));
}
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) :: t_1
real(8) :: tmp
t_0 = exp(-im) - exp(im)
t_1 = 0.5d0 * cos(re)
if ((t_0 <= (-4000.0d0)) .or. (.not. (t_0 <= 5d-7))) then
tmp = t_1 * t_0
else
tmp = t_1 * ((im * (-2.0d0)) + (((-0.016666666666666666d0) * (im ** 5.0d0)) + ((-0.3333333333333333d0) * (im ** 3.0d0))))
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 t_1 = 0.5 * Math.cos(re);
double tmp;
if ((t_0 <= -4000.0) || !(t_0 <= 5e-7)) {
tmp = t_1 * t_0;
} else {
tmp = t_1 * ((im * -2.0) + ((-0.016666666666666666 * Math.pow(im, 5.0)) + (-0.3333333333333333 * Math.pow(im, 3.0))));
}
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)
t_1 = 0.5 * math.cos(re)
tmp = 0
if (t_0 <= -4000.0) or not (t_0 <= 5e-7):
tmp = t_1 * t_0
else:
tmp = t_1 * ((im * -2.0) + ((-0.016666666666666666 * math.pow(im, 5.0)) + (-0.3333333333333333 * math.pow(im, 3.0))))
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))
t_1 = Float64(0.5 * cos(re))
tmp = 0.0
if ((t_0 <= -4000.0) || !(t_0 <= 5e-7))
tmp = Float64(t_1 * t_0);
else
tmp = Float64(t_1 * Float64(Float64(im * -2.0) + Float64(Float64(-0.016666666666666666 * (im ^ 5.0)) + Float64(-0.3333333333333333 * (im ^ 3.0)))));
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);
t_1 = 0.5 * cos(re);
tmp = 0.0;
if ((t_0 <= -4000.0) || ~((t_0 <= 5e-7)))
tmp = t_1 * t_0;
else
tmp = t_1 * ((im * -2.0) + ((-0.016666666666666666 * (im ^ 5.0)) + (-0.3333333333333333 * (im ^ 3.0))));
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]}, Block[{t$95$1 = N[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -4000.0], N[Not[LessEqual[t$95$0, 5e-7]], $MachinePrecision]], N[(t$95$1 * t$95$0), $MachinePrecision], N[(t$95$1 * N[(N[(im * -2.0), $MachinePrecision] + N[(N[(-0.016666666666666666 * N[Power[im, 5.0], $MachinePrecision]), $MachinePrecision] + N[(-0.3333333333333333 * N[Power[im, 3.0], $MachinePrecision]), $MachinePrecision]), $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}\\
t_1 := 0.5 \cdot \cos re\\
\mathbf{if}\;t_0 \leq -4000 \lor \neg \left(t_0 \leq 5 \cdot 10^{-7}\right):\\
\;\;\;\;t_1 \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(im \cdot -2 + \left(-0.016666666666666666 \cdot {im}^{5} + -0.3333333333333333 \cdot {im}^{3}\right)\right)\\
\end{array}
Alternatives Alternative 1 Accuracy 99.8% Cost 45961
\[\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -0.004 \lor \neg \left(t_0 \leq 5 \cdot 10^{-7}\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 2 Accuracy 96.3% Cost 13832
\[\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
t_1 := {im}^{5} \cdot \left(\cos re \cdot -0.008333333333333333\right)\\
\mathbf{if}\;im \leq -7.6 \cdot 10^{+89}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.082:\\
\;\;\;\;t_0 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{elif}\;im \leq 8.5:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 4.2 \cdot 10^{+61}:\\
\;\;\;\;0.5 \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 3 Accuracy 92.4% Cost 13712
\[\begin{array}{l}
t_0 := \frac{\cos re}{im} \cdot \left(im \cdot \left(-im\right)\right)\\
t_1 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{if}\;im \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -0.0036:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 8.5:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.55 \cdot 10^{+85}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 5.8 \cdot 10^{+102}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot \left(im \cdot -2 + -0.3333333333333333 \cdot {im}^{3}\right)\\
\mathbf{elif}\;im \leq 3.9 \cdot 10^{+151}:\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 4 Accuracy 96.9% Cost 13712
\[\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := {im}^{5} \cdot \left(\cos re \cdot -0.008333333333333333\right)\\
\mathbf{if}\;im \leq -3.3 \cdot 10^{+61}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.00081:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 8.5:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 4.2 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 5 Accuracy 97.2% Cost 13712
\[\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
t_1 := {im}^{5} \cdot \left(\cos re \cdot -0.008333333333333333\right)\\
\mathbf{if}\;im \leq -3.3 \cdot 10^{+61}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.082:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 8.5:\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{elif}\;im \leq 4.2 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 6 Accuracy 85.2% Cost 8084
\[\begin{array}{l}
t_0 := \frac{\cos re}{im} \cdot \left(im \cdot \left(-im\right)\right)\\
t_1 := {im}^{5} \cdot -0.008333333333333333 - im\\
\mathbf{if}\;im \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -9.5 \cdot 10^{+54}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 4.8 \cdot 10^{+27}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.7 \cdot 10^{+85}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 5.2 \cdot 10^{+103}:\\
\;\;\;\;\left(0.5 + re \cdot \left(re \cdot -0.25\right)\right) \cdot \left(im \cdot -2 + -0.3333333333333333 \cdot {im}^{3}\right)\\
\mathbf{elif}\;im \leq 3.9 \cdot 10^{+151}:\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 7 Accuracy 85.2% Cost 7704
\[\begin{array}{l}
t_0 := \frac{\cos re}{im} \cdot \left(im \cdot \left(-im\right)\right)\\
t_1 := {im}^{5} \cdot -0.008333333333333333 - im\\
\mathbf{if}\;im \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -9.5 \cdot 10^{+54}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 4.8 \cdot 10^{+27}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.7 \cdot 10^{+85}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 5.5 \cdot 10^{+102}:\\
\;\;\;\;im \cdot \left(0.08333333333333333 \cdot \left(\left(re \cdot re\right) \cdot \left(im \cdot im\right)\right)\right)\\
\mathbf{elif}\;im \leq 3.9 \cdot 10^{+151}:\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 8 Accuracy 76.1% Cost 7445
\[\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{if}\;im \leq -7.8 \cdot 10^{+86}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -840:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot re\right)\right) - im\\
\mathbf{elif}\;im \leq 5.2 \cdot 10^{+20}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 5.5 \cdot 10^{+102} \lor \neg \left(im \leq 1.9 \cdot 10^{+278}\right):\\
\;\;\;\;im \cdot \left(0.08333333333333333 \cdot \left(\left(re \cdot re\right) \cdot \left(im \cdot im\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 9 Accuracy 78.1% Cost 7445
\[\begin{array}{l}
t_0 := {im}^{5} \cdot -0.008333333333333333 - im\\
\mathbf{if}\;im \leq -9.5 \cdot 10^{+54}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 4.5 \cdot 10^{+27}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{elif}\;im \leq 1.7 \cdot 10^{+85}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 4.8 \cdot 10^{+102} \lor \neg \left(im \leq 1.9 \cdot 10^{+278}\right):\\
\;\;\;\;im \cdot \left(0.08333333333333333 \cdot \left(\left(re \cdot re\right) \cdot \left(im \cdot im\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\
\end{array}
\]
Alternative 10 Accuracy 60.7% Cost 6920
\[\begin{array}{l}
\mathbf{if}\;im \leq -500:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot re\right)\right) - im\\
\mathbf{elif}\;im \leq 4 \cdot 10^{+20}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.08333333333333333 \cdot \left(\left(re \cdot re\right) \cdot \left(im \cdot im\right)\right)\right)\\
\end{array}
\]
Alternative 11 Accuracy 38.7% Cost 968
\[\begin{array}{l}
\mathbf{if}\;im \leq -7.2 \cdot 10^{-24}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot re\right)\right) - im\\
\mathbf{elif}\;im \leq 4 \cdot 10^{+20}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.08333333333333333 \cdot \left(\left(re \cdot re\right) \cdot \left(im \cdot im\right)\right)\right)\\
\end{array}
\]
Alternative 12 Accuracy 38.3% Cost 841
\[\begin{array}{l}
\mathbf{if}\;im \leq -7.2 \cdot 10^{-24} \lor \neg \left(im \leq 4 \cdot 10^{+20}\right):\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot re\right)\right) - im\\
\mathbf{else}:\\
\;\;\;\;-im\\
\end{array}
\]
Alternative 13 Accuracy 38.3% Cost 840
\[\begin{array}{l}
\mathbf{if}\;im \leq -5.5 \cdot 10^{-24}:\\
\;\;\;\;0.5 \cdot \left(re \cdot \left(im \cdot re\right)\right) - im\\
\mathbf{elif}\;im \leq 4 \cdot 10^{+20}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(0.5 \cdot \left(im \cdot re\right)\right) - im\\
\end{array}
\]
Alternative 14 Accuracy 33.5% Cost 713
\[\begin{array}{l}
\mathbf{if}\;re \leq -3.2 \cdot 10^{+158} \lor \neg \left(re \leq 2.2 \cdot 10^{+219}\right):\\
\;\;\;\;-0.25 \cdot \left(\left(re \cdot re\right) \cdot -3\right)\\
\mathbf{else}:\\
\;\;\;\;-im\\
\end{array}
\]
Alternative 15 Accuracy 37.3% Cost 713
\[\begin{array}{l}
\mathbf{if}\;im \leq -660 \lor \neg \left(im \leq 4 \cdot 10^{+20}\right):\\
\;\;\;\;\left(im \cdot re\right) \cdot \left(0.5 \cdot re\right)\\
\mathbf{else}:\\
\;\;\;\;-im\\
\end{array}
\]
Alternative 16 Accuracy 37.4% Cost 713
\[\begin{array}{l}
\mathbf{if}\;im \leq -290 \lor \neg \left(im \leq 4 \cdot 10^{+20}\right):\\
\;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-im\\
\end{array}
\]
Alternative 17 Accuracy 34.6% Cost 712
\[\begin{array}{l}
\mathbf{if}\;im \leq -620:\\
\;\;\;\;-0.25 \cdot \left(\left(re \cdot re\right) \cdot 27\right)\\
\mathbf{elif}\;im \leq 4.5 \cdot 10^{+20}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;-0.25 \cdot \left(\left(re \cdot re\right) \cdot -3\right)\\
\end{array}
\]
Alternative 18 Accuracy 30.1% Cost 128
\[-im
\]
Alternative 19 Accuracy 2.8% Cost 64
\[-3
\]
Alternative 20 Accuracy 2.9% Cost 64
\[-0.015625
\]
Alternative 21 Accuracy 2.9% Cost 64
\[-3.814697265625 \cdot 10^{-6}
\]
Alternative 22 Accuracy 3.5% Cost 64
\[0
\]