Math FPCore C 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 := 0.5 \cdot \cos re\\
t_1 := e^{-im} - e^{im}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{-9}\right):\\
\;\;\;\;t_0 \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;t_0 \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 (* 0.5 (cos re))) (t_1 (- (exp (- im)) (exp im))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e-9)))
(* t_0 t_1)
(*
t_0
(+
(* 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 = 0.5 * cos(re);
double t_1 = exp(-im) - exp(im);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e-9)) {
tmp = t_0 * t_1;
} else {
tmp = t_0 * ((im * -2.0) + ((-0.016666666666666666 * pow(im, 5.0)) + (-0.3333333333333333 * pow(im, 3.0))));
}
return tmp;
}
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 = 0.5 * Math.cos(re);
double t_1 = Math.exp(-im) - Math.exp(im);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e-9)) {
tmp = t_0 * t_1;
} else {
tmp = t_0 * ((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 = 0.5 * math.cos(re)
t_1 = math.exp(-im) - math.exp(im)
tmp = 0
if (t_1 <= -math.inf) or not (t_1 <= 2e-9):
tmp = t_0 * t_1
else:
tmp = t_0 * ((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(0.5 * cos(re))
t_1 = Float64(exp(Float64(-im)) - exp(im))
tmp = 0.0
if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e-9))
tmp = Float64(t_0 * t_1);
else
tmp = Float64(t_0 * 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 = 0.5 * cos(re);
t_1 = exp(-im) - exp(im);
tmp = 0.0;
if ((t_1 <= -Inf) || ~((t_1 <= 2e-9)))
tmp = t_0 * t_1;
else
tmp = t_0 * ((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[(0.5 * N[Cos[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e-9]], $MachinePrecision]], N[(t$95$0 * t$95$1), $MachinePrecision], N[(t$95$0 * 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 := 0.5 \cdot \cos re\\
t_1 := e^{-im} - e^{im}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{-9}\right):\\
\;\;\;\;t_0 \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;t_0 \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.5% Cost 46537
\[\begin{array}{l}
t_0 := 0.5 \cdot \cos re\\
t_1 := e^{-im} - e^{im}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{-9}\right):\\
\;\;\;\;t_0 \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(im \cdot -2 + \left(-0.016666666666666666 \cdot {im}^{5} + -0.3333333333333333 \cdot {im}^{3}\right)\right)\\
\end{array}
\]
Alternative 2 Accuracy 99.5% Cost 45961
\[\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq 2 \cdot 10^{-9}\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 96.8% 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 -1.16 \cdot 10^{+76}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.00075:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.0013:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 4.5 \cdot 10^{+61}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\]
Alternative 4 Accuracy 97.0% 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 -1.16 \cdot 10^{+76}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -0.092:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.0034:\\
\;\;\;\;\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 5 Accuracy 86.9% Cost 13580
\[\begin{array}{l}
t_0 := 0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{if}\;im \leq -0.00034:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 0.0106:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 2 \cdot 10^{+183}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(\left(re \cdot re\right) \cdot -0.5 + 1\right)\\
\end{array}
\]
Alternative 6 Accuracy 75.9% Cost 13516
\[\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{if}\;im \leq -2.15 \cdot 10^{+40}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 2.1 \cdot 10^{+61}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 1.65 \cdot 10^{+97}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(re \cdot \left(re \cdot 0.75\right)\right)\right)\\
\mathbf{elif}\;im \leq 1.8 \cdot 10^{+183}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(\left(re \cdot re\right) \cdot -0.5 + 1\right)\\
\end{array}
\]
Alternative 7 Accuracy 75.9% Cost 7824
\[\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{if}\;im \leq -5 \cdot 10^{+39}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 480:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 4.5 \cdot 10^{+99}:\\
\;\;\;\;\left(re \cdot re\right) \cdot -6.75\\
\mathbf{elif}\;im \leq 2 \cdot 10^{+183}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(\left(re \cdot re\right) \cdot -0.5 + 1\right)\\
\end{array}
\]
Alternative 8 Accuracy 75.8% Cost 7180
\[\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{if}\;im \leq -9.8 \cdot 10^{+39}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq 620:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{elif}\;im \leq 5.5 \cdot 10^{+100}:\\
\;\;\;\;\left(re \cdot re\right) \cdot -6.75\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 9 Accuracy 57.7% Cost 6920
\[\begin{array}{l}
\mathbf{if}\;im \leq -1.2 \cdot 10^{+70}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.75\\
\mathbf{elif}\;im \leq 2.2 \cdot 10^{+71}:\\
\;\;\;\;\cos re \cdot \left(-im\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(im \cdot re\right) - im\\
\end{array}
\]
Alternative 10 Accuracy 35.0% Cost 972
\[\begin{array}{l}
\mathbf{if}\;im \leq -9.5 \cdot 10^{+69}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.75\\
\mathbf{elif}\;im \leq 520:\\
\;\;\;\;-im\\
\mathbf{elif}\;im \leq 4.2 \cdot 10^{+180}:\\
\;\;\;\;\left(re \cdot re\right) \cdot -6.75\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(\left(im \cdot -2\right) \cdot -0.25\right)\\
\end{array}
\]
Alternative 11 Accuracy 35.0% Cost 844
\[\begin{array}{l}
\mathbf{if}\;im \leq -9.5 \cdot 10^{+69}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.75\\
\mathbf{elif}\;im \leq 780:\\
\;\;\;\;-im\\
\mathbf{elif}\;im \leq 1.8 \cdot 10^{+186}:\\
\;\;\;\;\left(re \cdot re\right) \cdot -6.75\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot \left(im \cdot 0.5\right)\right)\\
\end{array}
\]
Alternative 12 Accuracy 35.8% Cost 840
\[\begin{array}{l}
\mathbf{if}\;im \leq -1.32 \cdot 10^{+70}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.75\\
\mathbf{elif}\;im \leq 2.15 \cdot 10^{+61}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(im \cdot re\right) - im\\
\end{array}
\]
Alternative 13 Accuracy 35.3% Cost 712
\[\begin{array}{l}
\mathbf{if}\;im \leq -9.5 \cdot 10^{+69}:\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.75\\
\mathbf{elif}\;im \leq 2.1 \cdot 10^{+61}:\\
\;\;\;\;-im\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot \left(im \cdot 0.5\right)\right)\\
\end{array}
\]
Alternative 14 Accuracy 34.0% Cost 585
\[\begin{array}{l}
\mathbf{if}\;im \leq -2.5 \cdot 10^{+70} \lor \neg \left(im \leq 6 \cdot 10^{+66}\right):\\
\;\;\;\;\left(re \cdot re\right) \cdot 0.75\\
\mathbf{else}:\\
\;\;\;\;-im\\
\end{array}
\]
Alternative 15 Accuracy 29.7% Cost 128
\[-im
\]
Alternative 16 Accuracy 2.9% Cost 64
\[-3
\]
Alternative 17 Accuracy 2.9% Cost 64
\[-0.015625
\]
Alternative 18 Accuracy 2.9% Cost 64
\[-3.814697265625 \cdot 10^{-6}
\]
Alternative 19 Accuracy 3.5% Cost 64
\[0
\]