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 -0.01 \lor \neg \left(t_0 \leq 0.02\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 -0.01) (not (<= t_0 0.02)))
(* 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 <= -0.01) || !(t_0 <= 0.02)) {
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 <= (-0.01d0)) .or. (.not. (t_0 <= 0.02d0))) 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 <= -0.01) || !(t_0 <= 0.02)) {
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 <= -0.01) or not (t_0 <= 0.02):
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 <= -0.01) || !(t_0 <= 0.02))
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 <= -0.01) || ~((t_0 <= 0.02)))
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, -0.01], N[Not[LessEqual[t$95$0, 0.02]], $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 -0.01 \lor \neg \left(t_0 \leq 0.02\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.9% Cost 46537
\[\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
t_1 := 0.5 \cdot \cos re\\
\mathbf{if}\;t_0 \leq -0.01 \lor \neg \left(t_0 \leq 0.02\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}
\]
Alternative 2 Accuracy 99.7% Cost 46089
\[\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -0.01 \lor \neg \left(t_0 \leq 2 \cdot 10^{-12}\right):\\
\;\;\;\;\left(0.5 \cdot \cos re\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;{im}^{3} \cdot \left(\cos re \cdot -0.16666666666666666\right) - im \cdot \cos re\\
\end{array}
\]
Alternative 3 Accuracy 99.7% Cost 45961
\[\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t_0 \leq -0.01 \lor \neg \left(t_0 \leq 2 \cdot 10^{-12}\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 4 Accuracy 95.0% Cost 13842
\[\begin{array}{l}
\mathbf{if}\;im \leq -9 \cdot 10^{+84} \lor \neg \left(im \leq -0.0069 \lor \neg \left(im \leq 0.0085\right) \land im \leq 5.6 \cdot 10^{+102}\right):\\
\;\;\;\;\cos re \cdot \left({im}^{3} \cdot -0.16666666666666666 - im\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\end{array}
\]
Alternative 5 Accuracy 87.1% Cost 13581
\[\begin{array}{l}
\mathbf{if}\;im \leq -3 \cdot 10^{+265}:\\
\;\;\;\;\left({im}^{3} \cdot -0.16666666666666666 - im\right) \cdot \left(\left(re \cdot re\right) \cdot -0.5 + 1\right)\\
\mathbf{elif}\;im \leq -0.0013 \lor \neg \left(im \leq 0.00043\right):\\
\;\;\;\;0.5 \cdot \left(e^{-im} - e^{im}\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\]
Alternative 6 Accuracy 78.1% Cost 7825
\[\begin{array}{l}
t_0 := {im}^{3} \cdot -0.16666666666666666 - im\\
t_1 := t_0 \cdot \left(\left(re \cdot re\right) \cdot -0.5 + 1\right)\\
\mathbf{if}\;im \leq -2 \cdot 10^{+266}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -1.5 \cdot 10^{+161}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -0.0014 \lor \neg \left(im \leq 0.0035\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\]
Alternative 7 Accuracy 64.1% Cost 7184
\[\begin{array}{l}
t_0 := \frac{im \cdot \left(-im\right)}{im + 0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right)}\\
t_1 := im \cdot \left(0.5 \cdot \left(re \cdot re\right) + -1\right)\\
\mathbf{if}\;im \leq -2 \cdot 10^{+273}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -1.9 \cdot 10^{+184}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -700:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 1.7 \cdot 10^{+156}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 8 Accuracy 74.3% Cost 7181
\[\begin{array}{l}
\mathbf{if}\;im \leq -2.6 \cdot 10^{+273}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right) + -1\right)\\
\mathbf{elif}\;im \leq -0.00034 \lor \neg \left(im \leq 0.0042\right):\\
\;\;\;\;{im}^{3} \cdot -0.16666666666666666 - im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(-\cos re\right)\\
\end{array}
\]
Alternative 9 Accuracy 43.7% Cost 1556
\[\begin{array}{l}
t_0 := \frac{im \cdot \left(-im\right)}{im + 0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right)}\\
t_1 := im \cdot \left(0.5 \cdot \left(re \cdot re\right) + -1\right)\\
\mathbf{if}\;im \leq -2.6 \cdot 10^{+273}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq -2.45 \cdot 10^{+184}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;im \leq -8 \cdot 10^{-13}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;im \leq 0.0085:\\
\;\;\;\;-im\\
\mathbf{elif}\;im \leq 1.7 \cdot 10^{+156}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\]
Alternative 10 Accuracy 36.9% Cost 713
\[\begin{array}{l}
\mathbf{if}\;im \leq -480 \lor \neg \left(im \leq 700\right):\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-im\\
\end{array}
\]
Alternative 11 Accuracy 35.7% Cost 708
\[\begin{array}{l}
\mathbf{if}\;re \leq -3.05 \cdot 10^{+189}:\\
\;\;\;\;-3 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.5 \cdot \left(re \cdot re\right) + -1\right)\\
\end{array}
\]
Alternative 12 Accuracy 35.7% Cost 708
\[\begin{array}{l}
\mathbf{if}\;re \leq -2.8 \cdot 10^{+193}:\\
\;\;\;\;-3 \cdot \left(0.5 + re \cdot \left(re \cdot -0.25\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot re\right) \cdot \left(im \cdot re\right) - im\\
\end{array}
\]
Alternative 13 Accuracy 29.2% Cost 128
\[-im
\]