
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im)))
(t_1 (exp (fma t_0 y.re (* y.im (- (atan2 x.im x.re))))))
(t_2 (cos (* y.im (log (hypot x.im x.re))))))
(if (<= y.im -5e-178)
(* (fabs t_2) t_1)
(if (<= y.im 1e-55)
(*
(/
(pow (hypot x.re x.im) y.re)
(log1p (expm1 (pow (exp (atan2 x.im x.re)) y.im))))
(cos (fma t_0 y.im (* y.re (atan2 x.im x.re)))))
(* (fabs (log1p (expm1 t_2))) t_1)))))
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 = exp(fma(t_0, y_46_re, (y_46_im * -atan2(x_46_im, x_46_re))));
double t_2 = cos((y_46_im * log(hypot(x_46_im, x_46_re))));
double tmp;
if (y_46_im <= -5e-178) {
tmp = fabs(t_2) * t_1;
} else if (y_46_im <= 1e-55) {
tmp = (pow(hypot(x_46_re, x_46_im), y_46_re) / log1p(expm1(pow(exp(atan2(x_46_im, x_46_re)), y_46_im)))) * cos(fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re))));
} else {
tmp = fabs(log1p(expm1(t_2))) * t_1;
}
return tmp;
}
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 = exp(fma(t_0, y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))) t_2 = cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) tmp = 0.0 if (y_46_im <= -5e-178) tmp = Float64(abs(t_2) * t_1); elseif (y_46_im <= 1e-55) tmp = Float64(Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / log1p(expm1((exp(atan(x_46_im, x_46_re)) ^ y_46_im)))) * cos(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re))))); else tmp = Float64(abs(log1p(expm1(t_2))) * t_1); end return tmp end
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[Exp[N[(t$95$0 * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$im, -5e-178], N[(N[Abs[t$95$2], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[y$46$im, 1e-55], N[(N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[Log[1 + N[(Exp[N[Power[N[Exp[N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision], y$46$im], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(t$95$0 * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[Log[1 + N[(Exp[t$95$2] - 1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := e^{\mathsf{fma}\left(t\_0, y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\\
t_2 := \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{if}\;y.im \leq -5 \cdot 10^{-178}:\\
\;\;\;\;\left|t\_2\right| \cdot t\_1\\
\mathbf{elif}\;y.im \leq 10^{-55}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\mathsf{log1p}\left(\mathsf{expm1}\left({\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}\right)\right)} \cdot \cos \left(\mathsf{fma}\left(t\_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{log1p}\left(\mathsf{expm1}\left(t\_2\right)\right)\right| \cdot t\_1\\
\end{array}
\end{array}
if y.im < -4.99999999999999976e-178Initial program 37.0%
cancel-sign-sub-inv37.0%
fma-define37.0%
hypot-define37.0%
distribute-lft-neg-in37.0%
distribute-rgt-neg-out37.0%
fma-define37.0%
hypot-define71.5%
*-commutative71.5%
Simplified71.5%
Taylor expanded in y.im around inf 42.7%
unpow242.7%
unpow242.7%
hypot-undefine76.3%
Simplified76.3%
add-sqr-sqrt52.6%
sqrt-unprod80.5%
pow280.5%
Applied egg-rr80.5%
unpow280.5%
rem-sqrt-square80.5%
Simplified80.5%
if -4.99999999999999976e-178 < y.im < 9.99999999999999995e-56Initial program 48.1%
exp-diff48.1%
exp-to-pow48.1%
hypot-define48.1%
*-commutative48.1%
exp-prod48.1%
fma-define48.1%
hypot-define97.5%
*-commutative97.5%
Simplified97.5%
add-sqr-sqrt66.7%
sqrt-unprod97.5%
sqr-neg97.5%
sqrt-unprod33.3%
add-sqr-sqrt97.5%
exp-prod97.5%
*-commutative97.5%
exp-prod97.5%
add-sqr-sqrt49.4%
sqrt-unprod97.5%
sqr-neg97.5%
sqrt-unprod76.5%
add-sqr-sqrt97.5%
log1p-expm1-u97.5%
Applied egg-rr97.5%
if 9.99999999999999995e-56 < y.im Initial program 32.9%
cancel-sign-sub-inv32.9%
fma-define32.9%
hypot-define32.9%
distribute-lft-neg-in32.9%
distribute-rgt-neg-out32.9%
fma-define32.9%
hypot-define70.3%
*-commutative70.3%
Simplified70.3%
Taylor expanded in y.im around inf 37.2%
unpow237.2%
unpow237.2%
hypot-undefine76.0%
Simplified76.0%
add-sqr-sqrt33.1%
sqrt-unprod79.4%
pow279.4%
Applied egg-rr79.4%
unpow279.4%
rem-sqrt-square79.4%
Simplified79.4%
log1p-expm1-u79.4%
Applied egg-rr79.4%
Final simplification85.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im)))
(t_1 (exp (fma t_0 y.re (* y.im (- (atan2 x.im x.re))))))
(t_2 (cos (* y.im (log (hypot x.im x.re))))))
(if (<= y.im -7e-180)
(* (fabs t_2) t_1)
(if (<= y.im 2e-29)
(*
(cos (fma t_0 y.im (* y.re (atan2 x.im x.re))))
(/ (pow (hypot x.re x.im) y.re) (pow (exp y.im) (atan2 x.im x.re))))
(* (fabs (log1p (expm1 t_2))) t_1)))))
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 = exp(fma(t_0, y_46_re, (y_46_im * -atan2(x_46_im, x_46_re))));
double t_2 = cos((y_46_im * log(hypot(x_46_im, x_46_re))));
double tmp;
if (y_46_im <= -7e-180) {
tmp = fabs(t_2) * t_1;
} else if (y_46_im <= 2e-29) {
tmp = cos(fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re)))) * (pow(hypot(x_46_re, x_46_im), y_46_re) / pow(exp(y_46_im), atan2(x_46_im, x_46_re)));
} else {
tmp = fabs(log1p(expm1(t_2))) * t_1;
}
return tmp;
}
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 = exp(fma(t_0, y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))) t_2 = cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) tmp = 0.0 if (y_46_im <= -7e-180) tmp = Float64(abs(t_2) * t_1); elseif (y_46_im <= 2e-29) tmp = Float64(cos(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re)))) * Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan(x_46_im, x_46_re)))); else tmp = Float64(abs(log1p(expm1(t_2))) * t_1); end return tmp end
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[Exp[N[(t$95$0 * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$im, -7e-180], N[(N[Abs[t$95$2], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[y$46$im, 2e-29], N[(N[Cos[N[(t$95$0 * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[Log[1 + N[(Exp[t$95$2] - 1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := e^{\mathsf{fma}\left(t\_0, y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\\
t_2 := \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{if}\;y.im \leq -7 \cdot 10^{-180}:\\
\;\;\;\;\left|t\_2\right| \cdot t\_1\\
\mathbf{elif}\;y.im \leq 2 \cdot 10^{-29}:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(t\_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}\\
\mathbf{else}:\\
\;\;\;\;\left|\mathsf{log1p}\left(\mathsf{expm1}\left(t\_2\right)\right)\right| \cdot t\_1\\
\end{array}
\end{array}
if y.im < -7.0000000000000001e-180Initial program 37.0%
cancel-sign-sub-inv37.0%
fma-define37.0%
hypot-define37.0%
distribute-lft-neg-in37.0%
distribute-rgt-neg-out37.0%
fma-define37.0%
hypot-define71.5%
*-commutative71.5%
Simplified71.5%
Taylor expanded in y.im around inf 42.7%
unpow242.7%
unpow242.7%
hypot-undefine76.3%
Simplified76.3%
add-sqr-sqrt52.6%
sqrt-unprod80.5%
pow280.5%
Applied egg-rr80.5%
unpow280.5%
rem-sqrt-square80.5%
Simplified80.5%
if -7.0000000000000001e-180 < y.im < 1.99999999999999989e-29Initial program 47.1%
exp-diff47.1%
exp-to-pow47.1%
hypot-define47.1%
*-commutative47.1%
exp-prod47.1%
fma-define47.1%
hypot-define96.5%
*-commutative96.5%
Simplified96.5%
if 1.99999999999999989e-29 < y.im Initial program 33.4%
cancel-sign-sub-inv33.4%
fma-define33.4%
hypot-define33.4%
distribute-lft-neg-in33.4%
distribute-rgt-neg-out33.4%
fma-define33.4%
hypot-define70.0%
*-commutative70.0%
Simplified70.0%
Taylor expanded in y.im around inf 37.9%
unpow237.9%
unpow237.9%
hypot-undefine76.1%
Simplified76.1%
add-sqr-sqrt30.5%
sqrt-unprod79.7%
pow279.7%
Applied egg-rr79.7%
unpow279.7%
rem-sqrt-square79.7%
Simplified79.7%
log1p-expm1-u79.7%
Applied egg-rr79.7%
Final simplification85.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im))))
(if (or (<= y.im -1.35e-179) (not (<= y.im 2e-29)))
(*
(fabs (cos (* y.im (log (hypot x.im x.re)))))
(exp (fma t_0 y.re (* y.im (- (atan2 x.im x.re))))))
(*
(cos (fma t_0 y.im (* y.re (atan2 x.im x.re))))
(/ (pow (hypot x.re x.im) y.re) (pow (exp y.im) (atan2 x.im x.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 tmp;
if ((y_46_im <= -1.35e-179) || !(y_46_im <= 2e-29)) {
tmp = fabs(cos((y_46_im * log(hypot(x_46_im, x_46_re))))) * exp(fma(t_0, y_46_re, (y_46_im * -atan2(x_46_im, x_46_re))));
} else {
tmp = cos(fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re)))) * (pow(hypot(x_46_re, x_46_im), y_46_re) / pow(exp(y_46_im), atan2(x_46_im, x_46_re)));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) tmp = 0.0 if ((y_46_im <= -1.35e-179) || !(y_46_im <= 2e-29)) tmp = Float64(abs(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re))))) * exp(fma(t_0, y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re)))))); else tmp = Float64(cos(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re)))) * Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan(x_46_im, x_46_re)))); end return tmp end
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]}, If[Or[LessEqual[y$46$im, -1.35e-179], N[Not[LessEqual[y$46$im, 2e-29]], $MachinePrecision]], N[(N[Abs[N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Exp[N[(t$95$0 * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(t$95$0 * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
\mathbf{if}\;y.im \leq -1.35 \cdot 10^{-179} \lor \neg \left(y.im \leq 2 \cdot 10^{-29}\right):\\
\;\;\;\;\left|\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\right| \cdot e^{\mathsf{fma}\left(t\_0, y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(t\_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}\\
\end{array}
\end{array}
if y.im < -1.34999999999999994e-179 or 1.99999999999999989e-29 < y.im Initial program 35.6%
cancel-sign-sub-inv35.6%
fma-define35.6%
hypot-define35.6%
distribute-lft-neg-in35.6%
distribute-rgt-neg-out35.6%
fma-define35.6%
hypot-define70.9%
*-commutative70.9%
Simplified70.9%
Taylor expanded in y.im around inf 40.9%
unpow240.9%
unpow240.9%
hypot-undefine76.2%
Simplified76.2%
add-sqr-sqrt44.1%
sqrt-unprod80.2%
pow280.2%
Applied egg-rr80.2%
unpow280.2%
rem-sqrt-square80.2%
Simplified80.2%
if -1.34999999999999994e-179 < y.im < 1.99999999999999989e-29Initial program 47.1%
exp-diff47.1%
exp-to-pow47.1%
hypot-define47.1%
*-commutative47.1%
exp-prod47.1%
fma-define47.1%
hypot-define96.5%
*-commutative96.5%
Simplified96.5%
Final simplification85.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (log (hypot x.im x.re)))))
(if (or (<= y.im -1e-179) (not (<= y.im 2e-29)))
(*
(fabs (cos t_0))
(exp (fma (log (hypot x.re x.im)) y.re (* y.im (- (atan2 x.im x.re))))))
(*
(/ (pow (hypot x.re x.im) y.re) (pow (exp y.im) (atan2 x.im x.re)))
(cos (* y.re (+ (atan2 x.im x.re) (/ t_0 y.re))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * log(hypot(x_46_im, x_46_re));
double tmp;
if ((y_46_im <= -1e-179) || !(y_46_im <= 2e-29)) {
tmp = fabs(cos(t_0)) * exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (y_46_im * -atan2(x_46_im, x_46_re))));
} else {
tmp = (pow(hypot(x_46_re, x_46_im), y_46_re) / pow(exp(y_46_im), atan2(x_46_im, x_46_re))) * cos((y_46_re * (atan2(x_46_im, x_46_re) + (t_0 / y_46_re))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_im * log(hypot(x_46_im, x_46_re))) tmp = 0.0 if ((y_46_im <= -1e-179) || !(y_46_im <= 2e-29)) tmp = Float64(abs(cos(t_0)) * exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re)))))); else tmp = Float64(Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan(x_46_im, x_46_re))) * cos(Float64(y_46_re * Float64(atan(x_46_im, x_46_re) + Float64(t_0 / y_46_re))))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[y$46$im, -1e-179], N[Not[LessEqual[y$46$im, 2e-29]], $MachinePrecision]], N[(N[Abs[N[Cos[t$95$0], $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(y$46$re * N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(t$95$0 / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
\mathbf{if}\;y.im \leq -1 \cdot 10^{-179} \lor \neg \left(y.im \leq 2 \cdot 10^{-29}\right):\\
\;\;\;\;\left|\cos t\_0\right| \cdot e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(y.re \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} + \frac{t\_0}{y.re}\right)\right)\\
\end{array}
\end{array}
if y.im < -1e-179 or 1.99999999999999989e-29 < y.im Initial program 35.6%
cancel-sign-sub-inv35.6%
fma-define35.6%
hypot-define35.6%
distribute-lft-neg-in35.6%
distribute-rgt-neg-out35.6%
fma-define35.6%
hypot-define70.9%
*-commutative70.9%
Simplified70.9%
Taylor expanded in y.im around inf 40.9%
unpow240.9%
unpow240.9%
hypot-undefine76.2%
Simplified76.2%
add-sqr-sqrt44.1%
sqrt-unprod80.2%
pow280.2%
Applied egg-rr80.2%
unpow280.2%
rem-sqrt-square80.2%
Simplified80.2%
if -1e-179 < y.im < 1.99999999999999989e-29Initial program 47.1%
exp-diff47.1%
exp-to-pow47.1%
hypot-define47.1%
*-commutative47.1%
exp-prod47.1%
fma-define47.1%
hypot-define96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in y.re around inf 47.1%
+-commutative47.1%
unpow247.1%
unpow247.1%
hypot-undefine96.5%
Simplified96.5%
Final simplification85.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im))))
(if (or (<= y.im -5e-178) (not (<= y.im 2e-29)))
(*
(fabs (cos (* y.im (log (hypot x.im x.re)))))
(exp (fma t_0 y.re (* y.im (- (atan2 x.im x.re))))))
(*
(cos (fma t_0 y.im (* y.re (atan2 x.im x.re))))
(/ (pow (hypot x.re x.im) y.re) (+ 1.0 (* y.im (atan2 x.im x.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 tmp;
if ((y_46_im <= -5e-178) || !(y_46_im <= 2e-29)) {
tmp = fabs(cos((y_46_im * log(hypot(x_46_im, x_46_re))))) * exp(fma(t_0, y_46_re, (y_46_im * -atan2(x_46_im, x_46_re))));
} else {
tmp = cos(fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re)))) * (pow(hypot(x_46_re, x_46_im), y_46_re) / (1.0 + (y_46_im * atan2(x_46_im, x_46_re))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) tmp = 0.0 if ((y_46_im <= -5e-178) || !(y_46_im <= 2e-29)) tmp = Float64(abs(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re))))) * exp(fma(t_0, y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re)))))); else tmp = Float64(cos(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re)))) * Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / Float64(1.0 + Float64(y_46_im * atan(x_46_im, x_46_re))))); end return tmp end
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]}, If[Or[LessEqual[y$46$im, -5e-178], N[Not[LessEqual[y$46$im, 2e-29]], $MachinePrecision]], N[(N[Abs[N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[Exp[N[(t$95$0 * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(t$95$0 * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[(1.0 + N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
\mathbf{if}\;y.im \leq -5 \cdot 10^{-178} \lor \neg \left(y.im \leq 2 \cdot 10^{-29}\right):\\
\;\;\;\;\left|\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\right| \cdot e^{\mathsf{fma}\left(t\_0, y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(t\_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{1 + y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\end{array}
\end{array}
if y.im < -4.99999999999999976e-178 or 1.99999999999999989e-29 < y.im Initial program 35.6%
cancel-sign-sub-inv35.6%
fma-define35.6%
hypot-define35.6%
distribute-lft-neg-in35.6%
distribute-rgt-neg-out35.6%
fma-define35.6%
hypot-define70.9%
*-commutative70.9%
Simplified70.9%
Taylor expanded in y.im around inf 40.9%
unpow240.9%
unpow240.9%
hypot-undefine76.2%
Simplified76.2%
add-sqr-sqrt44.1%
sqrt-unprod80.2%
pow280.2%
Applied egg-rr80.2%
unpow280.2%
rem-sqrt-square80.2%
Simplified80.2%
if -4.99999999999999976e-178 < y.im < 1.99999999999999989e-29Initial program 47.1%
exp-diff47.1%
exp-to-pow47.1%
hypot-define47.1%
*-commutative47.1%
exp-prod47.1%
fma-define47.1%
hypot-define96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in y.im around 0 96.5%
Final simplification85.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im))))
(if (or (<= y.im -2.2e-179) (not (<= y.im 2e-29)))
(exp (fma t_0 y.re (* y.im (- (atan2 x.im x.re)))))
(*
(cos (fma t_0 y.im (* y.re (atan2 x.im x.re))))
(/ (pow (hypot x.re x.im) y.re) (+ 1.0 (* y.im (atan2 x.im x.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 tmp;
if ((y_46_im <= -2.2e-179) || !(y_46_im <= 2e-29)) {
tmp = exp(fma(t_0, y_46_re, (y_46_im * -atan2(x_46_im, x_46_re))));
} else {
tmp = cos(fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re)))) * (pow(hypot(x_46_re, x_46_im), y_46_re) / (1.0 + (y_46_im * atan2(x_46_im, x_46_re))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) tmp = 0.0 if ((y_46_im <= -2.2e-179) || !(y_46_im <= 2e-29)) tmp = exp(fma(t_0, y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))); else tmp = Float64(cos(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re)))) * Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / Float64(1.0 + Float64(y_46_im * atan(x_46_im, x_46_re))))); end return tmp end
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]}, If[Or[LessEqual[y$46$im, -2.2e-179], N[Not[LessEqual[y$46$im, 2e-29]], $MachinePrecision]], N[Exp[N[(t$95$0 * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[N[(t$95$0 * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[(1.0 + N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
\mathbf{if}\;y.im \leq -2.2 \cdot 10^{-179} \lor \neg \left(y.im \leq 2 \cdot 10^{-29}\right):\\
\;\;\;\;e^{\mathsf{fma}\left(t\_0, y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(t\_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{1 + y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\end{array}
\end{array}
if y.im < -2.20000000000000005e-179 or 1.99999999999999989e-29 < y.im Initial program 35.6%
cancel-sign-sub-inv35.6%
fma-define35.6%
hypot-define35.6%
distribute-lft-neg-in35.6%
distribute-rgt-neg-out35.6%
fma-define35.6%
hypot-define70.9%
*-commutative70.9%
Simplified70.9%
Taylor expanded in y.im around inf 40.9%
unpow240.9%
unpow240.9%
hypot-undefine76.2%
Simplified76.2%
Taylor expanded in y.im around 0 79.2%
if -2.20000000000000005e-179 < y.im < 1.99999999999999989e-29Initial program 47.1%
exp-diff47.1%
exp-to-pow47.1%
hypot-define47.1%
*-commutative47.1%
exp-prod47.1%
fma-define47.1%
hypot-define96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in y.im around 0 96.5%
Final simplification84.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im))))
(if (or (<= y.im -5e-178) (not (<= y.im 5e-26)))
(exp (fma t_0 y.re (* y.im (- (atan2 x.im x.re)))))
(*
(pow (hypot x.re x.im) y.re)
(cos (fma t_0 y.im (* y.re (atan2 x.im x.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 tmp;
if ((y_46_im <= -5e-178) || !(y_46_im <= 5e-26)) {
tmp = exp(fma(t_0, y_46_re, (y_46_im * -atan2(x_46_im, x_46_re))));
} else {
tmp = pow(hypot(x_46_re, x_46_im), y_46_re) * cos(fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) tmp = 0.0 if ((y_46_im <= -5e-178) || !(y_46_im <= 5e-26)) tmp = exp(fma(t_0, y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))); else tmp = Float64((hypot(x_46_re, x_46_im) ^ y_46_re) * cos(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re))))); end return tmp end
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]}, If[Or[LessEqual[y$46$im, -5e-178], N[Not[LessEqual[y$46$im, 5e-26]], $MachinePrecision]], N[Exp[N[(t$95$0 * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[Cos[N[(t$95$0 * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
\mathbf{if}\;y.im \leq -5 \cdot 10^{-178} \lor \neg \left(y.im \leq 5 \cdot 10^{-26}\right):\\
\;\;\;\;e^{\mathsf{fma}\left(t\_0, y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \cos \left(\mathsf{fma}\left(t\_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\\
\end{array}
\end{array}
if y.im < -4.99999999999999976e-178 or 5.00000000000000019e-26 < y.im Initial program 35.6%
cancel-sign-sub-inv35.6%
fma-define35.6%
hypot-define35.6%
distribute-lft-neg-in35.6%
distribute-rgt-neg-out35.6%
fma-define35.6%
hypot-define70.9%
*-commutative70.9%
Simplified70.9%
Taylor expanded in y.im around inf 40.9%
unpow240.9%
unpow240.9%
hypot-undefine76.2%
Simplified76.2%
Taylor expanded in y.im around 0 79.2%
if -4.99999999999999976e-178 < y.im < 5.00000000000000019e-26Initial program 47.1%
exp-diff47.1%
exp-to-pow47.1%
hypot-define47.1%
*-commutative47.1%
exp-prod47.1%
fma-define47.1%
hypot-define96.5%
*-commutative96.5%
Simplified96.5%
Taylor expanded in y.im around 0 96.5%
Final simplification84.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (exp (fma (log (hypot x.re x.im)) y.re (* y.im (- (atan2 x.im x.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (y_46_im * -atan2(x_46_im, x_46_re))));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)}
\end{array}
Initial program 39.4%
cancel-sign-sub-inv39.4%
fma-define39.4%
hypot-define39.4%
distribute-lft-neg-in39.4%
distribute-rgt-neg-out39.4%
fma-define39.4%
hypot-define79.4%
*-commutative79.4%
Simplified79.4%
Taylor expanded in y.im around inf 41.0%
unpow241.0%
unpow241.0%
hypot-undefine79.5%
Simplified79.5%
Taylor expanded in y.im around 0 81.5%
Final simplification81.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -3.5e-8)
(/ (pow (hypot x.re x.im) y.re) (+ 1.0 (* y.im (atan2 x.im x.re))))
(if (<= y.re 7.8e+33)
(exp (* y.im (- (atan2 x.im x.re))))
(pow (sqrt (+ (pow x.im 2.0) (pow x.re 2.0))) y.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -3.5e-8) {
tmp = pow(hypot(x_46_re, x_46_im), y_46_re) / (1.0 + (y_46_im * atan2(x_46_im, x_46_re)));
} else if (y_46_re <= 7.8e+33) {
tmp = exp((y_46_im * -atan2(x_46_im, x_46_re)));
} else {
tmp = pow(sqrt((pow(x_46_im, 2.0) + pow(x_46_re, 2.0))), y_46_re);
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -3.5e-8) {
tmp = Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re) / (1.0 + (y_46_im * Math.atan2(x_46_im, x_46_re)));
} else if (y_46_re <= 7.8e+33) {
tmp = Math.exp((y_46_im * -Math.atan2(x_46_im, x_46_re)));
} else {
tmp = Math.pow(Math.sqrt((Math.pow(x_46_im, 2.0) + Math.pow(x_46_re, 2.0))), y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -3.5e-8: tmp = math.pow(math.hypot(x_46_re, x_46_im), y_46_re) / (1.0 + (y_46_im * math.atan2(x_46_im, x_46_re))) elif y_46_re <= 7.8e+33: tmp = math.exp((y_46_im * -math.atan2(x_46_im, x_46_re))) else: tmp = math.pow(math.sqrt((math.pow(x_46_im, 2.0) + math.pow(x_46_re, 2.0))), y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -3.5e-8) tmp = Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / Float64(1.0 + Float64(y_46_im * atan(x_46_im, x_46_re)))); elseif (y_46_re <= 7.8e+33) tmp = exp(Float64(y_46_im * Float64(-atan(x_46_im, x_46_re)))); else tmp = sqrt(Float64((x_46_im ^ 2.0) + (x_46_re ^ 2.0))) ^ y_46_re; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -3.5e-8) tmp = (hypot(x_46_re, x_46_im) ^ y_46_re) / (1.0 + (y_46_im * atan2(x_46_im, x_46_re))); elseif (y_46_re <= 7.8e+33) tmp = exp((y_46_im * -atan2(x_46_im, x_46_re))); else tmp = sqrt(((x_46_im ^ 2.0) + (x_46_re ^ 2.0))) ^ y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -3.5e-8], N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[(1.0 + N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 7.8e+33], N[Exp[N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]], $MachinePrecision], N[Power[N[Sqrt[N[(N[Power[x$46$im, 2.0], $MachinePrecision] + N[Power[x$46$re, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -3.5 \cdot 10^{-8}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{1 + y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{elif}\;y.re \leq 7.8 \cdot 10^{+33}:\\
\;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re}\\
\end{array}
\end{array}
if y.re < -3.50000000000000024e-8Initial program 40.4%
exp-diff31.6%
exp-to-pow31.6%
hypot-define31.6%
*-commutative31.6%
exp-prod31.6%
fma-define31.6%
hypot-define71.9%
*-commutative71.9%
Simplified71.9%
Taylor expanded in y.im around inf 33.3%
unpow245.6%
unpow245.6%
hypot-undefine82.6%
Simplified66.9%
Taylor expanded in y.im around 0 74.0%
Taylor expanded in y.im around 0 74.0%
if -3.50000000000000024e-8 < y.re < 7.8000000000000004e33Initial program 35.5%
cancel-sign-sub-inv35.5%
fma-define35.5%
hypot-define35.5%
distribute-lft-neg-in35.5%
distribute-rgt-neg-out35.5%
fma-define35.5%
hypot-define82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in y.im around inf 35.5%
unpow235.5%
unpow235.5%
hypot-undefine81.6%
Simplified81.6%
Taylor expanded in y.im around 0 81.7%
Taylor expanded in y.re around 0 79.2%
mul-1-neg79.2%
Simplified79.2%
if 7.8000000000000004e33 < y.re Initial program 45.7%
exp-diff35.7%
exp-to-pow35.7%
hypot-define35.7%
*-commutative35.7%
exp-prod34.3%
fma-define34.3%
hypot-define55.7%
*-commutative55.7%
Simplified55.7%
Taylor expanded in y.im around inf 35.7%
unpow247.1%
unpow247.1%
hypot-undefine72.9%
Simplified58.6%
Taylor expanded in y.im around 0 77.3%
Final simplification77.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -4.5e-8)
(/ (pow (hypot x.re x.im) y.re) (+ 1.0 (* y.im (atan2 x.im x.re))))
(if (<= y.re 8e+33)
(exp (* y.im (- (atan2 x.im x.re))))
(pow (hypot x.im x.re) y.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -4.5e-8) {
tmp = pow(hypot(x_46_re, x_46_im), y_46_re) / (1.0 + (y_46_im * atan2(x_46_im, x_46_re)));
} else if (y_46_re <= 8e+33) {
tmp = exp((y_46_im * -atan2(x_46_im, x_46_re)));
} else {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -4.5e-8) {
tmp = Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re) / (1.0 + (y_46_im * Math.atan2(x_46_im, x_46_re)));
} else if (y_46_re <= 8e+33) {
tmp = Math.exp((y_46_im * -Math.atan2(x_46_im, x_46_re)));
} else {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -4.5e-8: tmp = math.pow(math.hypot(x_46_re, x_46_im), y_46_re) / (1.0 + (y_46_im * math.atan2(x_46_im, x_46_re))) elif y_46_re <= 8e+33: tmp = math.exp((y_46_im * -math.atan2(x_46_im, x_46_re))) else: tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -4.5e-8) tmp = Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / Float64(1.0 + Float64(y_46_im * atan(x_46_im, x_46_re)))); elseif (y_46_re <= 8e+33) tmp = exp(Float64(y_46_im * Float64(-atan(x_46_im, x_46_re)))); else tmp = hypot(x_46_im, x_46_re) ^ y_46_re; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -4.5e-8) tmp = (hypot(x_46_re, x_46_im) ^ y_46_re) / (1.0 + (y_46_im * atan2(x_46_im, x_46_re))); elseif (y_46_re <= 8e+33) tmp = exp((y_46_im * -atan2(x_46_im, x_46_re))); else tmp = hypot(x_46_im, x_46_re) ^ y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -4.5e-8], N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[(1.0 + N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 8e+33], N[Exp[N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]], $MachinePrecision], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -4.5 \cdot 10^{-8}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{1 + y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{elif}\;y.re \leq 8 \cdot 10^{+33}:\\
\;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.re < -4.49999999999999993e-8Initial program 40.4%
exp-diff31.6%
exp-to-pow31.6%
hypot-define31.6%
*-commutative31.6%
exp-prod31.6%
fma-define31.6%
hypot-define71.9%
*-commutative71.9%
Simplified71.9%
Taylor expanded in y.im around inf 33.3%
unpow245.6%
unpow245.6%
hypot-undefine82.6%
Simplified66.9%
Taylor expanded in y.im around 0 74.0%
Taylor expanded in y.im around 0 74.0%
if -4.49999999999999993e-8 < y.re < 7.9999999999999996e33Initial program 35.5%
cancel-sign-sub-inv35.5%
fma-define35.5%
hypot-define35.5%
distribute-lft-neg-in35.5%
distribute-rgt-neg-out35.5%
fma-define35.5%
hypot-define82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in y.im around inf 35.5%
unpow235.5%
unpow235.5%
hypot-undefine81.6%
Simplified81.6%
Taylor expanded in y.im around 0 81.7%
Taylor expanded in y.re around 0 79.2%
mul-1-neg79.2%
Simplified79.2%
if 7.9999999999999996e33 < y.re Initial program 45.7%
exp-diff35.7%
exp-to-pow35.7%
hypot-define35.7%
*-commutative35.7%
exp-prod34.3%
fma-define34.3%
hypot-define55.7%
*-commutative55.7%
Simplified55.7%
Taylor expanded in y.im around inf 35.7%
unpow247.1%
unpow247.1%
hypot-undefine72.9%
Simplified58.6%
Taylor expanded in y.im around 0 77.3%
unpow277.3%
unpow277.3%
hypot-undefine77.3%
Simplified77.3%
Final simplification77.5%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -5.3e-8) (not (<= y.re 7.8e+33))) (pow (hypot x.im x.re) y.re) (exp (* y.im (- (atan2 x.im x.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_re <= -5.3e-8) || !(y_46_re <= 7.8e+33)) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = exp((y_46_im * -atan2(x_46_im, x_46_re)));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_re <= -5.3e-8) || !(y_46_re <= 7.8e+33)) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = Math.exp((y_46_im * -Math.atan2(x_46_im, x_46_re)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_re <= -5.3e-8) or not (y_46_re <= 7.8e+33): tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = math.exp((y_46_im * -math.atan2(x_46_im, x_46_re))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_re <= -5.3e-8) || !(y_46_re <= 7.8e+33)) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = exp(Float64(y_46_im * Float64(-atan(x_46_im, x_46_re)))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_re <= -5.3e-8) || ~((y_46_re <= 7.8e+33))) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = exp((y_46_im * -atan2(x_46_im, x_46_re))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$re, -5.3e-8], N[Not[LessEqual[y$46$re, 7.8e+33]], $MachinePrecision]], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], N[Exp[N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -5.3 \cdot 10^{-8} \lor \neg \left(y.re \leq 7.8 \cdot 10^{+33}\right):\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\
\end{array}
\end{array}
if y.re < -5.2999999999999998e-8 or 7.8000000000000004e33 < y.re Initial program 43.3%
exp-diff33.9%
exp-to-pow33.9%
hypot-define33.9%
*-commutative33.9%
exp-prod33.1%
fma-define33.1%
hypot-define63.0%
*-commutative63.0%
Simplified63.0%
Taylor expanded in y.im around inf 34.6%
unpow246.5%
unpow246.5%
hypot-undefine77.3%
Simplified62.3%
Taylor expanded in y.im around 0 74.2%
unpow274.2%
unpow274.2%
hypot-undefine75.0%
Simplified75.0%
if -5.2999999999999998e-8 < y.re < 7.8000000000000004e33Initial program 35.5%
cancel-sign-sub-inv35.5%
fma-define35.5%
hypot-define35.5%
distribute-lft-neg-in35.5%
distribute-rgt-neg-out35.5%
fma-define35.5%
hypot-define82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in y.im around inf 35.5%
unpow235.5%
unpow235.5%
hypot-undefine81.6%
Simplified81.6%
Taylor expanded in y.im around 0 81.7%
Taylor expanded in y.re around 0 79.2%
mul-1-neg79.2%
Simplified79.2%
Final simplification77.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (pow (hypot x.im x.re) y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return pow(hypot(x_46_im, x_46_re), y_46_re);
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.pow(math.hypot(x_46_im, x_46_re), y_46_re)
function code(x_46_re, x_46_im, y_46_re, y_46_im) return hypot(x_46_im, x_46_re) ^ y_46_re end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]
\begin{array}{l}
\\
{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}
\end{array}
Initial program 39.4%
exp-diff33.9%
exp-to-pow33.9%
hypot-define33.9%
*-commutative33.9%
exp-prod33.3%
fma-define33.3%
hypot-define70.0%
*-commutative70.0%
Simplified70.0%
Taylor expanded in y.im around inf 34.0%
unpow241.0%
unpow241.0%
hypot-undefine79.5%
Simplified69.3%
Taylor expanded in y.im around 0 52.0%
unpow252.0%
unpow252.0%
hypot-undefine59.8%
Simplified59.8%
herbie shell --seed 2024103
(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)))))