\[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 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.re \leq -6.5 \cdot 10^{-102} \lor \neg \left(y.re \leq 3.7 \cdot 10^{-90}\right):\\
\;\;\;\;e^{t_0 \cdot y.re - t_1} \cdot \cos t_2\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(t_0, y.im, t_2\right)\right) \cdot \frac{1}{e^{t_1}}\\
\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 (log (hypot x.re x.im)))
(t_1 (* (atan2 x.im x.re) y.im))
(t_2 (* y.re (atan2 x.im x.re))))
(if (or (<= y.re -6.5e-102) (not (<= y.re 3.7e-90)))
(* (exp (- (* t_0 y.re) t_1)) (cos t_2))
(* (cos (fma t_0 y.im t_2)) (/ 1.0 (exp t_1))))))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 = log(hypot(x_46_re, x_46_im));
double t_1 = atan2(x_46_im, x_46_re) * y_46_im;
double t_2 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if ((y_46_re <= -6.5e-102) || !(y_46_re <= 3.7e-90)) {
tmp = exp(((t_0 * y_46_re) - t_1)) * cos(t_2);
} else {
tmp = cos(fma(t_0, y_46_im, t_2)) * (1.0 / exp(t_1));
}
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 = log(hypot(x_46_re, x_46_im))
t_1 = Float64(atan(x_46_im, x_46_re) * y_46_im)
t_2 = Float64(y_46_re * atan(x_46_im, x_46_re))
tmp = 0.0
if ((y_46_re <= -6.5e-102) || !(y_46_re <= 3.7e-90))
tmp = Float64(exp(Float64(Float64(t_0 * y_46_re) - t_1)) * cos(t_2));
else
tmp = Float64(cos(fma(t_0, y_46_im, t_2)) * Float64(1.0 / exp(t_1)));
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[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$2 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[y$46$re, -6.5e-102], N[Not[LessEqual[y$46$re, 3.7e-90]], $MachinePrecision]], N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision] * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(t$95$0 * y$46$im + t$95$2), $MachinePrecision]], $MachinePrecision] * N[(1.0 / N[Exp[t$95$1], $MachinePrecision]), $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 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.re \leq -6.5 \cdot 10^{-102} \lor \neg \left(y.re \leq 3.7 \cdot 10^{-90}\right):\\
\;\;\;\;e^{t_0 \cdot y.re - t_1} \cdot \cos t_2\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(t_0, y.im, t_2\right)\right) \cdot \frac{1}{e^{t_1}}\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 3.4 |
|---|
| Cost | 84352 |
|---|
\[\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \mathsf{log1p}\left(\sqrt[3]{{\left(\mathsf{expm1}\left(\cos \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right)}^{3}}\right)
\end{array}
\]
| Alternative 2 |
|---|
| Error | 3.4 |
|---|
| Cost | 58688 |
|---|
\[\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)
\end{array}
\]
| Alternative 3 |
|---|
| Error | 3.6 |
|---|
| Cost | 58496 |
|---|
\[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} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\right)\right)
\]
| Alternative 4 |
|---|
| Error | 3.5 |
|---|
| Cost | 39561 |
|---|
\[\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;y.re \leq -5 \cdot 10^{-105} \lor \neg \left(y.re \leq 2 \cdot 10^{-92}\right):\\
\;\;\;\;e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - t_0} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{e^{t_0}}\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 3.7 |
|---|
| Cost | 32841 |
|---|
\[\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;y.re \leq -3 \cdot 10^{-104} \lor \neg \left(y.re \leq 5 \cdot 10^{-88}\right):\\
\;\;\;\;e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{e^{t_0}}\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 7.3 |
|---|
| Cost | 26441 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y.re \leq -2.85 \cdot 10^{-5} \lor \neg \left(y.re \leq 9.2 \cdot 10^{+58}\right):\\
\;\;\;\;{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 4.1 |
|---|
| 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 8 |
|---|
| Error | 7.3 |
|---|
| Cost | 13577 |
|---|
\[\begin{array}{l}
\mathbf{if}\;y.re \leq -1.95 \cdot 10^{-5} \lor \neg \left(y.re \leq 5 \cdot 10^{+58}\right):\\
\;\;\;\;{\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\end{array}
\]
| Alternative 9 |
|---|
| Error | 21.3 |
|---|
| Cost | 13120 |
|---|
\[e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}
\]
| Alternative 10 |
|---|
| Error | 36.3 |
|---|
| Cost | 13056 |
|---|
\[e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}
\]
| Alternative 11 |
|---|
| Error | 38.5 |
|---|
| Cost | 6784 |
|---|
\[1 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im
\]
| Alternative 12 |
|---|
| Error | 38.4 |
|---|
| Cost | 64 |
|---|
\[1
\]