
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.re -0.00037) (not (<= y.re 5.4e-56)))
(*
(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)))))
(*
(cos (fma (log (hypot x.re x.im)) y.im (* y.re (atan2 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 <= -0.00037) || !(y_46_re <= 5.4e-56)) {
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 {
tmp = cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, (y_46_re * atan2(x_46_im, x_46_re)))) * exp((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 <= -0.00037) || !(y_46_re <= 5.4e-56)) 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))))); else tmp = Float64(cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re)))) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$re, -0.00037], N[Not[LessEqual[y$46$re, 5.4e-56]], $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$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $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 -0.00037 \lor \neg \left(y.re \leq 5.4 \cdot 10^{-56}\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.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\end{array}
\end{array}
if y.re < -3.6999999999999999e-4 or 5.3999999999999999e-56 < y.re Initial program 42.0%
Taylor expanded in y.re around 0 46.2%
unpow246.2%
unpow246.2%
hypot-undefine82.6%
Simplified82.6%
if -3.6999999999999999e-4 < y.re < 5.3999999999999999e-56Initial program 37.0%
exp-diff37.0%
exp-to-pow37.0%
hypot-define37.0%
*-commutative37.0%
exp-prod36.2%
fma-define36.2%
hypot-define87.7%
*-commutative87.7%
Simplified87.7%
Taylor expanded in y.re around 0 88.5%
rec-exp88.5%
distribute-lft-neg-in88.5%
Simplified88.5%
Final simplification85.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im))))
(if (<= y.re 5e+40)
(*
(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)))))
(*
(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))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_re, x_46_im));
double tmp;
if (y_46_re <= 5e+40) {
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, (y_46_re * atan2(x_46_im, x_46_re))));
} 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))) * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) tmp = 0.0 if (y_46_re <= 5e+40) 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, Float64(y_46_re * atan(x_46_im, x_46_re))))); else 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))))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, 5e+40], 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], 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]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
\mathbf{if}\;y.re \leq 5 \cdot 10^{+40}:\\
\;\;\;\;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)\\
\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} \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 < 5.00000000000000003e40Initial program 41.6%
fmm-def41.6%
hypot-define41.6%
distribute-rgt-neg-out41.6%
fma-define41.6%
hypot-define87.3%
*-commutative87.3%
Simplified87.3%
if 5.00000000000000003e40 < y.re Initial program 32.7%
Taylor expanded in y.re around 0 38.5%
unpow238.5%
unpow238.5%
hypot-undefine76.9%
Simplified76.9%
Final simplification85.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))) (t_1 (pow (hypot x.im x.re) y.re)))
(if (<= y.re -0.00092)
t_1
(if (<= y.re 1.72)
(*
(cos (fma (log (hypot x.re x.im)) y.im t_0))
(exp (* (atan2 x.im x.re) (- y.im))))
(* t_1 (- 1.0 (* (* y.im (log (hypot x.im x.re))) (sin t_0))))))))
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 = pow(hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if (y_46_re <= -0.00092) {
tmp = t_1;
} else if (y_46_re <= 1.72) {
tmp = cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_0)) * exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = t_1 * (1.0 - ((y_46_im * log(hypot(x_46_im, x_46_re))) * sin(t_0)));
}
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 = hypot(x_46_im, x_46_re) ^ y_46_re tmp = 0.0 if (y_46_re <= -0.00092) tmp = t_1; elseif (y_46_re <= 1.72) tmp = Float64(cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_0)) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))); else tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(y_46_im * log(hypot(x_46_im, x_46_re))) * sin(t_0)))); 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[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, If[LessEqual[y$46$re, -0.00092], t$95$1, If[LessEqual[y$46$re, 1.72], 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[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(1.0 - N[(N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{if}\;y.re \leq -0.00092:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.re \leq 1.72:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t\_0\right)\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(1 - \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot \sin t\_0\right)\\
\end{array}
\end{array}
if y.re < -9.2000000000000003e-4Initial program 45.6%
exp-diff35.4%
exp-to-pow35.4%
hypot-define35.4%
*-commutative35.4%
exp-prod32.9%
fma-define32.9%
hypot-define65.8%
*-commutative65.8%
Simplified65.8%
Taylor expanded in y.im around 0 79.9%
unpow279.9%
unpow279.9%
hypot-undefine79.9%
Simplified79.9%
Taylor expanded in y.im around 0 79.9%
Taylor expanded in y.re around 0 85.0%
if -9.2000000000000003e-4 < y.re < 1.71999999999999997Initial program 39.3%
exp-diff39.3%
exp-to-pow39.3%
hypot-define39.3%
*-commutative39.3%
exp-prod38.6%
fma-define38.6%
hypot-define87.5%
*-commutative87.5%
Simplified87.5%
Taylor expanded in y.re around 0 88.2%
rec-exp88.2%
distribute-lft-neg-in88.2%
Simplified88.2%
if 1.71999999999999997 < y.re Initial program 32.8%
exp-diff19.0%
exp-to-pow19.0%
hypot-define19.0%
*-commutative19.0%
exp-prod17.2%
fma-define17.2%
hypot-define41.4%
*-commutative41.4%
Simplified41.4%
Taylor expanded in y.im around 0 55.3%
unpow255.3%
unpow255.3%
hypot-undefine55.3%
Simplified55.3%
Taylor expanded in y.im around 0 48.4%
mul-1-neg48.4%
unsub-neg48.4%
associate-*r*48.4%
unpow248.4%
unpow248.4%
hypot-undefine58.8%
Simplified58.8%
Taylor expanded in y.re around 0 69.1%
Final simplification82.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))) (t_1 (pow (hypot x.im x.re) y.re)))
(if (<= y.re -8.2)
t_1
(if (<= y.re 1.85)
(* (cos t_0) (pow (exp (- y.im)) (atan2 x.im x.re)))
(* t_1 (- 1.0 (* (* y.im (log (hypot x.im x.re))) (sin t_0))))))))
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 = pow(hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if (y_46_re <= -8.2) {
tmp = t_1;
} else if (y_46_re <= 1.85) {
tmp = cos(t_0) * pow(exp(-y_46_im), atan2(x_46_im, x_46_re));
} else {
tmp = t_1 * (1.0 - ((y_46_im * log(hypot(x_46_im, x_46_re))) * sin(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 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if (y_46_re <= -8.2) {
tmp = t_1;
} else if (y_46_re <= 1.85) {
tmp = Math.cos(t_0) * Math.pow(Math.exp(-y_46_im), Math.atan2(x_46_im, x_46_re));
} else {
tmp = t_1 * (1.0 - ((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))) * Math.sin(t_0)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) t_1 = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) tmp = 0 if y_46_re <= -8.2: tmp = t_1 elif y_46_re <= 1.85: tmp = math.cos(t_0) * math.pow(math.exp(-y_46_im), math.atan2(x_46_im, x_46_re)) else: tmp = t_1 * (1.0 - ((y_46_im * math.log(math.hypot(x_46_im, x_46_re))) * math.sin(t_0))) 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 = hypot(x_46_im, x_46_re) ^ y_46_re tmp = 0.0 if (y_46_re <= -8.2) tmp = t_1; elseif (y_46_re <= 1.85) tmp = Float64(cos(t_0) * (exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re))); else tmp = Float64(t_1 * Float64(1.0 - Float64(Float64(y_46_im * log(hypot(x_46_im, x_46_re))) * sin(t_0)))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); t_1 = hypot(x_46_im, x_46_re) ^ y_46_re; tmp = 0.0; if (y_46_re <= -8.2) tmp = t_1; elseif (y_46_re <= 1.85) tmp = cos(t_0) * (exp(-y_46_im) ^ atan2(x_46_im, x_46_re)); else tmp = t_1 * (1.0 - ((y_46_im * log(hypot(x_46_im, x_46_re))) * sin(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[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, If[LessEqual[y$46$re, -8.2], t$95$1, If[LessEqual[y$46$re, 1.85], N[(N[Cos[t$95$0], $MachinePrecision] * N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(1.0 - N[(N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{if}\;y.re \leq -8.2:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.re \leq 1.85:\\
\;\;\;\;\cos t\_0 \cdot {\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \left(1 - \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot \sin t\_0\right)\\
\end{array}
\end{array}
if y.re < -8.1999999999999993Initial program 45.6%
exp-diff35.4%
exp-to-pow35.4%
hypot-define35.4%
*-commutative35.4%
exp-prod32.9%
fma-define32.9%
hypot-define65.8%
*-commutative65.8%
Simplified65.8%
Taylor expanded in y.im around 0 79.9%
unpow279.9%
unpow279.9%
hypot-undefine79.9%
Simplified79.9%
Taylor expanded in y.im around 0 79.9%
Taylor expanded in y.re around 0 85.0%
if -8.1999999999999993 < y.re < 1.8500000000000001Initial program 39.3%
exp-diff39.3%
exp-to-pow39.3%
hypot-define39.3%
*-commutative39.3%
exp-prod38.6%
fma-define38.6%
hypot-define87.5%
*-commutative87.5%
Simplified87.5%
Taylor expanded in y.re around 0 88.2%
rec-exp88.2%
distribute-lft-neg-in88.2%
exp-prod87.5%
Simplified87.5%
Taylor expanded in y.im around 0 86.1%
if 1.8500000000000001 < y.re Initial program 32.8%
exp-diff19.0%
exp-to-pow19.0%
hypot-define19.0%
*-commutative19.0%
exp-prod17.2%
fma-define17.2%
hypot-define41.4%
*-commutative41.4%
Simplified41.4%
Taylor expanded in y.im around 0 55.3%
unpow255.3%
unpow255.3%
hypot-undefine55.3%
Simplified55.3%
Taylor expanded in y.im around 0 48.4%
mul-1-neg48.4%
unsub-neg48.4%
associate-*r*48.4%
unpow248.4%
unpow248.4%
hypot-undefine58.8%
Simplified58.8%
Taylor expanded in y.re around 0 69.1%
Final simplification81.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))) (t_1 (cos t_0)))
(if (<= y.im -2.3e+27)
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
t_1)
(if (<= y.im 5e+114)
(*
(pow (hypot x.im x.re) y.re)
(- 1.0 (* (* y.im (log (hypot x.im x.re))) (sin t_0))))
(* t_1 (pow (exp (- y.im)) (atan2 x.im x.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = cos(t_0);
double tmp;
if (y_46_im <= -2.3e+27) {
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))) * t_1;
} else if (y_46_im <= 5e+114) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re) * (1.0 - ((y_46_im * log(hypot(x_46_im, x_46_re))) * sin(t_0)));
} else {
tmp = t_1 * pow(exp(-y_46_im), atan2(x_46_im, x_46_re));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.cos(t_0);
double tmp;
if (y_46_im <= -2.3e+27) {
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))) * t_1;
} else if (y_46_im <= 5e+114) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re) * (1.0 - ((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))) * Math.sin(t_0)));
} else {
tmp = t_1 * Math.pow(Math.exp(-y_46_im), Math.atan2(x_46_im, x_46_re));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) t_1 = math.cos(t_0) tmp = 0 if y_46_im <= -2.3e+27: 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))) * t_1 elif y_46_im <= 5e+114: tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) * (1.0 - ((y_46_im * math.log(math.hypot(x_46_im, x_46_re))) * math.sin(t_0))) else: tmp = t_1 * math.pow(math.exp(-y_46_im), math.atan2(x_46_im, x_46_re)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = cos(t_0) tmp = 0.0 if (y_46_im <= -2.3e+27) 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))) * t_1); elseif (y_46_im <= 5e+114) tmp = Float64((hypot(x_46_im, x_46_re) ^ y_46_re) * Float64(1.0 - Float64(Float64(y_46_im * log(hypot(x_46_im, x_46_re))) * sin(t_0)))); else tmp = Float64(t_1 * (exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); t_1 = cos(t_0); tmp = 0.0; if (y_46_im <= -2.3e+27) 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))) * t_1; elseif (y_46_im <= 5e+114) tmp = (hypot(x_46_im, x_46_re) ^ y_46_re) * (1.0 - ((y_46_im * log(hypot(x_46_im, x_46_re))) * sin(t_0))); else tmp = t_1 * (exp(-y_46_im) ^ atan2(x_46_im, x_46_re)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[t$95$0], $MachinePrecision]}, If[LessEqual[y$46$im, -2.3e+27], 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] * t$95$1), $MachinePrecision], If[LessEqual[y$46$im, 5e+114], N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[(1.0 - N[(N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \cos t\_0\\
\mathbf{if}\;y.im \leq -2.3 \cdot 10^{+27}:\\
\;\;\;\;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 t\_1\\
\mathbf{elif}\;y.im \leq 5 \cdot 10^{+114}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \left(1 - \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot \sin t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot {\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}\\
\end{array}
\end{array}
if y.im < -2.3000000000000001e27Initial program 52.7%
Taylor expanded in y.im around 0 80.1%
if -2.3000000000000001e27 < y.im < 5.0000000000000001e114Initial program 37.6%
exp-diff35.2%
exp-to-pow35.2%
hypot-define35.2%
*-commutative35.2%
exp-prod34.1%
fma-define34.1%
hypot-define79.0%
*-commutative79.0%
Simplified79.0%
Taylor expanded in y.im around 0 56.4%
unpow256.4%
unpow256.4%
hypot-undefine78.4%
Simplified78.4%
Taylor expanded in y.im around 0 41.8%
mul-1-neg41.8%
unsub-neg41.8%
associate-*r*41.8%
unpow241.8%
unpow241.8%
hypot-undefine79.8%
Simplified79.8%
Taylor expanded in y.re around 0 85.8%
if 5.0000000000000001e114 < y.im Initial program 29.4%
exp-diff17.6%
exp-to-pow17.6%
hypot-define17.6%
*-commutative17.6%
exp-prod14.7%
fma-define14.7%
hypot-define50.1%
*-commutative50.1%
Simplified50.1%
Taylor expanded in y.re around 0 65.2%
rec-exp65.2%
distribute-lft-neg-in65.2%
exp-prod68.0%
Simplified68.0%
Taylor expanded in y.im around 0 70.9%
Final simplification82.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.im -100000.0) (not (<= y.im 8e+90)))
(* (cos (* y.re (atan2 x.im x.re))) (pow (exp (- y.im)) (atan2 x.im x.re)))
(*
(pow (hypot x.im x.re) y.re)
(fabs (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 tmp;
if ((y_46_im <= -100000.0) || !(y_46_im <= 8e+90)) {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * pow(exp(-y_46_im), atan2(x_46_im, x_46_re));
} else {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re) * fabs(cos((y_46_im * log(hypot(x_46_im, x_46_re)))));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -100000.0) || !(y_46_im <= 8e+90)) {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.pow(Math.exp(-y_46_im), Math.atan2(x_46_im, x_46_re));
} else {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re) * Math.abs(Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_im <= -100000.0) or not (y_46_im <= 8e+90): tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.pow(math.exp(-y_46_im), math.atan2(x_46_im, x_46_re)) else: tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) * math.fabs(math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re))))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -100000.0) || !(y_46_im <= 8e+90)) tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * (exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re))); else tmp = Float64((hypot(x_46_im, x_46_re) ^ y_46_re) * abs(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_im <= -100000.0) || ~((y_46_im <= 8e+90))) tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * (exp(-y_46_im) ^ atan2(x_46_im, x_46_re)); else tmp = (hypot(x_46_im, x_46_re) ^ y_46_re) * abs(cos((y_46_im * log(hypot(x_46_im, x_46_re))))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -100000.0], N[Not[LessEqual[y$46$im, 8e+90]], $MachinePrecision]], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[Abs[N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -100000 \lor \neg \left(y.im \leq 8 \cdot 10^{+90}\right):\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \left|\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\right|\\
\end{array}
\end{array}
if y.im < -1e5 or 7.99999999999999973e90 < y.im Initial program 42.7%
exp-diff30.2%
exp-to-pow30.2%
hypot-define30.2%
*-commutative30.2%
exp-prod28.1%
fma-define28.1%
hypot-define54.4%
*-commutative54.4%
Simplified54.4%
Taylor expanded in y.re around 0 63.1%
rec-exp63.1%
distribute-lft-neg-in63.1%
exp-prod64.0%
Simplified64.0%
Taylor expanded in y.im around 0 68.0%
if -1e5 < y.im < 7.99999999999999973e90Initial program 38.0%
exp-diff35.5%
exp-to-pow35.5%
hypot-define35.5%
*-commutative35.5%
exp-prod34.3%
fma-define34.3%
hypot-define79.9%
*-commutative79.9%
Simplified79.9%
Taylor expanded in y.im around 0 57.0%
unpow257.0%
unpow257.0%
hypot-undefine80.6%
Simplified80.6%
fma-undefine80.6%
hypot-define35.0%
+-commutative35.0%
hypot-undefine80.6%
hypot-undefine35.0%
+-commutative35.0%
*-commutative35.0%
expm1-log1p-u31.8%
add-sqr-sqrt26.6%
sqrt-unprod30.5%
Applied egg-rr85.6%
unpow285.6%
rem-sqrt-square85.6%
Simplified85.6%
Taylor expanded in y.re around 0 37.4%
unpow237.4%
unpow237.4%
hypot-undefine85.6%
Simplified85.6%
Final simplification79.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.im -480000000000.0) (not (<= y.im 9.5e+91))) (* (cos (* y.re (atan2 x.im x.re))) (pow (exp (- y.im)) (atan2 x.im x.re))) (pow (hypot x.im x.re) y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -480000000000.0) || !(y_46_im <= 9.5e+91)) {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * pow(exp(-y_46_im), atan2(x_46_im, x_46_re));
} else {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -480000000000.0) || !(y_46_im <= 9.5e+91)) {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.pow(Math.exp(-y_46_im), Math.atan2(x_46_im, x_46_re));
} else {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_im <= -480000000000.0) or not (y_46_im <= 9.5e+91): tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.pow(math.exp(-y_46_im), math.atan2(x_46_im, x_46_re)) else: tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -480000000000.0) || !(y_46_im <= 9.5e+91)) tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * (exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re))); else tmp = hypot(x_46_im, x_46_re) ^ y_46_re; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_im <= -480000000000.0) || ~((y_46_im <= 9.5e+91))) tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * (exp(-y_46_im) ^ atan2(x_46_im, x_46_re)); else tmp = hypot(x_46_im, x_46_re) ^ y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -480000000000.0], N[Not[LessEqual[y$46$im, 9.5e+91]], $MachinePrecision]], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -480000000000 \lor \neg \left(y.im \leq 9.5 \cdot 10^{+91}\right):\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.im < -4.8e11 or 9.5000000000000001e91 < y.im Initial program 42.7%
exp-diff30.2%
exp-to-pow30.2%
hypot-define30.2%
*-commutative30.2%
exp-prod28.1%
fma-define28.1%
hypot-define54.4%
*-commutative54.4%
Simplified54.4%
Taylor expanded in y.re around 0 63.1%
rec-exp63.1%
distribute-lft-neg-in63.1%
exp-prod64.0%
Simplified64.0%
Taylor expanded in y.im around 0 68.0%
if -4.8e11 < y.im < 9.5000000000000001e91Initial program 38.0%
exp-diff35.5%
exp-to-pow35.5%
hypot-define35.5%
*-commutative35.5%
exp-prod34.3%
fma-define34.3%
hypot-define79.9%
*-commutative79.9%
Simplified79.9%
Taylor expanded in y.im around 0 57.0%
unpow257.0%
unpow257.0%
hypot-undefine80.6%
Simplified80.6%
Taylor expanded in y.im around 0 78.9%
Taylor expanded in y.re around 0 85.2%
Final simplification78.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.im -3.2e+238)
(exp
(-
(* y.re (log (+ x.re (* (pow x.im 2.0) (/ 0.5 x.re)))))
(* (atan2 x.im x.re) y.im)))
(if (<= y.im 5.5e+179)
(pow (hypot x.im x.re) y.re)
(* (pow (exp (- y.im)) (atan2 x.im x.re)) (cos (* y.im (log x.im)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_im <= -3.2e+238) {
tmp = exp(((y_46_re * log((x_46_re + (pow(x_46_im, 2.0) * (0.5 / x_46_re))))) - (atan2(x_46_im, x_46_re) * y_46_im)));
} else if (y_46_im <= 5.5e+179) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = pow(exp(-y_46_im), atan2(x_46_im, x_46_re)) * cos((y_46_im * log(x_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_im <= -3.2e+238) {
tmp = Math.exp(((y_46_re * Math.log((x_46_re + (Math.pow(x_46_im, 2.0) * (0.5 / x_46_re))))) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
} else if (y_46_im <= 5.5e+179) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = Math.pow(Math.exp(-y_46_im), Math.atan2(x_46_im, x_46_re)) * Math.cos((y_46_im * Math.log(x_46_im)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_im <= -3.2e+238: tmp = math.exp(((y_46_re * math.log((x_46_re + (math.pow(x_46_im, 2.0) * (0.5 / x_46_re))))) - (math.atan2(x_46_im, x_46_re) * y_46_im))) elif y_46_im <= 5.5e+179: tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = math.pow(math.exp(-y_46_im), math.atan2(x_46_im, x_46_re)) * math.cos((y_46_im * math.log(x_46_im))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_im <= -3.2e+238) tmp = exp(Float64(Float64(y_46_re * log(Float64(x_46_re + Float64((x_46_im ^ 2.0) * Float64(0.5 / x_46_re))))) - Float64(atan(x_46_im, x_46_re) * y_46_im))); elseif (y_46_im <= 5.5e+179) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = Float64((exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re)) * cos(Float64(y_46_im * log(x_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_im <= -3.2e+238) tmp = exp(((y_46_re * log((x_46_re + ((x_46_im ^ 2.0) * (0.5 / x_46_re))))) - (atan2(x_46_im, x_46_re) * y_46_im))); elseif (y_46_im <= 5.5e+179) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = (exp(-y_46_im) ^ atan2(x_46_im, x_46_re)) * cos((y_46_im * log(x_46_im))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -3.2e+238], N[Exp[N[(N[(y$46$re * N[Log[N[(x$46$re + N[(N[Power[x$46$im, 2.0], $MachinePrecision] * N[(0.5 / x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[y$46$im, 5.5e+179], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], N[(N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -3.2 \cdot 10^{+238}:\\
\;\;\;\;e^{y.re \cdot \log \left(x.re + {x.im}^{2} \cdot \frac{0.5}{x.re}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{elif}\;y.im \leq 5.5 \cdot 10^{+179}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;{\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left(y.im \cdot \log x.im\right)\\
\end{array}
\end{array}
if y.im < -3.19999999999999981e238Initial program 57.1%
Taylor expanded in x.im around 0 28.6%
*-commutative28.6%
associate-*l/28.6%
associate-*r/28.6%
Simplified28.6%
Taylor expanded in y.im around 0 38.2%
Taylor expanded in y.re around 0 42.9%
if -3.19999999999999981e238 < y.im < 5.4999999999999998e179Initial program 39.4%
exp-diff34.2%
exp-to-pow34.2%
hypot-define34.2%
*-commutative34.2%
exp-prod32.3%
fma-define32.3%
hypot-define71.8%
*-commutative71.8%
Simplified71.8%
Taylor expanded in y.im around 0 55.7%
unpow255.7%
unpow255.7%
hypot-undefine70.7%
Simplified70.7%
Taylor expanded in y.im around 0 69.4%
Taylor expanded in y.re around 0 73.7%
if 5.4999999999999998e179 < y.im Initial program 27.3%
exp-diff13.6%
exp-to-pow13.6%
hypot-define13.6%
*-commutative13.6%
exp-prod13.6%
fma-define13.6%
hypot-define59.2%
*-commutative59.2%
Simplified59.2%
Taylor expanded in y.re around 0 77.6%
rec-exp77.6%
distribute-lft-neg-in77.6%
exp-prod82.0%
Simplified82.0%
Taylor expanded in x.re around 0 63.8%
Taylor expanded in y.re around 0 63.8%
Final simplification70.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= x.re 6.2e-120)
(pow (hypot x.im x.re) y.re)
(exp
(-
(* y.re (log (+ x.re (* (pow x.im 2.0) (/ 0.5 x.re)))))
(* (atan2 x.im x.re) y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_re <= 6.2e-120) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = exp(((y_46_re * log((x_46_re + (pow(x_46_im, 2.0) * (0.5 / 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 tmp;
if (x_46_re <= 6.2e-120) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = Math.exp(((y_46_re * Math.log((x_46_re + (Math.pow(x_46_im, 2.0) * (0.5 / x_46_re))))) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if x_46_re <= 6.2e-120: tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = math.exp(((y_46_re * math.log((x_46_re + (math.pow(x_46_im, 2.0) * (0.5 / x_46_re))))) - (math.atan2(x_46_im, x_46_re) * y_46_im))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (x_46_re <= 6.2e-120) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = exp(Float64(Float64(y_46_re * log(Float64(x_46_re + Float64((x_46_im ^ 2.0) * Float64(0.5 / x_46_re))))) - Float64(atan(x_46_im, x_46_re) * y_46_im))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (x_46_re <= 6.2e-120) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = exp(((y_46_re * log((x_46_re + ((x_46_im ^ 2.0) * (0.5 / x_46_re))))) - (atan2(x_46_im, x_46_re) * y_46_im))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$re, 6.2e-120], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[N[(x$46$re + N[(N[Power[x$46$im, 2.0], $MachinePrecision] * N[(0.5 / x$46$re), $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}\;x.re \leq 6.2 \cdot 10^{-120}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log \left(x.re + {x.im}^{2} \cdot \frac{0.5}{x.re}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\end{array}
\end{array}
if x.re < 6.20000000000000038e-120Initial program 39.9%
exp-diff33.4%
exp-to-pow33.4%
hypot-define33.4%
*-commutative33.4%
exp-prod32.8%
fma-define32.8%
hypot-define69.5%
*-commutative69.5%
Simplified69.5%
Taylor expanded in y.im around 0 46.6%
unpow246.6%
unpow246.6%
hypot-undefine60.0%
Simplified60.0%
Taylor expanded in y.im around 0 59.3%
Taylor expanded in y.re around 0 64.4%
if 6.20000000000000038e-120 < x.re Initial program 39.6%
Taylor expanded in x.im around 0 39.6%
*-commutative39.6%
associate-*l/39.6%
associate-*r/39.6%
Simplified39.6%
Taylor expanded in y.im around 0 73.2%
Taylor expanded in y.re around 0 72.2%
Final simplification67.5%
(FPCore (x.re x.im y.re y.im) :precision binary64 (pow (hypot x.im x.re) y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return pow(hypot(x_46_im, x_46_re), y_46_re);
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.pow(math.hypot(x_46_im, x_46_re), y_46_re)
function code(x_46_re, x_46_im, y_46_re, y_46_im) return hypot(x_46_im, x_46_re) ^ y_46_re end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]
\begin{array}{l}
\\
{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}
\end{array}
Initial program 39.8%
exp-diff33.5%
exp-to-pow33.5%
hypot-define33.5%
*-commutative33.5%
exp-prod32.0%
fma-define32.0%
hypot-define70.3%
*-commutative70.3%
Simplified70.3%
Taylor expanded in y.im around 0 52.0%
unpow252.0%
unpow252.0%
hypot-undefine63.4%
Simplified63.4%
Taylor expanded in y.im around 0 62.1%
Taylor expanded in y.re around 0 64.8%
Final simplification64.8%
herbie shell --seed 2024131
(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)))))