
(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 9 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 (* y.re (atan2 x.im x.re))))
(if (<= y.re -2e+24)
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(cos (* y.im (log (hypot x.im x.re)))))
(if (<= y.re 1e-102)
(*
(/ (pow (hypot x.re x.im) y.re) (pow (exp y.im) (atan2 x.im x.re)))
(cos (pow (cbrt (fma y.im t_0 t_1)) 3.0)))
(*
(exp (fma t_0 y.re (* (atan2 x.im x.re) (- y.im))))
(cos (fma t_0 y.im t_1)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_re, x_46_im));
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_re <= -2e+24) {
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_im * log(hypot(x_46_im, x_46_re))));
} else if (y_46_re <= 1e-102) {
tmp = (pow(hypot(x_46_re, x_46_im), y_46_re) / pow(exp(y_46_im), atan2(x_46_im, x_46_re))) * cos(pow(cbrt(fma(y_46_im, t_0, t_1)), 3.0));
} else {
tmp = exp(fma(t_0, y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos(fma(t_0, y_46_im, t_1));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_re <= -2e+24) 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_im * log(hypot(x_46_im, x_46_re))))); elseif (y_46_re <= 1e-102) tmp = Float64(Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan(x_46_im, x_46_re))) * cos((cbrt(fma(y_46_im, t_0, t_1)) ^ 3.0))); else tmp = 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, t_1))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -2e+24], 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$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1e-102], N[(N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[Power[N[Power[N[(y$46$im * t$95$0 + t$95$1), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $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 + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.re \leq -2 \cdot 10^{+24}:\\
\;\;\;\;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.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{elif}\;y.re \leq 10^{-102}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left({\left(\sqrt[3]{\mathsf{fma}\left(y.im, t\_0, t\_1\right)}\right)}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;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, t\_1\right)\right)\\
\end{array}
\end{array}
if y.re < -2e24Initial program 37.3%
Taylor expanded in y.re around 0 44.1%
unpow244.1%
unpow244.1%
hypot-undefine88.1%
Simplified88.1%
if -2e24 < y.re < 9.99999999999999933e-103Initial program 40.2%
exp-diff40.2%
exp-to-pow40.2%
hypot-define40.2%
*-commutative40.2%
exp-prod40.2%
fma-define40.2%
hypot-define86.0%
*-commutative86.0%
Simplified86.0%
add-cube-cbrt94.4%
pow395.3%
fma-undefine95.3%
*-commutative95.3%
*-commutative95.3%
fma-define95.3%
Applied egg-rr95.3%
if 9.99999999999999933e-103 < y.re Initial program 44.6%
cancel-sign-sub-inv44.6%
fma-define44.6%
hypot-define44.6%
distribute-lft-neg-in44.6%
distribute-rgt-neg-out44.6%
fma-define44.6%
hypot-define82.4%
*-commutative82.4%
Simplified82.4%
Final simplification89.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im))) (t_1 (* (atan2 x.im x.re) (- y.im))))
(if (<= y.re -4.3e+24)
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(cos (* y.im (log (hypot x.im x.re)))))
(if (<= y.re 3e-39)
(exp t_1)
(*
(exp (fma t_0 y.re t_1))
(cos (fma t_0 y.im (* y.re (atan2 x.im x.re)))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_re, x_46_im));
double t_1 = atan2(x_46_im, x_46_re) * -y_46_im;
double tmp;
if (y_46_re <= -4.3e+24) {
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_im * log(hypot(x_46_im, x_46_re))));
} else if (y_46_re <= 3e-39) {
tmp = exp(t_1);
} else {
tmp = exp(fma(t_0, y_46_re, t_1)) * cos(fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) t_1 = Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)) tmp = 0.0 if (y_46_re <= -4.3e+24) 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_im * log(hypot(x_46_im, x_46_re))))); elseif (y_46_re <= 3e-39) tmp = exp(t_1); else tmp = Float64(exp(fma(t_0, y_46_re, t_1)) * cos(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re))))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]}, If[LessEqual[y$46$re, -4.3e+24], 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$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 3e-39], N[Exp[t$95$1], $MachinePrecision], N[(N[Exp[N[(t$95$0 * y$46$re + t$95$1), $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)\\
t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\\
\mathbf{if}\;y.re \leq -4.3 \cdot 10^{+24}:\\
\;\;\;\;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.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{elif}\;y.re \leq 3 \cdot 10^{-39}:\\
\;\;\;\;e^{t\_1}\\
\mathbf{else}:\\
\;\;\;\;e^{\mathsf{fma}\left(t\_0, y.re, t\_1\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}
if y.re < -4.29999999999999987e24Initial program 36.2%
Taylor expanded in y.re around 0 43.1%
unpow243.1%
unpow243.1%
hypot-undefine87.9%
Simplified87.9%
if -4.29999999999999987e24 < y.re < 3.00000000000000028e-39Initial program 40.0%
Taylor expanded in y.re around 0 40.0%
unpow240.0%
unpow240.0%
hypot-undefine51.2%
Simplified51.2%
Taylor expanded in y.im around 0 55.9%
Taylor expanded in y.re around 0 90.8%
*-commutative90.8%
distribute-rgt-neg-in90.8%
Simplified90.8%
if 3.00000000000000028e-39 < y.re Initial program 47.1%
cancel-sign-sub-inv47.1%
fma-define47.1%
hypot-define47.1%
distribute-lft-neg-in47.1%
distribute-rgt-neg-out47.1%
fma-define47.1%
hypot-define81.4%
*-commutative81.4%
Simplified81.4%
Final simplification87.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (* y.im (log x.re)))
(t_2 (* (atan2 x.im x.re) y.im))
(t_3 (pow (hypot x.re x.im) y.re)))
(if (<= x.re -4.1e-35)
(*
(cos (* y.im (log (hypot x.im x.re))))
(exp (- (* y.re (log (- x.re))) t_2)))
(if (<= x.re -2.9e-267)
(*
(/ t_3 (pow (exp y.im) (atan2 x.im x.re)))
(cos (- t_0 (* y.im (log (/ -1.0 x.re))))))
(if (<= x.re 2.15e-306)
t_3
(if (<= x.re 2.4e-250)
(* (exp (- (* y.re (log x.re)) t_2)) (cos t_1))
(*
(exp
(fma (log (hypot x.re x.im)) y.re (* (atan2 x.im x.re) (- y.im))))
(cos (+ t_0 t_1)))))))))
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 t_1 = y_46_im * log(x_46_re);
double t_2 = atan2(x_46_im, x_46_re) * y_46_im;
double t_3 = pow(hypot(x_46_re, x_46_im), y_46_re);
double tmp;
if (x_46_re <= -4.1e-35) {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(((y_46_re * log(-x_46_re)) - t_2));
} else if (x_46_re <= -2.9e-267) {
tmp = (t_3 / pow(exp(y_46_im), atan2(x_46_im, x_46_re))) * cos((t_0 - (y_46_im * log((-1.0 / x_46_re)))));
} else if (x_46_re <= 2.15e-306) {
tmp = t_3;
} else if (x_46_re <= 2.4e-250) {
tmp = exp(((y_46_re * log(x_46_re)) - t_2)) * cos(t_1);
} else {
tmp = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos((t_0 + t_1));
}
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)) t_1 = Float64(y_46_im * log(x_46_re)) t_2 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_3 = hypot(x_46_re, x_46_im) ^ y_46_re tmp = 0.0 if (x_46_re <= -4.1e-35) tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(Float64(Float64(y_46_re * log(Float64(-x_46_re))) - t_2))); elseif (x_46_re <= -2.9e-267) tmp = Float64(Float64(t_3 / (exp(y_46_im) ^ atan(x_46_im, x_46_re))) * cos(Float64(t_0 - Float64(y_46_im * log(Float64(-1.0 / x_46_re)))))); elseif (x_46_re <= 2.15e-306) tmp = t_3; elseif (x_46_re <= 2.4e-250) tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_re)) - t_2)) * cos(t_1)); else tmp = Float64(exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cos(Float64(t_0 + t_1))); 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]}, Block[{t$95$1 = N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, If[LessEqual[x$46$re, -4.1e-35], 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[(y$46$re * N[Log[(-x$46$re)], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, -2.9e-267], N[(N[(t$95$3 / N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(t$95$0 - N[(y$46$im * N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 2.15e-306], t$95$3, If[LessEqual[x$46$re, 2.4e-250], N[(N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * 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 + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := y.im \cdot \log x.re\\
t_2 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_3 := {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
\mathbf{if}\;x.re \leq -4.1 \cdot 10^{-35}:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot e^{y.re \cdot \log \left(-x.re\right) - t\_2}\\
\mathbf{elif}\;x.re \leq -2.9 \cdot 10^{-267}:\\
\;\;\;\;\frac{t\_3}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(t\_0 - y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)\\
\mathbf{elif}\;x.re \leq 2.15 \cdot 10^{-306}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;x.re \leq 2.4 \cdot 10^{-250}:\\
\;\;\;\;e^{y.re \cdot \log x.re - t\_2} \cdot \cos t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \cdot \cos \left(t\_0 + t\_1\right)\\
\end{array}
\end{array}
if x.re < -4.10000000000000026e-35Initial program 28.6%
Taylor expanded in y.re around 0 28.3%
unpow228.3%
unpow228.3%
hypot-undefine61.2%
Simplified61.2%
Taylor expanded in x.re around -inf 84.3%
mul-1-neg84.3%
Simplified84.3%
if -4.10000000000000026e-35 < x.re < -2.90000000000000021e-267Initial program 45.4%
exp-diff38.6%
exp-to-pow38.6%
hypot-define38.6%
*-commutative38.6%
exp-prod38.6%
fma-define38.6%
hypot-define70.4%
*-commutative70.4%
Simplified70.4%
Taylor expanded in x.re around -inf 79.5%
+-commutative79.5%
mul-1-neg79.5%
unsub-neg79.5%
Simplified79.5%
if -2.90000000000000021e-267 < x.re < 2.15e-306Initial program 30.0%
Taylor expanded in y.re around 0 50.0%
unpow250.0%
unpow250.0%
hypot-undefine80.5%
Simplified80.5%
Taylor expanded in y.im around 0 80.5%
Taylor expanded in y.im around 0 80.5%
+-commutative80.5%
unpow280.5%
unpow280.5%
hypot-undefine90.3%
Simplified90.3%
if 2.15e-306 < x.re < 2.3999999999999999e-250Initial program 41.7%
Taylor expanded in y.re around 0 50.0%
unpow250.0%
unpow250.0%
hypot-undefine67.2%
Simplified67.2%
Taylor expanded in x.re around inf 83.3%
Taylor expanded in x.im around 0 91.7%
if 2.3999999999999999e-250 < x.re Initial program 50.1%
cancel-sign-sub-inv50.1%
fma-define50.1%
hypot-define50.1%
distribute-lft-neg-in50.1%
distribute-rgt-neg-out50.1%
fma-define50.1%
hypot-define88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in x.im around 0 94.5%
Final simplification88.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (- x.re))) (t_1 (* (atan2 x.im x.re) y.im)))
(if (<= x.re -4.8e-176)
(* (cos (* y.im (log (hypot x.im x.re)))) (exp (- (* y.re t_0) t_1)))
(if (<= x.re -1e-311)
(*
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_1))
(cos (* y.im t_0)))
(*
(exp (fma (log (hypot x.re x.im)) y.re (* (atan2 x.im x.re) (- y.im))))
(cos (+ (* y.re (atan2 x.im x.re)) (* 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 = log(-x_46_re);
double t_1 = atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_re <= -4.8e-176) {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(((y_46_re * t_0) - t_1));
} else if (x_46_re <= -1e-311) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_1)) * cos((y_46_im * t_0));
} else {
tmp = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos(((y_46_re * atan2(x_46_im, x_46_re)) + (y_46_im * log(x_46_re))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(Float64(-x_46_re)) t_1 = Float64(atan(x_46_im, x_46_re) * y_46_im) tmp = 0.0 if (x_46_re <= -4.8e-176) tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(Float64(Float64(y_46_re * t_0) - t_1))); elseif (x_46_re <= -1e-311) 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))))) - t_1)) * cos(Float64(y_46_im * t_0))); else tmp = Float64(exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cos(Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) + Float64(y_46_im * log(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[(-x$46$re)], $MachinePrecision]}, Block[{t$95$1 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, If[LessEqual[x$46$re, -4.8e-176], 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[(y$46$re * t$95$0), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, -1e-311], 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] - t$95$1), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] + N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(-x.re\right)\\
t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.re \leq -4.8 \cdot 10^{-176}:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot e^{y.re \cdot t\_0 - t\_1}\\
\mathbf{elif}\;x.re \leq -1 \cdot 10^{-311}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t\_1} \cdot \cos \left(y.im \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.re\right)\\
\end{array}
\end{array}
if x.re < -4.80000000000000012e-176Initial program 34.2%
Taylor expanded in y.re around 0 34.9%
unpow234.9%
unpow234.9%
hypot-undefine61.9%
Simplified61.9%
Taylor expanded in x.re around -inf 81.3%
mul-1-neg81.3%
Simplified81.3%
if -4.80000000000000012e-176 < x.re < -9.99999999999948e-312Initial program 31.7%
Taylor expanded in x.re around -inf 68.7%
mul-1-neg57.8%
Simplified68.7%
Taylor expanded in y.re around 0 77.8%
if -9.99999999999948e-312 < x.re Initial program 49.3%
cancel-sign-sub-inv49.3%
fma-define49.3%
hypot-define49.3%
distribute-lft-neg-in49.3%
distribute-rgt-neg-out49.3%
fma-define49.3%
hypot-define86.8%
*-commutative86.8%
Simplified86.8%
Taylor expanded in x.im around 0 92.6%
Final simplification86.3%
(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.im -3.6e-11)
(*
(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.im 10800000.0)
(* t_0 (pow (hypot x.im x.re) y.re))
(* t_0 (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 t_0 = cos((y_46_im * log(hypot(x_46_im, x_46_re))));
double tmp;
if (y_46_im <= -3.6e-11) {
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_im <= 10800000.0) {
tmp = t_0 * pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = t_0 * 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 t_0 = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))));
double tmp;
if (y_46_im <= -3.6e-11) {
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_im <= 10800000.0) {
tmp = t_0 * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = t_0 * 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): t_0 = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) tmp = 0 if y_46_im <= -3.6e-11: 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_im <= 10800000.0: tmp = t_0 * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = t_0 * 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) t_0 = cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) tmp = 0.0 if (y_46_im <= -3.6e-11) 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_im <= 10800000.0) tmp = Float64(t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re)); else tmp = Float64(t_0 * 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) t_0 = cos((y_46_im * log(hypot(x_46_im, x_46_re)))); tmp = 0.0; if (y_46_im <= -3.6e-11) 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_im <= 10800000.0) tmp = t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re); else tmp = t_0 * 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_] := 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$im, -3.6e-11], 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$im, 10800000.0], N[(t$95$0 * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $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)\\
\mathbf{if}\;y.im \leq -3.6 \cdot 10^{-11}:\\
\;\;\;\;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.im \leq 10800000:\\
\;\;\;\;t\_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\end{array}
\end{array}
if y.im < -3.59999999999999985e-11Initial program 41.1%
Taylor expanded in y.im around 0 70.2%
if -3.59999999999999985e-11 < y.im < 1.08e7Initial program 41.5%
exp-diff41.5%
exp-to-pow41.5%
hypot-define41.5%
*-commutative41.5%
exp-prod41.5%
fma-define41.5%
hypot-define87.7%
*-commutative87.7%
Simplified87.7%
Taylor expanded in y.im around 0 60.1%
unpow260.1%
unpow260.1%
hypot-undefine88.5%
Simplified88.5%
Taylor expanded in y.im around inf 43.2%
unpow243.2%
unpow243.2%
hypot-undefine93.2%
Simplified93.2%
if 1.08e7 < y.im Initial program 40.0%
cancel-sign-sub-inv40.0%
fma-define40.0%
hypot-define40.0%
distribute-lft-neg-in40.0%
distribute-rgt-neg-out40.0%
fma-define40.0%
hypot-define81.7%
*-commutative81.7%
Simplified81.7%
Taylor expanded in y.re around 0 76.8%
neg-mul-176.8%
distribute-rgt-neg-in76.8%
Simplified76.8%
Taylor expanded in y.im around inf 35.1%
unpow214.1%
unpow214.1%
hypot-undefine31.6%
Simplified80.1%
Final simplification84.2%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -4.3e+24) (not (<= y.re 115000.0))) (* (cos (* y.im (log (hypot x.im x.re)))) (pow (hypot x.im x.re) y.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 <= -4.3e+24) || !(y_46_re <= 115000.0)) {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = 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 <= -4.3e+24) || !(y_46_re <= 115000.0)) {
tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = 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 <= -4.3e+24) or not (y_46_re <= 115000.0): tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = 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 <= -4.3e+24) || !(y_46_re <= 115000.0)) tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * (hypot(x_46_im, x_46_re) ^ y_46_re)); else tmp = 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 <= -4.3e+24) || ~((y_46_re <= 115000.0))) tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * (hypot(x_46_im, x_46_re) ^ y_46_re); else tmp = 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, -4.3e+24], N[Not[LessEqual[y$46$re, 115000.0]], $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[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -4.3 \cdot 10^{+24} \lor \neg \left(y.re \leq 115000\right):\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\end{array}
\end{array}
if y.re < -4.29999999999999987e24 or 115000 < y.re Initial program 41.9%
exp-diff33.3%
exp-to-pow33.3%
hypot-define33.3%
*-commutative33.3%
exp-prod31.6%
fma-define31.6%
hypot-define61.5%
*-commutative61.5%
Simplified61.5%
Taylor expanded in y.im around 0 74.5%
unpow274.5%
unpow274.5%
hypot-undefine74.5%
Simplified74.5%
Taylor expanded in y.im around inf 40.3%
unpow240.3%
unpow240.3%
hypot-undefine80.4%
Simplified80.4%
if -4.29999999999999987e24 < y.re < 115000Initial program 40.4%
Taylor expanded in y.re around 0 39.7%
unpow239.7%
unpow239.7%
hypot-undefine50.2%
Simplified50.2%
Taylor expanded in y.im around 0 53.8%
Taylor expanded in y.re around 0 89.2%
*-commutative89.2%
distribute-rgt-neg-in89.2%
Simplified89.2%
Final simplification85.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -4.3e+24)
(pow (hypot x.re x.im) y.re)
(if (<= y.re 290000.0)
(exp (* (atan2 x.im x.re) (- y.im)))
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im 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 (y_46_re <= -4.3e+24) {
tmp = pow(hypot(x_46_re, x_46_im), y_46_re);
} else if (y_46_re <= 290000.0) {
tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else {
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)));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -4.3e+24) {
tmp = Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re);
} else if (y_46_re <= 290000.0) {
tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
} else {
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)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -4.3e+24: tmp = math.pow(math.hypot(x_46_re, x_46_im), y_46_re) elif y_46_re <= 290000.0: tmp = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) else: 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))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -4.3e+24) tmp = hypot(x_46_re, x_46_im) ^ y_46_re; elseif (y_46_re <= 290000.0) tmp = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im))); else tmp = 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))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -4.3e+24) tmp = hypot(x_46_re, x_46_im) ^ y_46_re; elseif (y_46_re <= 290000.0) tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im)); else 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))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -4.3e+24], N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], If[LessEqual[y$46$re, 290000.0], 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[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]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -4.3 \cdot 10^{+24}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
\mathbf{elif}\;y.re \leq 290000:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;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}\\
\end{array}
\end{array}
if y.re < -4.29999999999999987e24Initial program 36.2%
Taylor expanded in y.re around 0 43.1%
unpow243.1%
unpow243.1%
hypot-undefine87.9%
Simplified87.9%
Taylor expanded in y.im around 0 84.5%
Taylor expanded in y.im around 0 84.6%
+-commutative84.6%
unpow284.6%
unpow284.6%
hypot-undefine84.6%
Simplified84.6%
if -4.29999999999999987e24 < y.re < 2.9e5Initial program 40.4%
Taylor expanded in y.re around 0 39.7%
unpow239.7%
unpow239.7%
hypot-undefine50.2%
Simplified50.2%
Taylor expanded in y.im around 0 53.8%
Taylor expanded in y.re around 0 89.2%
*-commutative89.2%
distribute-rgt-neg-in89.2%
Simplified89.2%
if 2.9e5 < y.re Initial program 47.5%
Taylor expanded in y.re around 0 44.1%
unpow244.1%
unpow244.1%
hypot-undefine79.7%
Simplified79.7%
Taylor expanded in y.im around 0 74.7%
Final simplification84.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -4.3e+24) (not (<= y.re 2.15e+18))) (pow (hypot x.re x.im) y.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 <= -4.3e+24) || !(y_46_re <= 2.15e+18)) {
tmp = pow(hypot(x_46_re, x_46_im), y_46_re);
} else {
tmp = 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 <= -4.3e+24) || !(y_46_re <= 2.15e+18)) {
tmp = Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re);
} else {
tmp = 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 <= -4.3e+24) or not (y_46_re <= 2.15e+18): tmp = math.pow(math.hypot(x_46_re, x_46_im), y_46_re) else: tmp = 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 <= -4.3e+24) || !(y_46_re <= 2.15e+18)) tmp = hypot(x_46_re, x_46_im) ^ y_46_re; else tmp = 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 <= -4.3e+24) || ~((y_46_re <= 2.15e+18))) tmp = hypot(x_46_re, x_46_im) ^ y_46_re; else tmp = 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, -4.3e+24], N[Not[LessEqual[y$46$re, 2.15e+18]], $MachinePrecision]], N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -4.3 \cdot 10^{+24} \lor \neg \left(y.re \leq 2.15 \cdot 10^{+18}\right):\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\end{array}
\end{array}
if y.re < -4.29999999999999987e24 or 2.15e18 < y.re Initial program 41.9%
Taylor expanded in y.re around 0 43.6%
unpow243.6%
unpow243.6%
hypot-undefine83.8%
Simplified83.8%
Taylor expanded in y.im around 0 79.5%
Taylor expanded in y.im around 0 77.9%
+-commutative77.9%
unpow277.9%
unpow277.9%
hypot-undefine77.9%
Simplified77.9%
if -4.29999999999999987e24 < y.re < 2.15e18Initial program 40.4%
Taylor expanded in y.re around 0 39.7%
unpow239.7%
unpow239.7%
hypot-undefine50.2%
Simplified50.2%
Taylor expanded in y.im around 0 53.8%
Taylor expanded in y.re around 0 89.2%
*-commutative89.2%
distribute-rgt-neg-in89.2%
Simplified89.2%
Final simplification84.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (pow (hypot x.re x.im) y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return pow(hypot(x_46_re, x_46_im), y_46_re);
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.pow(math.hypot(x_46_re, x_46_im), y_46_re)
function code(x_46_re, x_46_im, y_46_re, y_46_im) return hypot(x_46_re, x_46_im) ^ y_46_re end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = hypot(x_46_re, x_46_im) ^ y_46_re; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]
\begin{array}{l}
\\
{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}
\end{array}
Initial program 41.1%
Taylor expanded in y.re around 0 41.5%
unpow241.5%
unpow241.5%
hypot-undefine65.5%
Simplified65.5%
Taylor expanded in y.im around 0 65.5%
Taylor expanded in y.im around 0 55.2%
+-commutative55.2%
unpow255.2%
unpow255.2%
hypot-undefine64.0%
Simplified64.0%
Final simplification64.0%
herbie shell --seed 2024062
(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)))))