
(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 10 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 (cbrt (fma t_0 y.im (* y.re (atan2 x.im x.re)))))
(t_2 (cbrt t_1))
(t_3 (exp (- (* y.re t_0) (* (atan2 x.im x.re) y.im)))))
(if (<= y.re 4.6e+100)
(*
t_3
(cos
(*
t_2
(*
(pow (* (pow (pow t_1 2.0) 0.3333333333333333) t_2) 2.0)
(pow t_2 2.0)))))
(* t_3 (cos (* y.im (log (hypot 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 t_1 = cbrt(fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re))));
double t_2 = cbrt(t_1);
double t_3 = exp(((y_46_re * t_0) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (y_46_re <= 4.6e+100) {
tmp = t_3 * cos((t_2 * (pow((pow(pow(t_1, 2.0), 0.3333333333333333) * t_2), 2.0) * pow(t_2, 2.0))));
} else {
tmp = t_3 * cos((y_46_im * log(hypot(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)) t_1 = cbrt(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re)))) t_2 = cbrt(t_1) t_3 = exp(Float64(Float64(y_46_re * t_0) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (y_46_re <= 4.6e+100) tmp = Float64(t_3 * cos(Float64(t_2 * Float64((Float64(((t_1 ^ 2.0) ^ 0.3333333333333333) * t_2) ^ 2.0) * (t_2 ^ 2.0))))); else tmp = Float64(t_3 * cos(Float64(y_46_im * log(hypot(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]}, Block[{t$95$1 = N[Power[N[(t$95$0 * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$1, 1/3], $MachinePrecision]}, Block[{t$95$3 = N[Exp[N[(N[(y$46$re * t$95$0), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, 4.6e+100], N[(t$95$3 * N[Cos[N[(t$95$2 * N[(N[Power[N[(N[Power[N[Power[t$95$1, 2.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision] * t$95$2), $MachinePrecision], 2.0], $MachinePrecision] * N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$3 * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := \sqrt[3]{\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}\\
t_2 := \sqrt[3]{t_1}\\
t_3 := e^{y.re \cdot t_0 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;y.re \leq 4.6 \cdot 10^{+100}:\\
\;\;\;\;t_3 \cdot \cos \left(t_2 \cdot \left({\left({\left({t_1}^{2}\right)}^{0.3333333333333333} \cdot t_2\right)}^{2} \cdot {t_2}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_3 \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\end{array}
\end{array}
if y.re < 4.5999999999999998e100Initial program 45.2%
Simplified82.5%
fma-udef82.5%
hypot-udef45.2%
*-commutative45.2%
add-cbrt-cube25.5%
pow325.8%
fma-def25.8%
hypot-udef48.2%
Applied egg-rr48.2%
rem-cbrt-cube82.5%
add-cube-cbrt80.9%
add-cube-cbrt83.0%
associate-*r*83.5%
Applied egg-rr83.5%
pow1/338.7%
add-cube-cbrt40.6%
unpow-prod-down40.5%
pow240.5%
pow1/384.8%
Applied egg-rr84.8%
if 4.5999999999999998e100 < y.re Initial program 37.1%
Simplified68.6%
fma-udef68.6%
hypot-udef37.1%
*-commutative37.1%
add-cube-cbrt40.0%
pow340.0%
hypot-udef65.7%
*-commutative65.7%
fma-udef65.7%
*-commutative65.7%
Applied egg-rr65.7%
Taylor expanded in y.re around 0 40.0%
pow-base-140.0%
*-lft-identity40.0%
unpow240.0%
unpow240.0%
hypot-def85.7%
Simplified85.7%
Final simplification84.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im)))
(t_1 (cbrt (fma t_0 y.im (* y.re (atan2 x.im x.re)))))
(t_2 (cbrt t_1))
(t_3 (exp (- (* y.re t_0) (* (atan2 x.im x.re) y.im)))))
(if (<= y.re 1.2e+29)
(* t_3 (cos (* t_2 (* (pow t_1 2.0) (pow t_2 2.0)))))
(* t_3 (cos (* y.im (log (hypot 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 t_1 = cbrt(fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re))));
double t_2 = cbrt(t_1);
double t_3 = exp(((y_46_re * t_0) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (y_46_re <= 1.2e+29) {
tmp = t_3 * cos((t_2 * (pow(t_1, 2.0) * pow(t_2, 2.0))));
} else {
tmp = t_3 * cos((y_46_im * log(hypot(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)) t_1 = cbrt(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re)))) t_2 = cbrt(t_1) t_3 = exp(Float64(Float64(y_46_re * t_0) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (y_46_re <= 1.2e+29) tmp = Float64(t_3 * cos(Float64(t_2 * Float64((t_1 ^ 2.0) * (t_2 ^ 2.0))))); else tmp = Float64(t_3 * cos(Float64(y_46_im * log(hypot(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]}, Block[{t$95$1 = N[Power[N[(t$95$0 * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$2 = N[Power[t$95$1, 1/3], $MachinePrecision]}, Block[{t$95$3 = N[Exp[N[(N[(y$46$re * t$95$0), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, 1.2e+29], N[(t$95$3 * N[Cos[N[(t$95$2 * N[(N[Power[t$95$1, 2.0], $MachinePrecision] * N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$3 * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := \sqrt[3]{\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}\\
t_2 := \sqrt[3]{t_1}\\
t_3 := e^{y.re \cdot t_0 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;y.re \leq 1.2 \cdot 10^{+29}:\\
\;\;\;\;t_3 \cdot \cos \left(t_2 \cdot \left({t_1}^{2} \cdot {t_2}^{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_3 \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\end{array}
\end{array}
if y.re < 1.2e29Initial program 45.5%
Simplified83.5%
fma-udef83.5%
hypot-udef45.5%
*-commutative45.5%
add-cbrt-cube25.2%
pow325.5%
fma-def25.5%
hypot-udef49.2%
Applied egg-rr49.2%
rem-cbrt-cube83.5%
add-cube-cbrt82.8%
add-cube-cbrt84.1%
associate-*r*85.0%
Applied egg-rr85.0%
if 1.2e29 < y.re Initial program 38.5%
Simplified69.2%
fma-udef69.2%
hypot-udef38.5%
*-commutative38.5%
add-cube-cbrt40.4%
pow338.5%
hypot-udef63.5%
*-commutative63.5%
fma-udef63.5%
*-commutative63.5%
Applied egg-rr63.5%
Taylor expanded in y.re around 0 38.5%
pow-base-138.5%
*-lft-identity38.5%
unpow238.5%
unpow238.5%
hypot-def80.8%
Simplified80.8%
Final simplification84.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_2 (exp (- (* y.re t_1) t_0)))
(t_3 (* y.re (atan2 x.im x.re))))
(if (<= (* t_2 (cos (+ t_3 (* y.im t_1)))) INFINITY)
(* t_2 (cos t_3))
(*
(exp (- (* y.re (log (hypot x.re x.im))) t_0))
(cos (* y.im (log (hypot 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 = atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_2 = exp(((y_46_re * t_1) - t_0));
double t_3 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if ((t_2 * cos((t_3 + (y_46_im * t_1)))) <= ((double) INFINITY)) {
tmp = t_2 * cos(t_3);
} else {
tmp = exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - t_0)) * cos((y_46_im * log(hypot(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 t_0 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_2 = Math.exp(((y_46_re * t_1) - t_0));
double t_3 = y_46_re * Math.atan2(x_46_im, x_46_re);
double tmp;
if ((t_2 * Math.cos((t_3 + (y_46_im * t_1)))) <= Double.POSITIVE_INFINITY) {
tmp = t_2 * Math.cos(t_3);
} else {
tmp = Math.exp(((y_46_re * Math.log(Math.hypot(x_46_re, x_46_im))) - t_0)) * Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.atan2(x_46_im, x_46_re) * y_46_im t_1 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) t_2 = math.exp(((y_46_re * t_1) - t_0)) t_3 = y_46_re * math.atan2(x_46_im, x_46_re) tmp = 0 if (t_2 * math.cos((t_3 + (y_46_im * t_1)))) <= math.inf: tmp = t_2 * math.cos(t_3) else: tmp = math.exp(((y_46_re * math.log(math.hypot(x_46_re, x_46_im))) - t_0)) * math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) return tmp
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 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_2 = exp(Float64(Float64(y_46_re * t_1) - t_0)) t_3 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (Float64(t_2 * cos(Float64(t_3 + Float64(y_46_im * t_1)))) <= Inf) tmp = Float64(t_2 * cos(t_3)); else tmp = Float64(exp(Float64(Float64(y_46_re * log(hypot(x_46_re, x_46_im))) - t_0)) * cos(Float64(y_46_im * log(hypot(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) t_0 = atan2(x_46_im, x_46_re) * y_46_im; t_1 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); t_2 = exp(((y_46_re * t_1) - t_0)); t_3 = y_46_re * atan2(x_46_im, x_46_re); tmp = 0.0; if ((t_2 * cos((t_3 + (y_46_im * t_1)))) <= Inf) tmp = t_2 * cos(t_3); else tmp = exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - t_0)) * cos((y_46_im * log(hypot(x_46_im, x_46_re)))); end tmp_2 = tmp; end
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[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[(y$46$re * t$95$1), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$2 * N[Cos[N[(t$95$3 + N[(y$46$im * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$2 * N[Cos[t$95$3], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_2 := e^{y.re \cdot t_1 - t_0}\\
t_3 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;t_2 \cdot \cos \left(t_3 + y.im \cdot t_1\right) \leq \infty:\\
\;\;\;\;t_2 \cdot \cos t_3\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - t_0} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < +inf.0Initial program 78.3%
Taylor expanded in y.im around 0 81.4%
if +inf.0 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) Initial program 0.0%
Simplified83.5%
fma-udef83.5%
hypot-udef0.0%
*-commutative0.0%
add-cube-cbrt0.0%
pow30.0%
hypot-udef78.2%
*-commutative78.2%
fma-udef78.2%
*-commutative78.2%
Applied egg-rr78.2%
Taylor expanded in y.re around 0 0.0%
pow-base-10.0%
*-lft-identity0.0%
unpow20.0%
unpow20.0%
hypot-def86.4%
Simplified86.4%
Final simplification83.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (exp (- (* y.re (log (hypot x.re x.im))) t_0))))
(if (<= x.re -1.06e-122)
(* (cos (* y.re (atan2 x.im x.re))) (exp (- (* y.re (log (- x.re))) t_0)))
(if (<= x.re -5e-309)
(* t_1 (cos (* y.im (log (/ -1.0 x.re)))))
(* t_1 (cos (* y.im (log x.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 = exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - t_0));
double tmp;
if (x_46_re <= -1.06e-122) {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * exp(((y_46_re * log(-x_46_re)) - t_0));
} else if (x_46_re <= -5e-309) {
tmp = t_1 * cos((y_46_im * log((-1.0 / x_46_re))));
} else {
tmp = t_1 * cos((y_46_im * log(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 t_0 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = Math.exp(((y_46_re * Math.log(Math.hypot(x_46_re, x_46_im))) - t_0));
double tmp;
if (x_46_re <= -1.06e-122) {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.exp(((y_46_re * Math.log(-x_46_re)) - t_0));
} else if (x_46_re <= -5e-309) {
tmp = t_1 * Math.cos((y_46_im * Math.log((-1.0 / x_46_re))));
} else {
tmp = t_1 * Math.cos((y_46_im * Math.log(x_46_re)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.atan2(x_46_im, x_46_re) * y_46_im t_1 = math.exp(((y_46_re * math.log(math.hypot(x_46_re, x_46_im))) - t_0)) tmp = 0 if x_46_re <= -1.06e-122: tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.exp(((y_46_re * math.log(-x_46_re)) - t_0)) elif x_46_re <= -5e-309: tmp = t_1 * math.cos((y_46_im * math.log((-1.0 / x_46_re)))) else: tmp = t_1 * math.cos((y_46_im * math.log(x_46_re))) return tmp
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 = exp(Float64(Float64(y_46_re * log(hypot(x_46_re, x_46_im))) - t_0)) tmp = 0.0 if (x_46_re <= -1.06e-122) tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * exp(Float64(Float64(y_46_re * log(Float64(-x_46_re))) - t_0))); elseif (x_46_re <= -5e-309) tmp = Float64(t_1 * cos(Float64(y_46_im * log(Float64(-1.0 / x_46_re))))); else tmp = Float64(t_1 * cos(Float64(y_46_im * log(x_46_re)))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = atan2(x_46_im, x_46_re) * y_46_im; t_1 = exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - t_0)); tmp = 0.0; if (x_46_re <= -1.06e-122) tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * exp(((y_46_re * log(-x_46_re)) - t_0)); elseif (x_46_re <= -5e-309) tmp = t_1 * cos((y_46_im * log((-1.0 / x_46_re)))); else tmp = t_1 * cos((y_46_im * log(x_46_re))); end tmp_2 = tmp; end
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[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -1.06e-122], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(y$46$re * N[Log[(-x$46$re)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, -5e-309], N[(t$95$1 * N[Cos[N[(y$46$im * N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Cos[N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - t_0}\\
\mathbf{if}\;x.re \leq -1.06 \cdot 10^{-122}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log \left(-x.re\right) - t_0}\\
\mathbf{elif}\;x.re \leq -5 \cdot 10^{-309}:\\
\;\;\;\;t_1 \cdot \cos \left(y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \cos \left(y.im \cdot \log x.re\right)\\
\end{array}
\end{array}
if x.re < -1.05999999999999994e-122Initial program 46.8%
Taylor expanded in y.im around 0 71.1%
Taylor expanded in x.re around -inf 89.5%
mul-1-neg82.2%
Simplified89.5%
if -1.05999999999999994e-122 < x.re < -4.9999999999999995e-309Initial program 57.8%
Simplified87.1%
fma-udef87.1%
hypot-udef57.8%
*-commutative57.8%
add-cube-cbrt54.6%
pow354.6%
hypot-udef80.6%
*-commutative80.6%
fma-udef80.6%
*-commutative80.6%
Applied egg-rr80.6%
Taylor expanded in y.re around 0 57.8%
pow-base-157.8%
*-lft-identity57.8%
unpow257.8%
unpow257.8%
hypot-def83.9%
Simplified83.9%
Taylor expanded in x.re around -inf 87.1%
neg-mul-187.1%
cos-neg87.1%
Simplified87.1%
if -4.9999999999999995e-309 < x.re Initial program 38.7%
Simplified71.6%
fma-udef71.6%
hypot-udef38.7%
*-commutative38.7%
add-cube-cbrt40.5%
pow340.9%
hypot-udef73.2%
*-commutative73.2%
fma-udef73.2%
*-commutative73.2%
Applied egg-rr73.2%
Taylor expanded in x.re around inf 32.2%
unpow1/370.8%
+-commutative70.8%
mul-1-neg70.8%
unsub-neg70.8%
log-rec70.8%
Simplified70.8%
Taylor expanded in y.re around 0 75.9%
pow-base-175.9%
*-lft-identity75.9%
Simplified75.9%
Final simplification82.4%
(FPCore (x.re x.im y.re y.im) :precision binary64 (exp (- (* y.re (log (hypot x.re x.im))) (* (atan2 x.im x.re) y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - (atan2(x_46_im, x_46_re) * y_46_im)));
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.exp(((y_46_re * Math.log(Math.hypot(x_46_re, x_46_im))) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.exp(((y_46_re * math.log(math.hypot(x_46_re, x_46_im))) - (math.atan2(x_46_im, x_46_re) * y_46_im)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return exp(Float64(Float64(y_46_re * log(hypot(x_46_re, x_46_im))) - Float64(atan(x_46_im, x_46_re) * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - (atan2(x_46_im, x_46_re) * y_46_im))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}
\end{array}
Initial program 44.1%
Simplified80.6%
fma-udef80.6%
hypot-udef44.1%
*-commutative44.1%
add-cube-cbrt45.0%
pow344.8%
hypot-udef79.0%
*-commutative79.0%
fma-udef79.0%
*-commutative79.0%
Applied egg-rr79.0%
Taylor expanded in y.im around inf 78.8%
Final simplification78.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im)))
(if (<= x.im -1e-310)
(exp (- (* y.re (log (- x.im))) t_0))
(exp (- (* y.re (log x.im)) t_0)))))
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 tmp;
if (x_46_im <= -1e-310) {
tmp = exp(((y_46_re * log(-x_46_im)) - t_0));
} else {
tmp = exp(((y_46_re * log(x_46_im)) - t_0));
}
return tmp;
}
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
real(8) :: tmp
t_0 = atan2(x_46im, x_46re) * y_46im
if (x_46im <= (-1d-310)) then
tmp = exp(((y_46re * log(-x_46im)) - t_0))
else
tmp = exp(((y_46re * log(x_46im)) - t_0))
end if
code = tmp
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.atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_im <= -1e-310) {
tmp = Math.exp(((y_46_re * Math.log(-x_46_im)) - t_0));
} else {
tmp = Math.exp(((y_46_re * Math.log(x_46_im)) - t_0));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.atan2(x_46_im, x_46_re) * y_46_im tmp = 0 if x_46_im <= -1e-310: tmp = math.exp(((y_46_re * math.log(-x_46_im)) - t_0)) else: tmp = math.exp(((y_46_re * math.log(x_46_im)) - t_0)) return tmp
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) tmp = 0.0 if (x_46_im <= -1e-310) tmp = exp(Float64(Float64(y_46_re * log(Float64(-x_46_im))) - t_0)); else tmp = exp(Float64(Float64(y_46_re * log(x_46_im)) - t_0)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = atan2(x_46_im, x_46_re) * y_46_im; tmp = 0.0; if (x_46_im <= -1e-310) tmp = exp(((y_46_re * log(-x_46_im)) - t_0)); else tmp = exp(((y_46_re * log(x_46_im)) - t_0)); end tmp_2 = tmp; end
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]}, If[LessEqual[x$46$im, -1e-310], N[Exp[N[(N[(y$46$re * N[Log[(-x$46$im)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.im \leq -1 \cdot 10^{-310}:\\
\;\;\;\;e^{y.re \cdot \log \left(-x.im\right) - t_0}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - t_0}\\
\end{array}
\end{array}
if x.im < -9.999999999999969e-311Initial program 45.0%
Simplified80.8%
fma-udef80.8%
hypot-udef45.0%
*-commutative45.0%
add-cube-cbrt45.5%
pow345.5%
hypot-udef79.7%
*-commutative79.7%
fma-udef79.7%
*-commutative79.7%
Applied egg-rr79.7%
Taylor expanded in y.im around inf 83.5%
Taylor expanded in y.re around 0 68.5%
*-commutative68.5%
+-commutative68.5%
unpow268.5%
unpow268.5%
hypot-def83.5%
rem-log-exp80.3%
exp-prod80.3%
log-pow83.5%
hypot-def68.5%
unpow268.5%
unpow268.5%
+-commutative68.5%
rem-exp-log68.5%
+-commutative68.5%
unpow268.5%
unpow268.5%
Simplified68.5%
Taylor expanded in x.im around -inf 74.3%
mul-1-neg74.3%
Simplified74.3%
if -9.999999999999969e-311 < x.im Initial program 43.2%
Simplified80.4%
fma-udef80.4%
hypot-udef43.2%
*-commutative43.2%
add-cube-cbrt44.5%
pow344.1%
hypot-udef78.4%
*-commutative78.4%
fma-udef78.4%
*-commutative78.4%
Applied egg-rr78.4%
Taylor expanded in y.im around inf 74.4%
Taylor expanded in x.re around 0 64.4%
*-commutative64.4%
Simplified64.4%
Final simplification69.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im)))
(if (<= x.re -1e-309)
(exp (- (* y.re (log (- x.re))) t_0))
(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) {
double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_re <= -1e-309) {
tmp = exp(((y_46_re * log(-x_46_re)) - t_0));
} else {
tmp = exp(((y_46_re * log(x_46_re)) - t_0));
}
return tmp;
}
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
real(8) :: tmp
t_0 = atan2(x_46im, x_46re) * y_46im
if (x_46re <= (-1d-309)) then
tmp = exp(((y_46re * log(-x_46re)) - t_0))
else
tmp = exp(((y_46re * log(x_46re)) - t_0))
end if
code = tmp
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.atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_re <= -1e-309) {
tmp = Math.exp(((y_46_re * Math.log(-x_46_re)) - t_0));
} else {
tmp = Math.exp(((y_46_re * Math.log(x_46_re)) - t_0));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.atan2(x_46_im, x_46_re) * y_46_im tmp = 0 if x_46_re <= -1e-309: tmp = math.exp(((y_46_re * math.log(-x_46_re)) - t_0)) else: tmp = math.exp(((y_46_re * math.log(x_46_re)) - t_0)) return tmp
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) tmp = 0.0 if (x_46_re <= -1e-309) tmp = exp(Float64(Float64(y_46_re * log(Float64(-x_46_re))) - t_0)); else tmp = exp(Float64(Float64(y_46_re * log(x_46_re)) - t_0)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = atan2(x_46_im, x_46_re) * y_46_im; tmp = 0.0; if (x_46_re <= -1e-309) tmp = exp(((y_46_re * log(-x_46_re)) - t_0)); else tmp = exp(((y_46_re * log(x_46_re)) - t_0)); end tmp_2 = tmp; end
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]}, If[LessEqual[x$46$re, -1e-309], N[Exp[N[(N[(y$46$re * N[Log[(-x$46$re)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.re \leq -1 \cdot 10^{-309}:\\
\;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - t_0}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - t_0}\\
\end{array}
\end{array}
if x.re < -1.000000000000002e-309Initial program 49.5%
Simplified89.7%
fma-udef89.7%
hypot-udef49.5%
*-commutative49.5%
add-cube-cbrt49.5%
pow348.7%
hypot-udef85.0%
*-commutative85.0%
fma-udef85.0%
*-commutative85.0%
Applied egg-rr85.0%
Taylor expanded in y.im around inf 84.1%
Taylor expanded in y.re around 0 64.4%
*-commutative64.4%
+-commutative64.4%
unpow264.4%
unpow264.4%
hypot-def84.1%
rem-log-exp78.7%
exp-prod78.7%
log-pow84.1%
hypot-def64.4%
unpow264.4%
unpow264.4%
+-commutative64.4%
rem-exp-log64.4%
+-commutative64.4%
unpow264.4%
unpow264.4%
Simplified64.4%
Taylor expanded in x.re around -inf 75.8%
mul-1-neg75.8%
Simplified75.8%
if -1.000000000000002e-309 < x.re Initial program 38.7%
Simplified71.6%
fma-udef71.6%
hypot-udef38.7%
*-commutative38.7%
add-cube-cbrt40.5%
pow340.9%
hypot-udef73.2%
*-commutative73.2%
fma-udef73.2%
*-commutative73.2%
Applied egg-rr73.2%
Taylor expanded in y.im around inf 73.5%
Taylor expanded in x.im around 0 67.7%
Final simplification71.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.re -1e-309) (exp (* (atan2 x.im x.re) (- y.im))) (exp (- (* y.re (log x.re)) (* (atan2 x.im x.re) y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_re <= -1e-309) {
tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = exp(((y_46_re * log(x_46_re)) - (atan2(x_46_im, x_46_re) * y_46_im)));
}
return tmp;
}
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) :: tmp
if (x_46re <= (-1d-309)) then
tmp = exp((atan2(x_46im, x_46re) * -y_46im))
else
tmp = exp(((y_46re * log(x_46re)) - (atan2(x_46im, x_46re) * y_46im)))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_re <= -1e-309) {
tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = Math.exp(((y_46_re * Math.log(x_46_re)) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if x_46_re <= -1e-309: tmp = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) else: tmp = math.exp(((y_46_re * math.log(x_46_re)) - (math.atan2(x_46_im, x_46_re) * y_46_im))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (x_46_re <= -1e-309) tmp = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im))); else tmp = exp(Float64(Float64(y_46_re * log(x_46_re)) - Float64(atan(x_46_im, x_46_re) * y_46_im))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (x_46_re <= -1e-309) tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im)); else tmp = exp(((y_46_re * log(x_46_re)) - (atan2(x_46_im, x_46_re) * y_46_im))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$re, -1e-309], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq -1 \cdot 10^{-309}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\end{array}
\end{array}
if x.re < -1.000000000000002e-309Initial program 49.5%
Taylor expanded in y.im around 0 70.2%
Taylor expanded in y.re around 0 52.1%
unpow252.1%
unpow252.1%
swap-sqr52.1%
unpow252.1%
Simplified52.1%
Taylor expanded in y.re around 0 61.5%
distribute-rgt-neg-in61.5%
Simplified61.5%
if -1.000000000000002e-309 < x.re Initial program 38.7%
Simplified71.6%
fma-udef71.6%
hypot-udef38.7%
*-commutative38.7%
add-cube-cbrt40.5%
pow340.9%
hypot-udef73.2%
*-commutative73.2%
fma-udef73.2%
*-commutative73.2%
Applied egg-rr73.2%
Taylor expanded in y.im around inf 73.5%
Taylor expanded in x.im around 0 67.7%
Final simplification64.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (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) {
return pow(exp(-y_46_im), atan2(x_46_im, x_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
code = exp(-y_46im) ** atan2(x_46im, x_46re)
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.pow(Math.exp(-y_46_im), Math.atan2(x_46_im, x_46_re));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.pow(math.exp(-y_46_im), math.atan2(x_46_im, x_46_re))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = exp(-y_46_im) ^ atan2(x_46_im, x_46_re); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
{\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}
\end{array}
Initial program 44.1%
Taylor expanded in y.im around 0 65.9%
Taylor expanded in y.re around 0 49.1%
unpow249.1%
unpow249.1%
swap-sqr52.6%
unpow252.6%
Simplified52.6%
Taylor expanded in y.re around 0 49.9%
distribute-lft-neg-in49.9%
exp-prod50.7%
Simplified50.7%
Final simplification50.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (exp (* (atan2 x.im x.re) (- y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return exp((atan2(x_46_im, x_46_re) * -y_46_im));
}
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
code = exp((atan2(x_46im, x_46re) * -y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im)); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}
\end{array}
Initial program 44.1%
Taylor expanded in y.im around 0 65.9%
Taylor expanded in y.re around 0 49.1%
unpow249.1%
unpow249.1%
swap-sqr52.6%
unpow252.6%
Simplified52.6%
Taylor expanded in y.re around 0 49.9%
distribute-rgt-neg-in49.9%
Simplified49.9%
Final simplification49.9%
herbie shell --seed 2023279
(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)))))