
(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 13 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))))
(*
(exp (fma t_0 y.re (* (atan2 x.im x.re) (- y.im))))
(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));
return exp(fma(t_0, y_46_re, (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))));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) return Float64(exp(fma(t_0, y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cos(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re))))) 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]}, N[(N[Exp[N[(t$95$0 * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $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]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
e^{\mathsf{fma}\left(t_0, y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-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)
\end{array}
\end{array}
Initial program 40.1%
fma-neg40.1%
hypot-def40.1%
distribute-rgt-neg-out40.1%
fma-def40.1%
hypot-def81.2%
*-commutative81.2%
Simplified81.2%
Final simplification81.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= y.re -2.2)
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(cos t_0))
(if (<= y.re 6.4e-6)
(*
(cos (fma (log (hypot x.re x.im)) y.im t_0))
(/ (pow (hypot x.re x.im) y.re) (pow (exp y.im) (atan2 x.im x.re))))
(*
(pow (sqrt (+ (pow x.im 2.0) (pow x.re 2.0))) y.re)
(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 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_re <= -2.2) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(t_0);
} else if (y_46_re <= 6.4e-6) {
tmp = cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_0)) * (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 = pow(sqrt((pow(x_46_im, 2.0) + pow(x_46_re, 2.0))), y_46_re) * 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 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_re <= -2.2) tmp = Float64(exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(t_0)); elseif (y_46_re <= 6.4e-6) tmp = Float64(cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_0)) * 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((sqrt(Float64((x_46_im ^ 2.0) + (x_46_re ^ 2.0))) ^ y_46_re) * 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[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -2.2], N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 6.4e-6], N[(N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im + t$95$0), $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[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] * 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 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.re \leq -2.2:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos t_0\\
\mathbf{elif}\;y.re \leq 6.4 \cdot 10^{-6}:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t_0\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(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \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 < -2.2000000000000002Initial program 42.5%
Taylor expanded in y.im around 0 85.0%
if -2.2000000000000002 < y.re < 6.3999999999999997e-6Initial program 36.5%
exp-diff36.5%
associate-*l/36.5%
*-rgt-identity36.5%
metadata-eval36.5%
associate-*l/36.5%
Simplified83.0%
if 6.3999999999999997e-6 < y.re Initial program 43.5%
exp-diff36.2%
associate-*l/36.2%
*-rgt-identity36.2%
metadata-eval36.2%
associate-*l/36.2%
Simplified58.0%
add-cube-cbrt58.0%
exp-prod58.0%
pow258.0%
Applied egg-rr58.0%
add-log-exp58.0%
Applied egg-rr58.0%
Taylor expanded in y.re around 0 37.7%
+-commutative37.7%
unpow237.7%
unpow237.7%
hypot-def66.7%
hypot-def37.7%
unpow237.7%
unpow237.7%
+-commutative37.7%
unpow237.7%
unpow237.7%
hypot-def66.7%
Simplified66.7%
Taylor expanded in y.im around 0 69.7%
Final simplification80.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (cos (* y.im (log (hypot x.im x.re))))))
(if (<= y.re -1.35e-7)
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(cos (* y.re (atan2 x.im x.re))))
(if (<= y.re 6.4e-6)
(* t_0 (exp (* (atan2 x.im x.re) (- y.im))))
(* (pow (sqrt (+ (pow x.im 2.0) (pow x.re 2.0))) y.re) t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = cos((y_46_im * log(hypot(x_46_im, x_46_re))));
double tmp;
if (y_46_re <= -1.35e-7) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos((y_46_re * atan2(x_46_im, x_46_re)));
} else if (y_46_re <= 6.4e-6) {
tmp = t_0 * exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = pow(sqrt((pow(x_46_im, 2.0) + pow(x_46_re, 2.0))), y_46_re) * t_0;
}
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.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))));
double tmp;
if (y_46_re <= -1.35e-7) {
tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
} else if (y_46_re <= 6.4e-6) {
tmp = t_0 * Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = Math.pow(Math.sqrt((Math.pow(x_46_im, 2.0) + Math.pow(x_46_re, 2.0))), y_46_re) * t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) tmp = 0 if y_46_re <= -1.35e-7: tmp = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) elif y_46_re <= 6.4e-6: tmp = t_0 * math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) else: tmp = math.pow(math.sqrt((math.pow(x_46_im, 2.0) + math.pow(x_46_re, 2.0))), y_46_re) * t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) tmp = 0.0 if (y_46_re <= -1.35e-7) tmp = Float64(exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(y_46_re * atan(x_46_im, x_46_re)))); elseif (y_46_re <= 6.4e-6) tmp = Float64(t_0 * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))); else tmp = Float64((sqrt(Float64((x_46_im ^ 2.0) + (x_46_re ^ 2.0))) ^ y_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 = cos((y_46_im * log(hypot(x_46_im, x_46_re)))); tmp = 0.0; if (y_46_re <= -1.35e-7) tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos((y_46_re * atan2(x_46_im, x_46_re))); elseif (y_46_re <= 6.4e-6) tmp = t_0 * exp((atan2(x_46_im, x_46_re) * -y_46_im)); else tmp = (sqrt(((x_46_im ^ 2.0) + (x_46_re ^ 2.0))) ^ y_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[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$re, -1.35e-7], N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 6.4e-6], N[(t$95$0 * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(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] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{if}\;y.re \leq -1.35 \cdot 10^{-7}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{elif}\;y.re \leq 6.4 \cdot 10^{-6}:\\
\;\;\;\;t_0 \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot t_0\\
\end{array}
\end{array}
if y.re < -1.35000000000000004e-7Initial program 42.5%
Taylor expanded in y.im around 0 85.0%
if -1.35000000000000004e-7 < y.re < 6.3999999999999997e-6Initial program 36.5%
exp-diff36.5%
associate-*l/36.5%
*-rgt-identity36.5%
metadata-eval36.5%
associate-*l/36.5%
Simplified79.7%
add-cube-cbrt79.7%
exp-prod79.7%
pow279.7%
Applied egg-rr79.7%
add-log-exp79.7%
Applied egg-rr79.7%
Taylor expanded in y.re around 0 35.7%
+-commutative35.7%
unpow235.7%
unpow235.7%
hypot-def79.7%
hypot-def35.7%
unpow235.7%
unpow235.7%
+-commutative35.7%
unpow235.7%
unpow235.7%
hypot-def79.7%
Simplified79.7%
Taylor expanded in y.re around 0 83.0%
rec-exp83.0%
associate-*r*83.0%
pow-base-183.0%
Simplified83.0%
if 6.3999999999999997e-6 < y.re Initial program 43.5%
exp-diff36.2%
associate-*l/36.2%
*-rgt-identity36.2%
metadata-eval36.2%
associate-*l/36.2%
Simplified58.0%
add-cube-cbrt58.0%
exp-prod58.0%
pow258.0%
Applied egg-rr58.0%
add-log-exp58.0%
Applied egg-rr58.0%
Taylor expanded in y.re around 0 37.7%
+-commutative37.7%
unpow237.7%
unpow237.7%
hypot-def66.7%
hypot-def37.7%
unpow237.7%
unpow237.7%
+-commutative37.7%
unpow237.7%
unpow237.7%
hypot-def66.7%
Simplified66.7%
Taylor expanded in y.im around 0 69.7%
Final simplification80.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.re -9e-9) (not (<= y.re 2.4e-15)))
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(cos (* y.re (atan2 x.im x.re))))
(*
(cos (* y.im (log (hypot x.im x.re))))
(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) {
double tmp;
if ((y_46_re <= -9e-9) || !(y_46_re <= 2.4e-15)) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos((y_46_re * atan2(x_46_im, x_46_re)));
} else {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp((atan2(x_46_im, x_46_re) * -y_46_im));
}
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 <= -9e-9) || !(y_46_re <= 2.4e-15)) {
tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
} else {
tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) * Math.exp((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 (y_46_re <= -9e-9) or not (y_46_re <= 2.4e-15): tmp = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) else: tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) * math.exp((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 ((y_46_re <= -9e-9) || !(y_46_re <= 2.4e-15)) tmp = Float64(exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(y_46_re * atan(x_46_im, x_46_re)))); else tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-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 ((y_46_re <= -9e-9) || ~((y_46_re <= 2.4e-15))) tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos((y_46_re * atan2(x_46_im, x_46_re))); else tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp((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[Or[LessEqual[y$46$re, -9e-9], N[Not[LessEqual[y$46$re, 2.4e-15]], $MachinePrecision]], N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -9 \cdot 10^{-9} \lor \neg \left(y.re \leq 2.4 \cdot 10^{-15}\right):\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\end{array}
\end{array}
if y.re < -8.99999999999999953e-9 or 2.39999999999999995e-15 < y.re Initial program 43.8%
Taylor expanded in y.im around 0 75.1%
if -8.99999999999999953e-9 < y.re < 2.39999999999999995e-15Initial program 35.4%
exp-diff35.4%
associate-*l/35.4%
*-rgt-identity35.4%
metadata-eval35.4%
associate-*l/35.4%
Simplified79.4%
add-cube-cbrt79.4%
exp-prod79.4%
pow279.4%
Applied egg-rr79.4%
add-log-exp79.4%
Applied egg-rr79.4%
Taylor expanded in y.re around 0 34.5%
+-commutative34.5%
unpow234.5%
unpow234.5%
hypot-def79.4%
hypot-def34.5%
unpow234.5%
unpow234.5%
+-commutative34.5%
unpow234.5%
unpow234.5%
hypot-def79.4%
Simplified79.4%
Taylor expanded in y.re around 0 82.8%
rec-exp82.8%
associate-*r*82.8%
pow-base-182.8%
Simplified82.8%
Final simplification78.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (cos (* y.im (log (hypot x.im x.re)))))
(t_1 (cos (* y.re (atan2 x.im x.re))))
(t_2
(*
t_0
(exp
(- (* (atan2 x.im x.re) (- y.im)) (* y.re (log (/ -1.0 x.im)))))))
(t_3 (* (atan2 x.im x.re) y.im))
(t_4 (exp (- (* y.re (log x.im)) t_3))))
(if (<= x.im -1e-14)
t_2
(if (<= x.im -3e-147)
(*
t_1
(exp (- (* y.re (log (- (* -0.5 (* x.re (/ x.re x.im))) x.im))) t_3)))
(if (<= x.im -2e-310)
t_2
(if (<= x.im 4e+75) (* t_1 t_4) (* t_0 t_4)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = cos((y_46_im * log(hypot(x_46_im, x_46_re))));
double t_1 = cos((y_46_re * atan2(x_46_im, x_46_re)));
double t_2 = t_0 * exp(((atan2(x_46_im, x_46_re) * -y_46_im) - (y_46_re * log((-1.0 / x_46_im)))));
double t_3 = atan2(x_46_im, x_46_re) * y_46_im;
double t_4 = exp(((y_46_re * log(x_46_im)) - t_3));
double tmp;
if (x_46_im <= -1e-14) {
tmp = t_2;
} else if (x_46_im <= -3e-147) {
tmp = t_1 * exp(((y_46_re * log(((-0.5 * (x_46_re * (x_46_re / x_46_im))) - x_46_im))) - t_3));
} else if (x_46_im <= -2e-310) {
tmp = t_2;
} else if (x_46_im <= 4e+75) {
tmp = t_1 * t_4;
} else {
tmp = t_0 * t_4;
}
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.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))));
double t_1 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
double t_2 = t_0 * Math.exp(((Math.atan2(x_46_im, x_46_re) * -y_46_im) - (y_46_re * Math.log((-1.0 / x_46_im)))));
double t_3 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double t_4 = Math.exp(((y_46_re * Math.log(x_46_im)) - t_3));
double tmp;
if (x_46_im <= -1e-14) {
tmp = t_2;
} else if (x_46_im <= -3e-147) {
tmp = t_1 * Math.exp(((y_46_re * Math.log(((-0.5 * (x_46_re * (x_46_re / x_46_im))) - x_46_im))) - t_3));
} else if (x_46_im <= -2e-310) {
tmp = t_2;
} else if (x_46_im <= 4e+75) {
tmp = t_1 * t_4;
} else {
tmp = t_0 * t_4;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) t_1 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) t_2 = t_0 * math.exp(((math.atan2(x_46_im, x_46_re) * -y_46_im) - (y_46_re * math.log((-1.0 / x_46_im))))) t_3 = math.atan2(x_46_im, x_46_re) * y_46_im t_4 = math.exp(((y_46_re * math.log(x_46_im)) - t_3)) tmp = 0 if x_46_im <= -1e-14: tmp = t_2 elif x_46_im <= -3e-147: tmp = t_1 * math.exp(((y_46_re * math.log(((-0.5 * (x_46_re * (x_46_re / x_46_im))) - x_46_im))) - t_3)) elif x_46_im <= -2e-310: tmp = t_2 elif x_46_im <= 4e+75: tmp = t_1 * t_4 else: tmp = t_0 * t_4 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) t_1 = cos(Float64(y_46_re * atan(x_46_im, x_46_re))) t_2 = Float64(t_0 * exp(Float64(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)) - Float64(y_46_re * log(Float64(-1.0 / x_46_im)))))) t_3 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_4 = exp(Float64(Float64(y_46_re * log(x_46_im)) - t_3)) tmp = 0.0 if (x_46_im <= -1e-14) tmp = t_2; elseif (x_46_im <= -3e-147) tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(Float64(Float64(-0.5 * Float64(x_46_re * Float64(x_46_re / x_46_im))) - x_46_im))) - t_3))); elseif (x_46_im <= -2e-310) tmp = t_2; elseif (x_46_im <= 4e+75) tmp = Float64(t_1 * t_4); else tmp = Float64(t_0 * t_4); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos((y_46_im * log(hypot(x_46_im, x_46_re)))); t_1 = cos((y_46_re * atan2(x_46_im, x_46_re))); t_2 = t_0 * exp(((atan2(x_46_im, x_46_re) * -y_46_im) - (y_46_re * log((-1.0 / x_46_im))))); t_3 = atan2(x_46_im, x_46_re) * y_46_im; t_4 = exp(((y_46_re * log(x_46_im)) - t_3)); tmp = 0.0; if (x_46_im <= -1e-14) tmp = t_2; elseif (x_46_im <= -3e-147) tmp = t_1 * exp(((y_46_re * log(((-0.5 * (x_46_re * (x_46_re / x_46_im))) - x_46_im))) - t_3)); elseif (x_46_im <= -2e-310) tmp = t_2; elseif (x_46_im <= 4e+75) tmp = t_1 * t_4; else tmp = t_0 * t_4; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 * N[Exp[N[(N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision] - N[(y$46$re * N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$4 = N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -1e-14], t$95$2, If[LessEqual[x$46$im, -3e-147], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[N[(N[(-0.5 * N[(x$46$re * N[(x$46$re / x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, -2e-310], t$95$2, If[LessEqual[x$46$im, 4e+75], N[(t$95$1 * t$95$4), $MachinePrecision], N[(t$95$0 * t$95$4), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
t_2 := t_0 \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right) - y.re \cdot \log \left(\frac{-1}{x.im}\right)}\\
t_3 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_4 := e^{y.re \cdot \log x.im - t_3}\\
\mathbf{if}\;x.im \leq -1 \cdot 10^{-14}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x.im \leq -3 \cdot 10^{-147}:\\
\;\;\;\;t_1 \cdot e^{y.re \cdot \log \left(-0.5 \cdot \left(x.re \cdot \frac{x.re}{x.im}\right) - x.im\right) - t_3}\\
\mathbf{elif}\;x.im \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x.im \leq 4 \cdot 10^{+75}:\\
\;\;\;\;t_1 \cdot t_4\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot t_4\\
\end{array}
\end{array}
if x.im < -9.99999999999999999e-15 or -3.0000000000000002e-147 < x.im < -1.999999999999994e-310Initial program 42.8%
exp-diff40.0%
associate-*l/40.0%
*-rgt-identity40.0%
metadata-eval40.0%
associate-*l/40.0%
Simplified77.8%
add-cube-cbrt77.8%
exp-prod77.8%
pow277.8%
Applied egg-rr77.8%
add-log-exp77.7%
Applied egg-rr77.7%
Taylor expanded in y.re around 0 41.8%
+-commutative41.8%
unpow241.8%
unpow241.8%
hypot-def81.5%
hypot-def41.8%
unpow241.8%
unpow241.8%
+-commutative41.8%
unpow241.8%
unpow241.8%
hypot-def81.5%
Simplified81.5%
Taylor expanded in x.im around -inf 76.7%
div-exp82.4%
mul-1-neg82.4%
*-commutative82.4%
associate-*r*82.4%
pow-base-182.4%
Simplified82.4%
if -9.99999999999999999e-15 < x.im < -3.0000000000000002e-147Initial program 70.8%
Taylor expanded in y.im around 0 83.4%
Taylor expanded in x.im around -inf 79.3%
unpow279.3%
*-un-lft-identity79.3%
times-frac79.3%
Applied egg-rr79.3%
if -1.999999999999994e-310 < x.im < 3.99999999999999971e75Initial program 44.5%
Taylor expanded in y.im around 0 60.2%
Taylor expanded in x.re around 0 63.6%
*-commutative63.6%
Simplified63.6%
if 3.99999999999999971e75 < x.im Initial program 12.2%
exp-diff8.2%
associate-*l/8.2%
*-rgt-identity8.2%
metadata-eval8.2%
associate-*l/8.2%
Simplified67.4%
add-cube-cbrt67.4%
exp-prod67.4%
pow267.4%
Applied egg-rr67.4%
add-log-exp67.4%
Applied egg-rr67.4%
Taylor expanded in y.re around 0 8.2%
+-commutative8.2%
unpow28.2%
unpow28.2%
hypot-def71.5%
hypot-def8.2%
unpow28.2%
unpow28.2%
+-commutative8.2%
unpow28.2%
unpow28.2%
hypot-def71.5%
Simplified71.5%
Taylor expanded in x.im around inf 71.5%
div-exp83.7%
mul-1-neg83.7%
*-commutative83.7%
log-rec83.7%
associate-*r*83.7%
pow-base-183.7%
Simplified83.7%
Final simplification76.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (cos (* y.re (atan2 x.im x.re))))
(t_2 (exp (- (* y.re (log x.im)) t_0))))
(if (<= x.im -2e-310)
(*
t_1
(exp (- (* y.re (log (- (* -0.5 (* x.re (/ x.re x.im))) x.im))) t_0)))
(if (<= x.im 4e+75)
(* t_1 t_2)
(* (cos (* y.im (log (hypot x.im x.re)))) t_2)))))
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 = cos((y_46_re * atan2(x_46_im, x_46_re)));
double t_2 = exp(((y_46_re * log(x_46_im)) - t_0));
double tmp;
if (x_46_im <= -2e-310) {
tmp = t_1 * exp(((y_46_re * log(((-0.5 * (x_46_re * (x_46_re / x_46_im))) - x_46_im))) - t_0));
} else if (x_46_im <= 4e+75) {
tmp = t_1 * t_2;
} else {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * t_2;
}
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.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
double t_2 = Math.exp(((y_46_re * Math.log(x_46_im)) - t_0));
double tmp;
if (x_46_im <= -2e-310) {
tmp = t_1 * Math.exp(((y_46_re * Math.log(((-0.5 * (x_46_re * (x_46_re / x_46_im))) - x_46_im))) - t_0));
} else if (x_46_im <= 4e+75) {
tmp = t_1 * t_2;
} else {
tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) * t_2;
}
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.cos((y_46_re * math.atan2(x_46_im, x_46_re))) t_2 = math.exp(((y_46_re * math.log(x_46_im)) - t_0)) tmp = 0 if x_46_im <= -2e-310: tmp = t_1 * math.exp(((y_46_re * math.log(((-0.5 * (x_46_re * (x_46_re / x_46_im))) - x_46_im))) - t_0)) elif x_46_im <= 4e+75: tmp = t_1 * t_2 else: tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) * t_2 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 = cos(Float64(y_46_re * atan(x_46_im, x_46_re))) t_2 = exp(Float64(Float64(y_46_re * log(x_46_im)) - t_0)) tmp = 0.0 if (x_46_im <= -2e-310) tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(Float64(Float64(-0.5 * Float64(x_46_re * Float64(x_46_re / x_46_im))) - x_46_im))) - t_0))); elseif (x_46_im <= 4e+75) tmp = Float64(t_1 * t_2); else tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * t_2); 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 = cos((y_46_re * atan2(x_46_im, x_46_re))); t_2 = exp(((y_46_re * log(x_46_im)) - t_0)); tmp = 0.0; if (x_46_im <= -2e-310) tmp = t_1 * exp(((y_46_re * log(((-0.5 * (x_46_re * (x_46_re / x_46_im))) - x_46_im))) - t_0)); elseif (x_46_im <= 4e+75) tmp = t_1 * t_2; else tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * t_2; 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[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -2e-310], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[N[(N[(-0.5 * N[(x$46$re * N[(x$46$re / x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 4e+75], N[(t$95$1 * t$95$2), $MachinePrecision], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
t_2 := e^{y.re \cdot \log x.im - t_0}\\
\mathbf{if}\;x.im \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_1 \cdot e^{y.re \cdot \log \left(-0.5 \cdot \left(x.re \cdot \frac{x.re}{x.im}\right) - x.im\right) - t_0}\\
\mathbf{elif}\;x.im \leq 4 \cdot 10^{+75}:\\
\;\;\;\;t_1 \cdot t_2\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot t_2\\
\end{array}
\end{array}
if x.im < -1.999999999999994e-310Initial program 48.0%
Taylor expanded in y.im around 0 68.0%
Taylor expanded in x.im around -inf 72.1%
unpow272.1%
*-un-lft-identity72.1%
times-frac73.6%
Applied egg-rr73.6%
if -1.999999999999994e-310 < x.im < 3.99999999999999971e75Initial program 44.5%
Taylor expanded in y.im around 0 60.2%
Taylor expanded in x.re around 0 63.6%
*-commutative63.6%
Simplified63.6%
if 3.99999999999999971e75 < x.im Initial program 12.2%
exp-diff8.2%
associate-*l/8.2%
*-rgt-identity8.2%
metadata-eval8.2%
associate-*l/8.2%
Simplified67.4%
add-cube-cbrt67.4%
exp-prod67.4%
pow267.4%
Applied egg-rr67.4%
add-log-exp67.4%
Applied egg-rr67.4%
Taylor expanded in y.re around 0 8.2%
+-commutative8.2%
unpow28.2%
unpow28.2%
hypot-def71.5%
hypot-def8.2%
unpow28.2%
unpow28.2%
+-commutative8.2%
unpow28.2%
unpow28.2%
hypot-def71.5%
Simplified71.5%
Taylor expanded in x.im around inf 71.5%
div-exp83.7%
mul-1-neg83.7%
*-commutative83.7%
log-rec83.7%
associate-*r*83.7%
pow-base-183.7%
Simplified83.7%
Final simplification72.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (cos (* y.re (atan2 x.im x.re)))))
(if (<= x.im -2e-310)
(*
t_1
(exp (- (* y.re (log (- (* -0.5 (* x.re (/ x.re x.im))) x.im))) t_0)))
(* t_1 (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 t_1 = cos((y_46_re * atan2(x_46_im, x_46_re)));
double tmp;
if (x_46_im <= -2e-310) {
tmp = t_1 * exp(((y_46_re * log(((-0.5 * (x_46_re * (x_46_re / x_46_im))) - x_46_im))) - t_0));
} else {
tmp = t_1 * 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) :: t_1
real(8) :: tmp
t_0 = atan2(x_46im, x_46re) * y_46im
t_1 = cos((y_46re * atan2(x_46im, x_46re)))
if (x_46im <= (-2d-310)) then
tmp = t_1 * exp(((y_46re * log((((-0.5d0) * (x_46re * (x_46re / x_46im))) - x_46im))) - t_0))
else
tmp = t_1 * 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 t_1 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
double tmp;
if (x_46_im <= -2e-310) {
tmp = t_1 * Math.exp(((y_46_re * Math.log(((-0.5 * (x_46_re * (x_46_re / x_46_im))) - x_46_im))) - t_0));
} else {
tmp = t_1 * 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 t_1 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) tmp = 0 if x_46_im <= -2e-310: tmp = t_1 * math.exp(((y_46_re * math.log(((-0.5 * (x_46_re * (x_46_re / x_46_im))) - x_46_im))) - t_0)) else: tmp = t_1 * 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) t_1 = cos(Float64(y_46_re * atan(x_46_im, x_46_re))) tmp = 0.0 if (x_46_im <= -2e-310) tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(Float64(Float64(-0.5 * Float64(x_46_re * Float64(x_46_re / x_46_im))) - x_46_im))) - t_0))); else tmp = Float64(t_1 * 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; t_1 = cos((y_46_re * atan2(x_46_im, x_46_re))); tmp = 0.0; if (x_46_im <= -2e-310) tmp = t_1 * exp(((y_46_re * log(((-0.5 * (x_46_re * (x_46_re / x_46_im))) - x_46_im))) - t_0)); else tmp = t_1 * 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]}, Block[{t$95$1 = N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -2e-310], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[N[(N[(-0.5 * N[(x$46$re * N[(x$46$re / x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;x.im \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_1 \cdot e^{y.re \cdot \log \left(-0.5 \cdot \left(x.re \cdot \frac{x.re}{x.im}\right) - x.im\right) - t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot e^{y.re \cdot \log x.im - t_0}\\
\end{array}
\end{array}
if x.im < -1.999999999999994e-310Initial program 48.0%
Taylor expanded in y.im around 0 68.0%
Taylor expanded in x.im around -inf 72.1%
unpow272.1%
*-un-lft-identity72.1%
times-frac73.6%
Applied egg-rr73.6%
if -1.999999999999994e-310 < x.im Initial program 32.0%
Taylor expanded in y.im around 0 59.2%
Taylor expanded in x.re around 0 67.6%
*-commutative67.6%
Simplified67.6%
Final simplification70.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(*
(cos (* y.im (log (hypot x.im x.re))))
(exp (* (atan2 x.im x.re) (- y.im)))))
(t_1 (* y.re (atan2 x.im x.re))))
(if (<= x.re -2.8e-250)
t_0
(if (<= x.re -3.7e-270)
(* (pow x.im y.re) (cos (- t_1 (* y.im (log (/ -1.0 x.re))))))
(if (<= x.re 5.8e-283)
t_0
(*
(cos t_1)
(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 t_0 = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp((atan2(x_46_im, x_46_re) * -y_46_im));
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -2.8e-250) {
tmp = t_0;
} else if (x_46_re <= -3.7e-270) {
tmp = pow(x_46_im, y_46_re) * cos((t_1 - (y_46_im * log((-1.0 / x_46_re)))));
} else if (x_46_re <= 5.8e-283) {
tmp = t_0;
} else {
tmp = cos(t_1) * exp(((y_46_re * log(x_46_re)) - (atan2(x_46_im, x_46_re) * y_46_im)));
}
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.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) * Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
double t_1 = y_46_re * Math.atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -2.8e-250) {
tmp = t_0;
} else if (x_46_re <= -3.7e-270) {
tmp = Math.pow(x_46_im, y_46_re) * Math.cos((t_1 - (y_46_im * Math.log((-1.0 / x_46_re)))));
} else if (x_46_re <= 5.8e-283) {
tmp = t_0;
} else {
tmp = Math.cos(t_1) * 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): t_0 = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) * math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) t_1 = y_46_re * math.atan2(x_46_im, x_46_re) tmp = 0 if x_46_re <= -2.8e-250: tmp = t_0 elif x_46_re <= -3.7e-270: tmp = math.pow(x_46_im, y_46_re) * math.cos((t_1 - (y_46_im * math.log((-1.0 / x_46_re))))) elif x_46_re <= 5.8e-283: tmp = t_0 else: tmp = math.cos(t_1) * 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) t_0 = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_re <= -2.8e-250) tmp = t_0; elseif (x_46_re <= -3.7e-270) tmp = Float64((x_46_im ^ y_46_re) * cos(Float64(t_1 - Float64(y_46_im * log(Float64(-1.0 / x_46_re)))))); elseif (x_46_re <= 5.8e-283) tmp = t_0; else tmp = Float64(cos(t_1) * 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) t_0 = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp((atan2(x_46_im, x_46_re) * -y_46_im)); t_1 = y_46_re * atan2(x_46_im, x_46_re); tmp = 0.0; if (x_46_re <= -2.8e-250) tmp = t_0; elseif (x_46_re <= -3.7e-270) tmp = (x_46_im ^ y_46_re) * cos((t_1 - (y_46_im * log((-1.0 / x_46_re))))); elseif (x_46_re <= 5.8e-283) tmp = t_0; else tmp = cos(t_1) * 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_] := Block[{t$95$0 = N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -2.8e-250], t$95$0, If[LessEqual[x$46$re, -3.7e-270], N[(N[Power[x$46$im, y$46$re], $MachinePrecision] * N[Cos[N[(t$95$1 - N[(y$46$im * N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 5.8e-283], t$95$0, N[(N[Cos[t$95$1], $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]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.re \leq -2.8 \cdot 10^{-250}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x.re \leq -3.7 \cdot 10^{-270}:\\
\;\;\;\;{x.im}^{y.re} \cdot \cos \left(t_1 - y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)\\
\mathbf{elif}\;x.re \leq 5.8 \cdot 10^{-283}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\cos t_1 \cdot e^{y.re \cdot \log x.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\end{array}
\end{array}
if x.re < -2.80000000000000028e-250 or -3.7000000000000001e-270 < x.re < 5.79999999999999976e-283Initial program 40.9%
exp-diff35.4%
associate-*l/35.4%
*-rgt-identity35.4%
metadata-eval35.4%
associate-*l/35.4%
Simplified72.3%
add-cube-cbrt72.3%
exp-prod72.3%
pow272.3%
Applied egg-rr72.3%
add-log-exp72.3%
Applied egg-rr72.3%
Taylor expanded in y.re around 0 35.4%
+-commutative35.4%
unpow235.4%
unpow235.4%
hypot-def73.9%
hypot-def35.4%
unpow235.4%
unpow235.4%
+-commutative35.4%
unpow235.4%
unpow235.4%
hypot-def73.9%
Simplified73.9%
Taylor expanded in y.re around 0 55.9%
rec-exp55.9%
associate-*r*55.9%
pow-base-155.9%
Simplified55.9%
if -2.80000000000000028e-250 < x.re < -3.7000000000000001e-270Initial program 33.3%
exp-diff33.3%
associate-*l/33.3%
*-rgt-identity33.3%
metadata-eval33.3%
associate-*l/33.3%
Simplified66.7%
Taylor expanded in x.re around 0 66.7%
Taylor expanded in x.re around -inf 66.7%
Taylor expanded in y.im around 0 100.0%
if 5.79999999999999976e-283 < x.re Initial program 39.5%
Taylor expanded in y.im around 0 61.4%
Taylor expanded in x.re around inf 68.8%
Final simplification63.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.re -122.0) (not (<= y.re 12.0)))
(*
(cos (* y.re (atan2 x.im x.re)))
(/ (pow x.im y.re) (exp (* (atan2 x.im x.re) y.im))))
(*
(cos (* y.im (log (hypot x.im x.re))))
(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) {
double tmp;
if ((y_46_re <= -122.0) || !(y_46_re <= 12.0)) {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * (pow(x_46_im, y_46_re) / exp((atan2(x_46_im, x_46_re) * y_46_im)));
} else {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp((atan2(x_46_im, x_46_re) * -y_46_im));
}
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 <= -122.0) || !(y_46_re <= 12.0)) {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * (Math.pow(x_46_im, y_46_re) / Math.exp((Math.atan2(x_46_im, x_46_re) * y_46_im)));
} else {
tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) * Math.exp((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 (y_46_re <= -122.0) or not (y_46_re <= 12.0): tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * (math.pow(x_46_im, y_46_re) / math.exp((math.atan2(x_46_im, x_46_re) * y_46_im))) else: tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) * math.exp((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 ((y_46_re <= -122.0) || !(y_46_re <= 12.0)) tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * Float64((x_46_im ^ y_46_re) / exp(Float64(atan(x_46_im, x_46_re) * y_46_im)))); else tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-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 ((y_46_re <= -122.0) || ~((y_46_re <= 12.0))) tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * ((x_46_im ^ y_46_re) / exp((atan2(x_46_im, x_46_re) * y_46_im))); else tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp((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[Or[LessEqual[y$46$re, -122.0], N[Not[LessEqual[y$46$re, 12.0]], $MachinePrecision]], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Power[x$46$im, y$46$re], $MachinePrecision] / N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -122 \lor \neg \left(y.re \leq 12\right):\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \frac{{x.im}^{y.re}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\end{array}
\end{array}
if y.re < -122 or 12 < y.re Initial program 42.6%
exp-diff34.8%
associate-*l/34.8%
*-rgt-identity34.8%
metadata-eval34.8%
associate-*l/34.8%
Simplified64.5%
Taylor expanded in x.re around 0 47.8%
Taylor expanded in y.im around 0 48.5%
if -122 < y.re < 12Initial program 37.1%
exp-diff37.1%
associate-*l/37.1%
*-rgt-identity37.1%
metadata-eval37.1%
associate-*l/37.1%
Simplified79.9%
add-cube-cbrt79.9%
exp-prod79.9%
pow279.9%
Applied egg-rr79.9%
add-log-exp79.9%
Applied egg-rr79.9%
Taylor expanded in y.re around 0 36.2%
+-commutative36.2%
unpow236.2%
unpow236.2%
hypot-def79.9%
hypot-def36.2%
unpow236.2%
unpow236.2%
+-commutative36.2%
unpow236.2%
unpow236.2%
hypot-def79.9%
Simplified79.9%
Taylor expanded in y.re around 0 82.6%
rec-exp82.6%
associate-*r*82.6%
pow-base-182.6%
Simplified82.6%
Final simplification63.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (cos (* y.re (atan2 x.im x.re)))))
(if (<= x.im -2e-310)
(* t_1 (exp (- (* y.re (log (- x.im))) t_0)))
(* t_1 (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 t_1 = cos((y_46_re * atan2(x_46_im, x_46_re)));
double tmp;
if (x_46_im <= -2e-310) {
tmp = t_1 * exp(((y_46_re * log(-x_46_im)) - t_0));
} else {
tmp = t_1 * 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) :: t_1
real(8) :: tmp
t_0 = atan2(x_46im, x_46re) * y_46im
t_1 = cos((y_46re * atan2(x_46im, x_46re)))
if (x_46im <= (-2d-310)) then
tmp = t_1 * exp(((y_46re * log(-x_46im)) - t_0))
else
tmp = t_1 * 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 t_1 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
double tmp;
if (x_46_im <= -2e-310) {
tmp = t_1 * Math.exp(((y_46_re * Math.log(-x_46_im)) - t_0));
} else {
tmp = t_1 * 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 t_1 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) tmp = 0 if x_46_im <= -2e-310: tmp = t_1 * math.exp(((y_46_re * math.log(-x_46_im)) - t_0)) else: tmp = t_1 * 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) t_1 = cos(Float64(y_46_re * atan(x_46_im, x_46_re))) tmp = 0.0 if (x_46_im <= -2e-310) tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(Float64(-x_46_im))) - t_0))); else tmp = Float64(t_1 * 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; t_1 = cos((y_46_re * atan2(x_46_im, x_46_re))); tmp = 0.0; if (x_46_im <= -2e-310) tmp = t_1 * exp(((y_46_re * log(-x_46_im)) - t_0)); else tmp = t_1 * 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]}, Block[{t$95$1 = N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -2e-310], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[(-x$46$im)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;x.im \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t_1 \cdot e^{y.re \cdot \log \left(-x.im\right) - t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot e^{y.re \cdot \log x.im - t_0}\\
\end{array}
\end{array}
if x.im < -1.999999999999994e-310Initial program 48.0%
Taylor expanded in y.im around 0 68.0%
Taylor expanded in x.im around -inf 73.2%
mul-1-neg73.2%
Simplified73.2%
if -1.999999999999994e-310 < x.im Initial program 32.0%
Taylor expanded in y.im around 0 59.2%
Taylor expanded in x.re around 0 67.6%
*-commutative67.6%
Simplified67.6%
Final simplification70.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= x.im 7.8e-277)
(*
(cos (* y.im (log (hypot x.im x.re))))
(exp (* (atan2 x.im x.re) (- y.im))))
(*
(cos (* y.re (atan2 x.im x.re)))
(exp (- (* y.re (log 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) {
double tmp;
if (x_46_im <= 7.8e-277) {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * exp(((y_46_re * log(x_46_im)) - (atan2(x_46_im, x_46_re) * y_46_im)));
}
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 (x_46_im <= 7.8e-277) {
tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) * Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.exp(((y_46_re * Math.log(x_46_im)) - (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_im <= 7.8e-277: tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) * math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) else: tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.exp(((y_46_re * math.log(x_46_im)) - (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_im <= 7.8e-277) tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))); else tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * exp(Float64(Float64(y_46_re * log(x_46_im)) - 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_im <= 7.8e-277) tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp((atan2(x_46_im, x_46_re) * -y_46_im)); else tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * exp(((y_46_re * log(x_46_im)) - (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$im, 7.8e-277], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 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$im], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 7.8 \cdot 10^{-277}:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log x.im - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\end{array}
\end{array}
if x.im < 7.79999999999999973e-277Initial program 47.4%
exp-diff43.0%
associate-*l/43.0%
*-rgt-identity43.0%
metadata-eval43.0%
associate-*l/43.0%
Simplified75.1%
add-cube-cbrt75.1%
exp-prod75.1%
pow275.1%
Applied egg-rr75.1%
add-log-exp75.1%
Applied egg-rr75.1%
Taylor expanded in y.re around 0 44.5%
+-commutative44.5%
unpow244.5%
unpow244.5%
hypot-def78.0%
hypot-def44.5%
unpow244.5%
unpow244.5%
+-commutative44.5%
unpow244.5%
unpow244.5%
hypot-def78.0%
Simplified78.0%
Taylor expanded in y.re around 0 52.8%
rec-exp52.8%
associate-*r*52.8%
pow-base-152.8%
Simplified52.8%
if 7.79999999999999973e-277 < x.im Initial program 31.6%
Taylor expanded in y.im around 0 60.7%
Taylor expanded in x.re around 0 68.6%
*-commutative68.6%
Simplified68.6%
Final simplification60.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -6.5e+207)
(*
(pow x.im y.re)
(cos (- (* y.re (atan2 x.im x.re)) (* y.im (log (/ -1.0 x.re))))))
(*
(cos (* y.im (log (hypot x.im x.re))))
(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) {
double tmp;
if (y_46_re <= -6.5e+207) {
tmp = pow(x_46_im, y_46_re) * cos(((y_46_re * atan2(x_46_im, x_46_re)) - (y_46_im * log((-1.0 / x_46_re)))));
} else {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp((atan2(x_46_im, x_46_re) * -y_46_im));
}
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 <= -6.5e+207) {
tmp = Math.pow(x_46_im, y_46_re) * Math.cos(((y_46_re * Math.atan2(x_46_im, x_46_re)) - (y_46_im * Math.log((-1.0 / x_46_re)))));
} else {
tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) * Math.exp((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 y_46_re <= -6.5e+207: tmp = math.pow(x_46_im, y_46_re) * math.cos(((y_46_re * math.atan2(x_46_im, x_46_re)) - (y_46_im * math.log((-1.0 / x_46_re))))) else: tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) * math.exp((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 (y_46_re <= -6.5e+207) tmp = Float64((x_46_im ^ y_46_re) * cos(Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) - Float64(y_46_im * log(Float64(-1.0 / x_46_re)))))); else tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-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 (y_46_re <= -6.5e+207) tmp = (x_46_im ^ y_46_re) * cos(((y_46_re * atan2(x_46_im, x_46_re)) - (y_46_im * log((-1.0 / x_46_re))))); else tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp((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[y$46$re, -6.5e+207], N[(N[Power[x$46$im, y$46$re], $MachinePrecision] * N[Cos[N[(N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -6.5 \cdot 10^{+207}:\\
\;\;\;\;{x.im}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} - y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\end{array}
\end{array}
if y.re < -6.5000000000000001e207Initial program 45.0%
exp-diff40.0%
associate-*l/40.0%
*-rgt-identity40.0%
metadata-eval40.0%
associate-*l/40.0%
Simplified75.0%
Taylor expanded in x.re around 0 60.3%
Taylor expanded in x.re around -inf 40.2%
Taylor expanded in y.im around 0 45.2%
if -6.5000000000000001e207 < y.re Initial program 39.7%
exp-diff35.4%
associate-*l/35.4%
*-rgt-identity35.4%
metadata-eval35.4%
associate-*l/35.4%
Simplified71.1%
add-cube-cbrt71.1%
exp-prod71.1%
pow271.1%
Applied egg-rr71.1%
add-log-exp71.1%
Applied egg-rr71.1%
Taylor expanded in y.re around 0 35.5%
+-commutative35.5%
unpow235.5%
unpow235.5%
hypot-def73.7%
hypot-def35.5%
unpow235.5%
unpow235.5%
+-commutative35.5%
unpow235.5%
unpow235.5%
hypot-def73.7%
Simplified73.7%
Taylor expanded in y.re around 0 54.3%
rec-exp54.3%
associate-*r*54.3%
pow-base-154.3%
Simplified54.3%
Final simplification53.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (pow x.im y.re) (cos (- (* y.re (atan2 x.im x.re)) (* y.im (log (/ -1.0 x.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return pow(x_46_im, y_46_re) * cos(((y_46_re * atan2(x_46_im, x_46_re)) - (y_46_im * log((-1.0 / 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 = (x_46im ** y_46re) * cos(((y_46re * atan2(x_46im, x_46re)) - (y_46im * log(((-1.0d0) / 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(x_46_im, y_46_re) * Math.cos(((y_46_re * Math.atan2(x_46_im, x_46_re)) - (y_46_im * Math.log((-1.0 / x_46_re)))));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.pow(x_46_im, y_46_re) * math.cos(((y_46_re * math.atan2(x_46_im, x_46_re)) - (y_46_im * math.log((-1.0 / x_46_re)))))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64((x_46_im ^ y_46_re) * cos(Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) - Float64(y_46_im * log(Float64(-1.0 / x_46_re)))))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = (x_46_im ^ y_46_re) * cos(((y_46_re * atan2(x_46_im, x_46_re)) - (y_46_im * log((-1.0 / x_46_re))))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Power[x$46$im, y$46$re], $MachinePrecision] * N[Cos[N[(N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{x.im}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} - y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)
\end{array}
Initial program 40.1%
exp-diff35.8%
associate-*l/35.8%
*-rgt-identity35.8%
metadata-eval35.8%
associate-*l/35.8%
Simplified72.9%
Taylor expanded in x.re around 0 42.2%
Taylor expanded in x.re around -inf 19.6%
Taylor expanded in y.im around 0 16.4%
Final simplification16.4%
herbie shell --seed 2023301
(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)))))