(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 (* (atan2 x.im x.re) y.im))
(t_1 (* y.im (log (hypot x.im x.re))))
(t_2 (cos (* y.re (atan2 x.im x.re)))))
(if (<= x.re -3.1e-292)
(* (exp (- (* y.re (- (log (/ -1.0 x.re)))) t_0)) t_2)
(if (<= x.re 8.2e-69)
(*
(/ (pow (hypot x.re x.im) y.re) (exp t_0))
(cos (* (cbrt t_1) (pow (cbrt (fma (atan2 x.im x.re) y.re t_1)) 2.0))))
(* t_2 (exp (- (* y.re (log x.re)) t_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 = atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = y_46_im * log(hypot(x_46_im, x_46_re));
double t_2 = cos((y_46_re * atan2(x_46_im, x_46_re)));
double tmp;
if (x_46_re <= -3.1e-292) {
tmp = exp(((y_46_re * -log((-1.0 / x_46_re))) - t_0)) * t_2;
} else if (x_46_re <= 8.2e-69) {
tmp = (pow(hypot(x_46_re, x_46_im), y_46_re) / exp(t_0)) * cos((cbrt(t_1) * pow(cbrt(fma(atan2(x_46_im, x_46_re), y_46_re, t_1)), 2.0)));
} else {
tmp = t_2 * exp(((y_46_re * log(x_46_re)) - t_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(atan(x_46_im, x_46_re) * y_46_im) t_1 = Float64(y_46_im * log(hypot(x_46_im, x_46_re))) t_2 = cos(Float64(y_46_re * atan(x_46_im, x_46_re))) tmp = 0.0 if (x_46_re <= -3.1e-292) tmp = Float64(exp(Float64(Float64(y_46_re * Float64(-log(Float64(-1.0 / x_46_re)))) - t_0)) * t_2); elseif (x_46_re <= 8.2e-69) tmp = Float64(Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / exp(t_0)) * cos(Float64(cbrt(t_1) * (cbrt(fma(atan(x_46_im, x_46_re), y_46_re, t_1)) ^ 2.0)))); else tmp = Float64(t_2 * exp(Float64(Float64(y_46_re * log(x_46_re)) - t_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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$1 = N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -3.1e-292], N[(N[Exp[N[(N[(y$46$re * (-N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[x$46$re, 8.2e-69], N[(N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[Exp[t$95$0], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[Power[t$95$1, 1/3], $MachinePrecision] * N[Power[N[Power[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re + t$95$1), $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$0), $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 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_2 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;x.re \leq -3.1 \cdot 10^{-292}:\\
\;\;\;\;e^{y.re \cdot \left(-\log \left(\frac{-1}{x.re}\right)\right) - t_0} \cdot t_2\\
\mathbf{elif}\;x.re \leq 8.2 \cdot 10^{-69}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{t_0}} \cdot \cos \left(\sqrt[3]{t_1} \cdot {\left(\sqrt[3]{\mathsf{fma}\left(\tan^{-1}_* \frac{x.im}{x.re}, y.re, t_1\right)}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot e^{y.re \cdot \log x.re - t_0}\\
\end{array}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
if x.re < -3.0999999999999999e-292Initial program 32.3
Simplified6.2
Taylor expanded in x.im around 0 6.2
Taylor expanded in y.im around 0 6.8
Taylor expanded in x.re around -inf 10.9
Simplified5.4
if -3.0999999999999999e-292 < x.re < 8.1999999999999998e-69Initial program 25.7
Simplified6.8
Taylor expanded in x.im around 0 5.8
Applied egg-rr5.8
Taylor expanded in y.re around 0 46.9
Simplified6.0
if 8.1999999999999998e-69 < x.re Initial program 39.1
Simplified13.9
Taylor expanded in x.im around 0 11.8
Taylor expanded in y.im around 0 12.4
Taylor expanded in x.re around inf 13.9
Simplified11.3
Final simplification7.4
herbie shell --seed 2022155
(FPCore (x.re x.im y.re y.im)
:name "powComplex, real part"
: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)))))