
(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 (* y.re (atan2 x.im x.re)))
(t_1
(exp
(- (* (log (hypot x.re x.im)) y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= x.im -1.1e-307)
(* t_1 (cos (- t_0 (* y.im (log (/ -1.0 x.im))))))
(if (<= x.im 8e-116)
(* t_1 (cos (* y.im (log (hypot x.im x.re)))))
(* t_1 (cos 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 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (x_46_im <= -1.1e-307) {
tmp = t_1 * cos((t_0 - (y_46_im * log((-1.0 / x_46_im)))));
} else if (x_46_im <= 8e-116) {
tmp = t_1 * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
} else {
tmp = t_1 * cos(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.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (x_46_im <= -1.1e-307) {
tmp = t_1 * Math.cos((t_0 - (y_46_im * Math.log((-1.0 / x_46_im)))));
} else if (x_46_im <= 8e-116) {
tmp = t_1 * Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))));
} else {
tmp = t_1 * Math.cos(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.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) tmp = 0 if x_46_im <= -1.1e-307: tmp = t_1 * math.cos((t_0 - (y_46_im * math.log((-1.0 / x_46_im))))) elif x_46_im <= 8e-116: tmp = t_1 * math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) else: tmp = t_1 * math.cos(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 = exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (x_46_im <= -1.1e-307) tmp = Float64(t_1 * cos(Float64(t_0 - Float64(y_46_im * log(Float64(-1.0 / x_46_im)))))); elseif (x_46_im <= 8e-116) tmp = Float64(t_1 * cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re))))); else tmp = Float64(t_1 * cos(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 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))); tmp = 0.0; if (x_46_im <= -1.1e-307) tmp = t_1 * cos((t_0 - (y_46_im * log((-1.0 / x_46_im))))); elseif (x_46_im <= 8e-116) tmp = t_1 * cos((y_46_im * log(hypot(x_46_im, x_46_re)))); else tmp = t_1 * cos(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[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -1.1e-307], N[(t$95$1 * N[Cos[N[(t$95$0 - N[(y$46$im * N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 8e-116], N[(t$95$1 * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;x.im \leq -1.1 \cdot 10^{-307}:\\
\;\;\;\;t_1 \cdot \cos \left(t_0 - y.im \cdot \log \left(\frac{-1}{x.im}\right)\right)\\
\mathbf{elif}\;x.im \leq 8 \cdot 10^{-116}:\\
\;\;\;\;t_1 \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \cos t_0\\
\end{array}
\end{array}
if x.im < -1.1e-307Initial program 38.8%
Simplified79.6%
Taylor expanded in x.im around -inf 85.8%
+-commutative85.8%
mul-1-neg85.8%
unsub-neg85.8%
*-commutative85.8%
Simplified85.8%
if -1.1e-307 < x.im < 8e-116Initial program 39.4%
Simplified82.9%
fma-udef82.9%
hypot-udef39.4%
*-commutative39.4%
add-cube-cbrt44.5%
pow344.5%
hypot-udef82.6%
*-commutative82.6%
fma-udef82.6%
*-commutative82.6%
Applied egg-rr82.6%
Taylor expanded in y.re around 0 44.9%
pow-base-144.9%
*-lft-identity44.9%
+-commutative44.9%
unpow244.9%
unpow244.9%
hypot-def88.5%
hypot-def44.9%
unpow244.9%
unpow244.9%
+-commutative44.9%
unpow244.9%
unpow244.9%
hypot-def88.5%
Simplified88.5%
if 8e-116 < x.im Initial program 37.9%
Simplified87.0%
Taylor expanded in y.im around 0 86.4%
Final simplification86.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (log (hypot x.re x.im)))
(t_2 (exp (- (* t_1 y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= x.im -4.8e-308)
(* t_2 (cos (- t_0 (* y.im (log (/ -1.0 x.im))))))
(* t_2 (cos (fma t_1 y.im 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 = log(hypot(x_46_re, x_46_im));
double t_2 = exp(((t_1 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (x_46_im <= -4.8e-308) {
tmp = t_2 * cos((t_0 - (y_46_im * log((-1.0 / x_46_im)))));
} else {
tmp = t_2 * cos(fma(t_1, y_46_im, 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 = log(hypot(x_46_re, x_46_im)) t_2 = exp(Float64(Float64(t_1 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (x_46_im <= -4.8e-308) tmp = Float64(t_2 * cos(Float64(t_0 - Float64(y_46_im * log(Float64(-1.0 / x_46_im)))))); else tmp = Float64(t_2 * cos(fma(t_1, y_46_im, 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[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[(t$95$1 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -4.8e-308], N[(t$95$2 * N[Cos[N[(t$95$0 - N[(y$46$im * N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[Cos[N[(t$95$1 * y$46$im + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_2 := e^{t_1 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;x.im \leq -4.8 \cdot 10^{-308}:\\
\;\;\;\;t_2 \cdot \cos \left(t_0 - y.im \cdot \log \left(\frac{-1}{x.im}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \cos \left(\mathsf{fma}\left(t_1, y.im, t_0\right)\right)\\
\end{array}
\end{array}
if x.im < -4.80000000000000016e-308Initial program 38.8%
Simplified79.6%
Taylor expanded in x.im around -inf 85.8%
+-commutative85.8%
mul-1-neg85.8%
unsub-neg85.8%
*-commutative85.8%
Simplified85.8%
if -4.80000000000000016e-308 < x.im Initial program 38.3%
Simplified85.9%
Final simplification85.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(exp
(- (* (log (hypot x.re x.im)) y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= y.re 2.05e-40)
(* t_0 (cos (* y.im (log (hypot x.im x.re)))))
(* t_0 (cos (* 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 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (y_46_re <= 2.05e-40) {
tmp = t_0 * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
} else {
tmp = t_0 * cos((y_46_re * 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 = Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (y_46_re <= 2.05e-40) {
tmp = t_0 * Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))));
} else {
tmp = t_0 * Math.cos((y_46_re * 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 = math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) tmp = 0 if y_46_re <= 2.05e-40: tmp = t_0 * math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) else: tmp = t_0 * math.cos((y_46_re * 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 = exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (y_46_re <= 2.05e-40) tmp = Float64(t_0 * cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re))))); else tmp = Float64(t_0 * cos(Float64(y_46_re * 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 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))); tmp = 0.0; if (y_46_re <= 2.05e-40) tmp = t_0 * cos((y_46_im * log(hypot(x_46_im, x_46_re)))); else tmp = t_0 * cos((y_46_re * 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[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, 2.05e-40], N[(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]), $MachinePrecision], N[(t$95$0 * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;y.re \leq 2.05 \cdot 10^{-40}:\\
\;\;\;\;t_0 \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\end{array}
\end{array}
if y.re < 2.04999999999999981e-40Initial program 37.1%
Simplified85.3%
fma-udef85.3%
hypot-udef37.1%
*-commutative37.1%
add-cube-cbrt37.4%
pow336.9%
hypot-udef85.1%
*-commutative85.1%
fma-udef85.1%
*-commutative85.1%
Applied egg-rr85.1%
Taylor expanded in y.re around 0 37.6%
pow-base-137.6%
*-lft-identity37.6%
+-commutative37.6%
unpow237.6%
unpow237.6%
hypot-def85.8%
hypot-def37.6%
unpow237.6%
unpow237.6%
+-commutative37.6%
unpow237.6%
unpow237.6%
hypot-def85.8%
Simplified85.8%
if 2.04999999999999981e-40 < y.re Initial program 42.9%
Simplified76.2%
Taylor expanded in y.im around 0 81.5%
Final simplification84.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im)) (t_1 (* y.re (atan2 x.im x.re))))
(if (<= x.re 6e-136)
(* (exp (- (* (log (hypot x.re x.im)) y.re) t_0)) (cos t_1))
(/ (cos (+ t_1 (* y.im (log x.re)))) (exp (- t_0 (* y.re (log x.re))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= 6e-136) {
tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * cos(t_1);
} else {
tmp = cos((t_1 + (y_46_im * log(x_46_re)))) / exp((t_0 - (y_46_re * log(x_46_re))));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = y_46_re * Math.atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= 6e-136) {
tmp = Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * Math.cos(t_1);
} else {
tmp = Math.cos((t_1 + (y_46_im * Math.log(x_46_re)))) / Math.exp((t_0 - (y_46_re * Math.log(x_46_re))));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.atan2(x_46_im, x_46_re) * y_46_im t_1 = y_46_re * math.atan2(x_46_im, x_46_re) tmp = 0 if x_46_re <= 6e-136: tmp = math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * math.cos(t_1) else: tmp = math.cos((t_1 + (y_46_im * math.log(x_46_re)))) / math.exp((t_0 - (y_46_re * math.log(x_46_re)))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_re <= 6e-136) tmp = Float64(exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * cos(t_1)); else tmp = Float64(cos(Float64(t_1 + Float64(y_46_im * log(x_46_re)))) / exp(Float64(t_0 - Float64(y_46_re * log(x_46_re))))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = atan2(x_46_im, x_46_re) * y_46_im; t_1 = y_46_re * atan2(x_46_im, x_46_re); tmp = 0.0; if (x_46_re <= 6e-136) tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * cos(t_1); else tmp = cos((t_1 + (y_46_im * log(x_46_re)))) / exp((t_0 - (y_46_re * log(x_46_re)))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, 6e-136], N[(N[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(t$95$1 + N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Exp[N[(t$95$0 - N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.re \leq 6 \cdot 10^{-136}:\\
\;\;\;\;e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - t_0} \cdot \cos t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(t_1 + y.im \cdot \log x.re\right)}{e^{t_0 - y.re \cdot \log x.re}}\\
\end{array}
\end{array}
if x.re < 5.9999999999999996e-136Initial program 36.9%
Simplified85.2%
Taylor expanded in y.im around 0 87.1%
if 5.9999999999999996e-136 < x.re Initial program 41.6%
exp-diff39.3%
exp-to-pow39.3%
hypot-def39.3%
*-commutative39.3%
exp-prod37.8%
fma-def37.8%
hypot-def69.3%
*-commutative69.3%
Simplified69.3%
Taylor expanded in x.re around inf 74.5%
associate-/l*74.5%
+-commutative74.5%
mul-1-neg74.5%
unsub-neg74.5%
*-commutative74.5%
log-rec74.5%
*-commutative74.5%
*-commutative74.5%
div-exp80.2%
*-commutative80.2%
Simplified80.2%
Final simplification84.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(exp
(- (* (log (hypot x.re x.im)) y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= y.re -1.4e-82)
t_0
(if (<= y.re 3.05e-43)
(/
(cos (* y.im (log (hypot x.im x.re))))
(pow (exp y.im) (atan2 x.im x.re)))
(* t_0 (cos (* 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 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (y_46_re <= -1.4e-82) {
tmp = t_0;
} else if (y_46_re <= 3.05e-43) {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) / pow(exp(y_46_im), atan2(x_46_im, x_46_re));
} else {
tmp = t_0 * cos((y_46_re * 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 = Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (y_46_re <= -1.4e-82) {
tmp = t_0;
} else if (y_46_re <= 3.05e-43) {
tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) / Math.pow(Math.exp(y_46_im), Math.atan2(x_46_im, x_46_re));
} else {
tmp = t_0 * Math.cos((y_46_re * 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 = math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) tmp = 0 if y_46_re <= -1.4e-82: tmp = t_0 elif y_46_re <= 3.05e-43: tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) / math.pow(math.exp(y_46_im), math.atan2(x_46_im, x_46_re)) else: tmp = t_0 * math.cos((y_46_re * 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 = exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (y_46_re <= -1.4e-82) tmp = t_0; elseif (y_46_re <= 3.05e-43) tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) / (exp(y_46_im) ^ atan(x_46_im, x_46_re))); else tmp = Float64(t_0 * cos(Float64(y_46_re * 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 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))); tmp = 0.0; if (y_46_re <= -1.4e-82) tmp = t_0; elseif (y_46_re <= 3.05e-43) tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) / (exp(y_46_im) ^ atan2(x_46_im, x_46_re)); else tmp = t_0 * cos((y_46_re * 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[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -1.4e-82], t$95$0, If[LessEqual[y$46$re, 3.05e-43], 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[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;y.re \leq -1.4 \cdot 10^{-82}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y.re \leq 3.05 \cdot 10^{-43}:\\
\;\;\;\;\frac{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\end{array}
\end{array}
if y.re < -1.40000000000000012e-82Initial program 34.2%
Simplified82.9%
Taylor expanded in y.im around 0 82.9%
Taylor expanded in y.re around 0 85.5%
if -1.40000000000000012e-82 < y.re < 3.05000000000000019e-43Initial program 39.0%
exp-diff39.0%
exp-to-pow39.0%
hypot-def39.0%
*-commutative39.0%
exp-prod38.7%
fma-def38.7%
hypot-def86.3%
*-commutative86.3%
Simplified86.3%
Taylor expanded in y.re around 0 39.0%
unpow239.0%
unpow239.0%
hypot-def86.9%
*-commutative86.9%
exp-prod86.3%
Simplified86.3%
if 3.05000000000000019e-43 < y.re Initial program 42.9%
Simplified76.2%
Taylor expanded in y.im around 0 81.5%
Final simplification84.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im)) (t_1 (log (/ -1.0 x.im))))
(if (<= x.im -1.15)
(/ (cos (* y.im t_1)) (exp (+ t_0 (* y.re t_1))))
(exp (- (* (log (hypot x.re x.im)) 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 = atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = log((-1.0 / x_46_im));
double tmp;
if (x_46_im <= -1.15) {
tmp = cos((y_46_im * t_1)) / exp((t_0 + (y_46_re * t_1)));
} else {
tmp = exp(((log(hypot(x_46_re, x_46_im)) * 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.atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = Math.log((-1.0 / x_46_im));
double tmp;
if (x_46_im <= -1.15) {
tmp = Math.cos((y_46_im * t_1)) / Math.exp((t_0 + (y_46_re * t_1)));
} else {
tmp = Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - t_0));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.atan2(x_46_im, x_46_re) * y_46_im t_1 = math.log((-1.0 / x_46_im)) tmp = 0 if x_46_im <= -1.15: tmp = math.cos((y_46_im * t_1)) / math.exp((t_0 + (y_46_re * t_1))) else: tmp = math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_1 = log(Float64(-1.0 / x_46_im)) tmp = 0.0 if (x_46_im <= -1.15) tmp = Float64(cos(Float64(y_46_im * t_1)) / exp(Float64(t_0 + Float64(y_46_re * t_1)))); else tmp = exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * 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 = atan2(x_46_im, x_46_re) * y_46_im; t_1 = log((-1.0 / x_46_im)); tmp = 0.0; if (x_46_im <= -1.15) tmp = cos((y_46_im * t_1)) / exp((t_0 + (y_46_re * t_1))); else tmp = exp(((log(hypot(x_46_re, x_46_im)) * 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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -1.15], N[(N[Cos[N[(y$46$im * t$95$1), $MachinePrecision]], $MachinePrecision] / N[Exp[N[(t$95$0 + N[(y$46$re * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := \log \left(\frac{-1}{x.im}\right)\\
\mathbf{if}\;x.im \leq -1.15:\\
\;\;\;\;\frac{\cos \left(y.im \cdot t_1\right)}{e^{t_0 + y.re \cdot t_1}}\\
\mathbf{else}:\\
\;\;\;\;e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - t_0}\\
\end{array}
\end{array}
if x.im < -1.1499999999999999Initial program 25.5%
exp-diff21.6%
exp-to-pow21.6%
hypot-def21.6%
*-commutative21.6%
exp-prod21.6%
fma-def21.6%
hypot-def66.7%
*-commutative66.7%
Simplified66.7%
Taylor expanded in x.im around -inf 67.0%
associate-/l*67.0%
+-commutative67.0%
mul-1-neg67.0%
unsub-neg67.0%
*-commutative67.0%
*-commutative67.0%
*-commutative67.0%
div-exp80.8%
*-commutative80.8%
mul-1-neg80.8%
distribute-rgt-neg-in80.8%
Simplified80.8%
Taylor expanded in y.re around 0 82.7%
cos-neg82.7%
Simplified82.7%
if -1.1499999999999999 < x.im Initial program 41.8%
Simplified84.7%
Taylor expanded in y.im around 0 83.9%
Taylor expanded in y.re around 0 83.4%
Final simplification83.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot x.im x.re) y.re)))
(if (<= x.im 9.4e+36)
t_0
(if (<= x.im 1.5e+233)
(exp
(-
(+
(* 0.5 (/ (* y.re (* x.re x.re)) (* x.im x.im)))
(* y.re (log x.im)))
(* (atan2 x.im x.re) y.im)))
(* (cos (* y.re (atan2 x.im x.re))) t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if (x_46_im <= 9.4e+36) {
tmp = t_0;
} else if (x_46_im <= 1.5e+233) {
tmp = exp((((0.5 * ((y_46_re * (x_46_re * x_46_re)) / (x_46_im * x_46_im))) + (y_46_re * log(x_46_im))) - (atan2(x_46_im, x_46_re) * y_46_im)));
} else {
tmp = cos((y_46_re * atan2(x_46_im, x_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.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if (x_46_im <= 9.4e+36) {
tmp = t_0;
} else if (x_46_im <= 1.5e+233) {
tmp = Math.exp((((0.5 * ((y_46_re * (x_46_re * x_46_re)) / (x_46_im * x_46_im))) + (y_46_re * Math.log(x_46_im))) - (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))) * t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) tmp = 0 if x_46_im <= 9.4e+36: tmp = t_0 elif x_46_im <= 1.5e+233: tmp = math.exp((((0.5 * ((y_46_re * (x_46_re * x_46_re)) / (x_46_im * x_46_im))) + (y_46_re * math.log(x_46_im))) - (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))) * t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re tmp = 0.0 if (x_46_im <= 9.4e+36) tmp = t_0; elseif (x_46_im <= 1.5e+233) tmp = exp(Float64(Float64(Float64(0.5 * Float64(Float64(y_46_re * Float64(x_46_re * x_46_re)) / Float64(x_46_im * x_46_im))) + Float64(y_46_re * log(x_46_im))) - Float64(atan(x_46_im, x_46_re) * y_46_im))); else tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * t_0); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re; tmp = 0.0; if (x_46_im <= 9.4e+36) tmp = t_0; elseif (x_46_im <= 1.5e+233) tmp = exp((((0.5 * ((y_46_re * (x_46_re * x_46_re)) / (x_46_im * x_46_im))) + (y_46_re * log(x_46_im))) - (atan2(x_46_im, x_46_re) * y_46_im))); else tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, If[LessEqual[x$46$im, 9.4e+36], t$95$0, If[LessEqual[x$46$im, 1.5e+233], N[Exp[N[(N[(N[(0.5 * N[(N[(y$46$re * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 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] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{if}\;x.im \leq 9.4 \cdot 10^{+36}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x.im \leq 1.5 \cdot 10^{+233}:\\
\;\;\;\;e^{\left(0.5 \cdot \frac{y.re \cdot \left(x.re \cdot x.re\right)}{x.im \cdot x.im} + y.re \cdot \log x.im\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot t_0\\
\end{array}
\end{array}
if x.im < 9.39999999999999978e36Initial program 42.5%
exp-diff39.2%
exp-to-pow39.2%
hypot-def39.2%
*-commutative39.2%
exp-prod38.5%
fma-def38.5%
hypot-def71.4%
*-commutative71.4%
Simplified71.4%
Taylor expanded in y.im around 0 55.3%
*-commutative55.3%
unpow255.3%
unpow255.3%
hypot-def66.8%
Simplified66.8%
Taylor expanded in y.re around 0 67.3%
if 9.39999999999999978e36 < x.im < 1.50000000000000007e233Initial program 36.4%
Simplified92.7%
Taylor expanded in y.im around 0 90.9%
Taylor expanded in x.im around inf 80.1%
mul-1-neg80.1%
unsub-neg80.1%
*-commutative80.1%
unpow280.1%
unpow280.1%
*-commutative80.1%
log-rec80.1%
Simplified80.1%
Taylor expanded in y.re around 0 80.1%
if 1.50000000000000007e233 < x.im Initial program 0.0%
exp-diff0.0%
exp-to-pow0.0%
hypot-def0.0%
*-commutative0.0%
exp-prod0.0%
fma-def0.0%
hypot-def81.3%
*-commutative81.3%
Simplified81.3%
Taylor expanded in y.im around 0 39.1%
*-commutative39.1%
unpow239.1%
unpow239.1%
hypot-def69.4%
Simplified69.4%
Final simplification70.2%
(FPCore (x.re x.im y.re y.im) :precision binary64 (exp (- (* (log (hypot x.re x.im)) y.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) {
return exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Exp[N[(N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}
\end{array}
Initial program 38.5%
Simplified83.1%
Taylor expanded in y.im around 0 82.0%
Taylor expanded in y.re around 0 81.3%
Final simplification81.3%
(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 38.5%
exp-diff35.8%
exp-to-pow35.8%
hypot-def35.8%
*-commutative35.8%
exp-prod35.3%
fma-def35.3%
hypot-def73.8%
*-commutative73.8%
Simplified73.8%
Taylor expanded in y.im around 0 54.0%
*-commutative54.0%
unpow254.0%
unpow254.0%
hypot-def65.3%
Simplified65.3%
Taylor expanded in y.re around 0 65.3%
Final simplification65.3%
herbie shell --seed 2023172
(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)))))