Math FPCore C Julia Wolfram TeX \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\]
↓
\[\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_2 := e^{t_1 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
t_3 := y.im \cdot \log x.im\\
\mathbf{if}\;x.im \leq 5.4 \cdot 10^{-302}:\\
\;\;\;\;t_2 \cdot \sqrt{{\cos \left(\mathsf{fma}\left(t_1, y.im, t_0\right)\right)}^{2}}\\
\mathbf{elif}\;x.im \leq 2:\\
\;\;\;\;t_2 \cdot \cos t_3\\
\mathbf{elif}\;x.im \leq 5 \cdot 10^{+65}:\\
\;\;\;\;t_2 \cdot \cos t_0\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot {\left(\sqrt[3]{\cos \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, t_3\right)\right)}\right)}^{3}\\
\end{array}
\]
(FPCore (x.re x.im y.re y.im)
:precision binary64
(*
(exp
(-
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re)
(* (atan2 x.im x.re) y.im)))
(cos
(+
(* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im)
(* (atan2 x.im x.re) y.re))))) ↓
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (log (hypot x.re x.im)))
(t_2 (exp (- (* t_1 y.re) (* (atan2 x.im x.re) y.im))))
(t_3 (* y.im (log x.im))))
(if (<= x.im 5.4e-302)
(* t_2 (sqrt (pow (cos (fma t_1 y.im t_0)) 2.0)))
(if (<= x.im 2.0)
(* t_2 (cos t_3))
(if (<= x.im 5e+65)
(* t_2 (cos t_0))
(* t_2 (pow (cbrt (cos (fma y.re (atan2 x.im x.re) t_3))) 3.0))))))) double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
↓
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = log(hypot(x_46_re, x_46_im));
double t_2 = exp(((t_1 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double t_3 = y_46_im * log(x_46_im);
double tmp;
if (x_46_im <= 5.4e-302) {
tmp = t_2 * sqrt(pow(cos(fma(t_1, y_46_im, t_0)), 2.0));
} else if (x_46_im <= 2.0) {
tmp = t_2 * cos(t_3);
} else if (x_46_im <= 5e+65) {
tmp = t_2 * cos(t_0);
} else {
tmp = t_2 * pow(cbrt(cos(fma(y_46_re, atan2(x_46_im, x_46_re), t_3))), 3.0);
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
return Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re))))
end
↓
function code(x_46_re, x_46_im, y_46_re, y_46_im)
t_0 = Float64(y_46_re * atan(x_46_im, x_46_re))
t_1 = log(hypot(x_46_re, x_46_im))
t_2 = exp(Float64(Float64(t_1 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im)))
t_3 = Float64(y_46_im * log(x_46_im))
tmp = 0.0
if (x_46_im <= 5.4e-302)
tmp = Float64(t_2 * sqrt((cos(fma(t_1, y_46_im, t_0)) ^ 2.0)));
elseif (x_46_im <= 2.0)
tmp = Float64(t_2 * cos(t_3));
elseif (x_46_im <= 5e+65)
tmp = Float64(t_2 * cos(t_0));
else
tmp = Float64(t_2 * (cbrt(cos(fma(y_46_re, atan(x_46_im, x_46_re), t_3))) ^ 3.0));
end
return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Exp[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
↓
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[(t$95$1 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(y$46$im * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, 5.4e-302], N[(t$95$2 * N[Sqrt[N[Power[N[Cos[N[(t$95$1 * y$46$im + t$95$0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 2.0], N[(t$95$2 * N[Cos[t$95$3], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 5e+65], N[(t$95$2 * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[Power[N[Power[N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]]]]]]]]
e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
↓
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_2 := e^{t_1 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
t_3 := y.im \cdot \log x.im\\
\mathbf{if}\;x.im \leq 5.4 \cdot 10^{-302}:\\
\;\;\;\;t_2 \cdot \sqrt{{\cos \left(\mathsf{fma}\left(t_1, y.im, t_0\right)\right)}^{2}}\\
\mathbf{elif}\;x.im \leq 2:\\
\;\;\;\;t_2 \cdot \cos t_3\\
\mathbf{elif}\;x.im \leq 5 \cdot 10^{+65}:\\
\;\;\;\;t_2 \cdot \cos t_0\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot {\left(\sqrt[3]{\cos \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, t_3\right)\right)}\right)}^{3}\\
\end{array}
Alternatives Alternative 1 Accuracy 81.3% Cost 65484
\[\begin{array}{l}
t_0 := e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
t_1 := y.im \cdot \log x.im\\
\mathbf{if}\;x.im \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \sqrt{{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}^{2}}\\
\mathbf{elif}\;x.im \leq 82:\\
\;\;\;\;t_0 \cdot \cos t_1\\
\mathbf{elif}\;x.im \leq 10^{+60}:\\
\;\;\;\;t_0 \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot {\left(\sqrt[3]{\cos \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, t_1\right)\right)}\right)}^{3}\\
\end{array}
\]
Alternative 2 Accuracy 81.3% Cost 58692
\[\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
t_2 := y.im \cdot \log x.im\\
\mathbf{if}\;x.im \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t_1 \cdot \sqrt{{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}^{2}}\\
\mathbf{elif}\;x.im \leq 1000:\\
\;\;\;\;t_1 \cdot \cos t_2\\
\mathbf{elif}\;x.im \leq 2.8 \cdot 10^{+63}:\\
\;\;\;\;t_1 \cdot \cos t_0\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \cos \left(t_0 + t_2\right)\\
\end{array}
\]
Alternative 3 Accuracy 81.3% Cost 46348
\[\begin{array}{l}
t_0 := y.im \cdot \log x.im\\
t_1 := e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
t_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.im \leq 6 \cdot 10^{-309}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x.im \leq 20:\\
\;\;\;\;t_1 \cdot \cos t_0\\
\mathbf{elif}\;x.im \leq 6 \cdot 10^{+61}:\\
\;\;\;\;t_1 \cdot \cos t_2\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \cos \left(t_2 + t_0\right)\\
\end{array}
\]
Alternative 4 Accuracy 81.3% Cost 39560
\[\begin{array}{l}
t_0 := e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;x.im \leq 10^{-308}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x.im \leq 2:\\
\;\;\;\;t_0 \cdot \cos \left(y.im \cdot \log x.im\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\end{array}
\]
Alternative 5 Accuracy 81.3% Cost 39496
\[\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - t_0}\\
\mathbf{if}\;x.im \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x.im \leq 1600:\\
\;\;\;\;t_1 \cdot \cos \left(y.im \cdot \log x.im\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log x.im - t_0}\\
\end{array}
\]
Alternative 6 Accuracy 81.0% Cost 32964
\[\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.im \leq 2:\\
\;\;\;\;e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - t_0}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log x.im - t_0}\\
\end{array}
\]
Alternative 7 Accuracy 75.4% Cost 26376
\[\begin{array}{l}
\mathbf{if}\;y.re \leq -3.3 \cdot 10^{-10}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{elif}\;y.re \leq 1.62 \cdot 10^{-9}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
\end{array}
\]
Alternative 8 Accuracy 81.6% Cost 26176
\[e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}
\]
Alternative 9 Accuracy 77.0% Cost 13385
\[\begin{array}{l}
\mathbf{if}\;y.re \leq -9 \cdot 10^{-10} \lor \neg \left(y.re \leq 6.8 \cdot 10^{-11}\right):\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\end{array}
\]
Alternative 10 Accuracy 52.4% Cost 13120
\[e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}
\]
Alternative 11 Accuracy 26.3% Cost 6784
\[1 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im
\]
Alternative 12 Accuracy 26.2% Cost 64
\[1
\]