
(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 8 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 (* (atan2 x.im x.re) y.im))
(t_1 (exp (- (* (log (hypot x.re x.im)) y.re) t_0)))
(t_2 (* y.re (atan2 x.im x.re))))
(if (<= x.re -2e-308)
(* t_1 (cos (* (log (/ -1.0 x.re)) (- y.im))))
(if (<= x.re 5.6e+34)
(* t_1 (cos (+ t_2 (* y.im (log x.re)))))
(* (exp (- (* y.re (log x.re)) t_0)) (cos t_2))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0));
double t_2 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -2e-308) {
tmp = t_1 * cos((log((-1.0 / x_46_re)) * -y_46_im));
} else if (x_46_re <= 5.6e+34) {
tmp = t_1 * cos((t_2 + (y_46_im * log(x_46_re))));
} else {
tmp = exp(((y_46_re * log(x_46_re)) - t_0)) * cos(t_2);
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - t_0));
double t_2 = y_46_re * Math.atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -2e-308) {
tmp = t_1 * Math.cos((Math.log((-1.0 / x_46_re)) * -y_46_im));
} else if (x_46_re <= 5.6e+34) {
tmp = t_1 * Math.cos((t_2 + (y_46_im * Math.log(x_46_re))));
} else {
tmp = Math.exp(((y_46_re * Math.log(x_46_re)) - t_0)) * Math.cos(t_2);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.atan2(x_46_im, x_46_re) * y_46_im t_1 = math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) t_2 = y_46_re * math.atan2(x_46_im, x_46_re) tmp = 0 if x_46_re <= -2e-308: tmp = t_1 * math.cos((math.log((-1.0 / x_46_re)) * -y_46_im)) elif x_46_re <= 5.6e+34: tmp = t_1 * math.cos((t_2 + (y_46_im * math.log(x_46_re)))) else: tmp = math.exp(((y_46_re * math.log(x_46_re)) - t_0)) * math.cos(t_2) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_1 = exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) t_2 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_re <= -2e-308) tmp = Float64(t_1 * cos(Float64(log(Float64(-1.0 / x_46_re)) * Float64(-y_46_im)))); elseif (x_46_re <= 5.6e+34) tmp = Float64(t_1 * cos(Float64(t_2 + Float64(y_46_im * log(x_46_re))))); else tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_re)) - t_0)) * cos(t_2)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = atan2(x_46_im, x_46_re) * y_46_im; t_1 = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)); t_2 = y_46_re * atan2(x_46_im, x_46_re); tmp = 0.0; if (x_46_re <= -2e-308) tmp = t_1 * cos((log((-1.0 / x_46_re)) * -y_46_im)); elseif (x_46_re <= 5.6e+34) tmp = t_1 * cos((t_2 + (y_46_im * log(x_46_re)))); else tmp = exp(((y_46_re * log(x_46_re)) - t_0)) * cos(t_2); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$1 = N[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]}, Block[{t$95$2 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -2e-308], N[(t$95$1 * N[Cos[N[(N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 5.6e+34], N[(t$95$1 * N[Cos[N[(t$95$2 + N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - t_0}\\
t_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.re \leq -2 \cdot 10^{-308}:\\
\;\;\;\;t_1 \cdot \cos \left(\log \left(\frac{-1}{x.re}\right) \cdot \left(-y.im\right)\right)\\
\mathbf{elif}\;x.re \leq 5.6 \cdot 10^{+34}:\\
\;\;\;\;t_1 \cdot \cos \left(t_2 + y.im \cdot \log x.re\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - t_0} \cdot \cos t_2\\
\end{array}
\end{array}
if x.re < -1.9999999999999998e-308Initial program 46.4%
Simplified83.3%
Taylor expanded in x.re around -inf 86.0%
Taylor expanded in y.re around 0 89.0%
if -1.9999999999999998e-308 < x.re < 5.60000000000000016e34Initial program 51.6%
Simplified81.8%
Taylor expanded in x.im around 0 82.1%
if 5.60000000000000016e34 < x.re Initial program 21.0%
Taylor expanded in y.im around 0 61.0%
Taylor expanded in x.re around inf 85.7%
Final simplification86.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im)))
(t_1 (exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))))
(if (<= x.re -2e-147)
(* t_1 (cos (* (log (/ -1.0 x.re)) (- y.im))))
(* 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 = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (x_46_re <= -2e-147) {
tmp = t_1 * cos((log((-1.0 / x_46_re)) * -y_46_im));
} else {
tmp = 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 = exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (x_46_re <= -2e-147) tmp = Float64(t_1 * cos(Float64(log(Float64(-1.0 / x_46_re)) * Float64(-y_46_im)))); else tmp = Float64(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[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]}, If[LessEqual[x$46$re, -2e-147], N[(t$95$1 * N[Cos[N[(N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * 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 := e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;x.re \leq -2 \cdot 10^{-147}:\\
\;\;\;\;t_1 \cdot \cos \left(\log \left(\frac{-1}{x.re}\right) \cdot \left(-y.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \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 x.re < -1.9999999999999999e-147Initial program 41.2%
Simplified80.2%
Taylor expanded in x.re around -inf 83.7%
Taylor expanded in y.re around 0 88.7%
if -1.9999999999999999e-147 < x.re Initial program 41.9%
Simplified83.3%
Final simplification85.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im)))
(if (<= x.re -6e-278)
(*
(exp (- (* (log (hypot x.re x.im)) y.re) t_0))
(cos (* (log (/ -1.0 x.re)) (- y.im))))
(if (<= x.re 53000.0)
(/ (pow (hypot x.re x.im) y.re) (pow (exp y.im) (atan2 x.im x.re)))
(*
(exp (- (* y.re (log 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 = atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_re <= -6e-278) {
tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * cos((log((-1.0 / x_46_re)) * -y_46_im));
} else if (x_46_re <= 53000.0) {
tmp = pow(hypot(x_46_re, x_46_im), y_46_re) / pow(exp(y_46_im), atan2(x_46_im, x_46_re));
} else {
tmp = exp(((y_46_re * log(x_46_re)) - 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.atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_re <= -6e-278) {
tmp = Math.exp(((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * Math.cos((Math.log((-1.0 / x_46_re)) * -y_46_im));
} else if (x_46_re <= 53000.0) {
tmp = Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re) / Math.pow(Math.exp(y_46_im), Math.atan2(x_46_im, x_46_re));
} else {
tmp = Math.exp(((y_46_re * Math.log(x_46_re)) - 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.atan2(x_46_im, x_46_re) * y_46_im tmp = 0 if x_46_re <= -6e-278: tmp = math.exp(((math.log(math.hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * math.cos((math.log((-1.0 / x_46_re)) * -y_46_im)) elif x_46_re <= 53000.0: tmp = math.pow(math.hypot(x_46_re, x_46_im), y_46_re) / math.pow(math.exp(y_46_im), math.atan2(x_46_im, x_46_re)) else: tmp = math.exp(((y_46_re * math.log(x_46_re)) - 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 = Float64(atan(x_46_im, x_46_re) * y_46_im) tmp = 0.0 if (x_46_re <= -6e-278) tmp = Float64(exp(Float64(Float64(log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * cos(Float64(log(Float64(-1.0 / x_46_re)) * Float64(-y_46_im)))); elseif (x_46_re <= 53000.0) tmp = Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan(x_46_im, x_46_re))); else tmp = Float64(exp(Float64(Float64(y_46_re * log(x_46_re)) - 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 = atan2(x_46_im, x_46_re) * y_46_im; tmp = 0.0; if (x_46_re <= -6e-278) tmp = exp(((log(hypot(x_46_re, x_46_im)) * y_46_re) - t_0)) * cos((log((-1.0 / x_46_re)) * -y_46_im)); elseif (x_46_re <= 53000.0) tmp = (hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan2(x_46_im, x_46_re)); else tmp = exp(((y_46_re * log(x_46_re)) - 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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, If[LessEqual[x$46$re, -6e-278], 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[N[(N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 53000.0], 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[(N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * 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 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.re \leq -6 \cdot 10^{-278}:\\
\;\;\;\;e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - t_0} \cdot \cos \left(\log \left(\frac{-1}{x.re}\right) \cdot \left(-y.im\right)\right)\\
\mathbf{elif}\;x.re \leq 53000:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - t_0} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\end{array}
\end{array}
if x.re < -6e-278Initial program 45.1%
Simplified82.6%
Taylor expanded in x.re around -inf 85.4%
Taylor expanded in y.re around 0 88.6%
if -6e-278 < x.re < 53000Initial program 54.7%
exp-diff48.9%
exp-to-pow48.9%
hypot-def48.9%
*-commutative48.9%
exp-prod48.6%
+-commutative48.6%
*-commutative48.6%
fma-def50.0%
hypot-def74.4%
Simplified74.4%
fma-udef74.4%
*-commutative74.4%
hypot-udef48.6%
+-commutative48.6%
add-cube-cbrt48.5%
pow350.0%
*-commutative50.0%
hypot-udef74.3%
fma-def74.3%
Applied egg-rr74.3%
Taylor expanded in y.im around inf 78.6%
if 53000 < x.re Initial program 20.8%
Taylor expanded in y.im around 0 60.6%
Taylor expanded in x.re around inf 84.6%
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 (pow (hypot x.re x.im) y.re)))
(if (<= y.re -3.2)
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) (fabs t_0)))
(if (<= y.re 4e+40)
(/ t_1 (pow (exp y.im) (atan2 x.im x.re)))
(/ t_1 (+ t_0 1.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 = pow(hypot(x_46_re, x_46_im), y_46_re);
double tmp;
if (y_46_re <= -3.2) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - fabs(t_0)));
} else if (y_46_re <= 4e+40) {
tmp = t_1 / pow(exp(y_46_im), atan2(x_46_im, x_46_re));
} else {
tmp = t_1 / (t_0 + 1.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.pow(Math.hypot(x_46_re, x_46_im), y_46_re);
double tmp;
if (y_46_re <= -3.2) {
tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - Math.abs(t_0)));
} else if (y_46_re <= 4e+40) {
tmp = t_1 / Math.pow(Math.exp(y_46_im), Math.atan2(x_46_im, x_46_re));
} else {
tmp = t_1 / (t_0 + 1.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.pow(math.hypot(x_46_re, x_46_im), y_46_re) tmp = 0 if y_46_re <= -3.2: tmp = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - math.fabs(t_0))) elif y_46_re <= 4e+40: tmp = t_1 / math.pow(math.exp(y_46_im), math.atan2(x_46_im, x_46_re)) else: tmp = t_1 / (t_0 + 1.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 = hypot(x_46_re, x_46_im) ^ y_46_re tmp = 0.0 if (y_46_re <= -3.2) tmp = exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - abs(t_0))); elseif (y_46_re <= 4e+40) tmp = Float64(t_1 / (exp(y_46_im) ^ atan(x_46_im, x_46_re))); else tmp = Float64(t_1 / Float64(t_0 + 1.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 = hypot(x_46_re, x_46_im) ^ y_46_re; tmp = 0.0; if (y_46_re <= -3.2) tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - abs(t_0))); elseif (y_46_re <= 4e+40) tmp = t_1 / (exp(y_46_im) ^ atan2(x_46_im, x_46_re)); else tmp = t_1 / (t_0 + 1.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[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, If[LessEqual[y$46$re, -3.2], 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[Abs[t$95$0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[y$46$re, 4e+40], N[(t$95$1 / N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
\mathbf{if}\;y.re \leq -3.2:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \left|t_0\right|}\\
\mathbf{elif}\;y.re \leq 4 \cdot 10^{+40}:\\
\;\;\;\;\frac{t_1}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{t_0 + 1}\\
\end{array}
\end{array}
if y.re < -3.2000000000000002Initial program 33.3%
Taylor expanded in y.im around 0 84.9%
Taylor expanded in y.re around 0 86.5%
add-sqr-sqrt53.0%
sqrt-unprod85.0%
pow285.0%
*-commutative85.0%
Applied egg-rr85.0%
unpow285.0%
rem-sqrt-square86.5%
*-commutative86.5%
Simplified86.5%
if -3.2000000000000002 < y.re < 4.00000000000000012e40Initial program 46.6%
exp-diff46.6%
exp-to-pow46.6%
hypot-def46.6%
*-commutative46.6%
exp-prod46.2%
+-commutative46.2%
*-commutative46.2%
fma-def46.2%
hypot-def82.2%
Simplified82.2%
fma-udef82.9%
*-commutative82.9%
hypot-udef46.2%
+-commutative46.2%
add-cube-cbrt46.2%
pow344.8%
*-commutative44.8%
hypot-udef82.9%
fma-def82.9%
Applied egg-rr82.9%
Taylor expanded in y.im around inf 84.7%
if 4.00000000000000012e40 < y.re Initial program 37.8%
exp-diff28.9%
exp-to-pow28.9%
hypot-def28.9%
*-commutative28.9%
exp-prod28.9%
+-commutative28.9%
*-commutative28.9%
fma-def28.9%
hypot-def57.8%
Simplified57.8%
fma-udef57.8%
*-commutative57.8%
hypot-udef28.9%
+-commutative28.9%
add-cube-cbrt24.4%
pow324.4%
*-commutative24.4%
hypot-udef48.9%
fma-def48.9%
Applied egg-rr48.9%
Taylor expanded in y.im around inf 60.0%
Taylor expanded in y.im around 0 77.9%
Final simplification83.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im)) (t_1 (pow (hypot x.re x.im) y.re)))
(if (<= y.re -32000.0)
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_0))
(if (<= y.re 1.5e+41)
(/ t_1 (pow (exp y.im) (atan2 x.im x.re)))
(/ t_1 (+ t_0 1.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 = pow(hypot(x_46_re, x_46_im), y_46_re);
double tmp;
if (y_46_re <= -32000.0) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
} else if (y_46_re <= 1.5e+41) {
tmp = t_1 / pow(exp(y_46_im), atan2(x_46_im, x_46_re));
} else {
tmp = t_1 / (t_0 + 1.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.pow(Math.hypot(x_46_re, x_46_im), y_46_re);
double tmp;
if (y_46_re <= -32000.0) {
tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
} else if (y_46_re <= 1.5e+41) {
tmp = t_1 / Math.pow(Math.exp(y_46_im), Math.atan2(x_46_im, x_46_re));
} else {
tmp = t_1 / (t_0 + 1.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.pow(math.hypot(x_46_re, x_46_im), y_46_re) tmp = 0 if y_46_re <= -32000.0: tmp = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)) elif y_46_re <= 1.5e+41: tmp = t_1 / math.pow(math.exp(y_46_im), math.atan2(x_46_im, x_46_re)) else: tmp = t_1 / (t_0 + 1.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 = hypot(x_46_re, x_46_im) ^ y_46_re tmp = 0.0 if (y_46_re <= -32000.0) tmp = exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - t_0)); elseif (y_46_re <= 1.5e+41) tmp = Float64(t_1 / (exp(y_46_im) ^ atan(x_46_im, x_46_re))); else tmp = Float64(t_1 / Float64(t_0 + 1.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 = hypot(x_46_re, x_46_im) ^ y_46_re; tmp = 0.0; if (y_46_re <= -32000.0) tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)); elseif (y_46_re <= 1.5e+41) tmp = t_1 / (exp(y_46_im) ^ atan2(x_46_im, x_46_re)); else tmp = t_1 / (t_0 + 1.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[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, If[LessEqual[y$46$re, -32000.0], 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$0), $MachinePrecision]], $MachinePrecision], If[LessEqual[y$46$re, 1.5e+41], N[(t$95$1 / N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
\mathbf{if}\;y.re \leq -32000:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_0}\\
\mathbf{elif}\;y.re \leq 1.5 \cdot 10^{+41}:\\
\;\;\;\;\frac{t_1}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{t_0 + 1}\\
\end{array}
\end{array}
if y.re < -32000Initial program 32.8%
Taylor expanded in y.im around 0 84.5%
Taylor expanded in y.re around 0 87.6%
if -32000 < y.re < 1.4999999999999999e41Initial program 46.6%
exp-diff46.6%
exp-to-pow46.6%
hypot-def46.6%
*-commutative46.6%
exp-prod46.3%
+-commutative46.3%
*-commutative46.3%
fma-def46.3%
hypot-def82.4%
Simplified82.4%
fma-udef83.1%
*-commutative83.1%
hypot-udef46.3%
+-commutative46.3%
add-cube-cbrt46.3%
pow344.9%
*-commutative44.9%
hypot-udef83.2%
fma-def83.2%
Applied egg-rr83.2%
Taylor expanded in y.im around inf 84.2%
if 1.4999999999999999e41 < y.re Initial program 37.8%
exp-diff28.9%
exp-to-pow28.9%
hypot-def28.9%
*-commutative28.9%
exp-prod28.9%
+-commutative28.9%
*-commutative28.9%
fma-def28.9%
hypot-def57.8%
Simplified57.8%
fma-udef57.8%
*-commutative57.8%
hypot-udef28.9%
+-commutative28.9%
add-cube-cbrt24.4%
pow324.4%
*-commutative24.4%
hypot-udef48.9%
fma-def48.9%
Applied egg-rr48.9%
Taylor expanded in y.im around inf 60.0%
Taylor expanded in y.im around 0 77.9%
Final simplification83.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.re -8.2e-11) (not (<= y.re 3.8e-10)))
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(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 <= -8.2e-11) || !(y_46_re <= 3.8e-10)) {
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)));
} else {
tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if ((y_46re <= (-8.2d-11)) .or. (.not. (y_46re <= 3.8d-10))) then
tmp = exp(((y_46re * log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))) - (atan2(x_46im, x_46re) * y_46im)))
else
tmp = exp((atan2(x_46im, x_46re) * -y_46im))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_re <= -8.2e-11) || !(y_46_re <= 3.8e-10)) {
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)));
} 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 <= -8.2e-11) or not (y_46_re <= 3.8e-10): 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))) 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 <= -8.2e-11) || !(y_46_re <= 3.8e-10)) 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))); 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 <= -8.2e-11) || ~((y_46_re <= 3.8e-10))) 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))); 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, -8.2e-11], N[Not[LessEqual[y$46$re, 3.8e-10]], $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], 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 -8.2 \cdot 10^{-11} \lor \neg \left(y.re \leq 3.8 \cdot 10^{-10}\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}\\
\mathbf{else}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\end{array}
\end{array}
if y.re < -8.2000000000000001e-11 or 3.7999999999999998e-10 < y.re Initial program 36.0%
Taylor expanded in y.im around 0 79.3%
Taylor expanded in y.re around 0 82.4%
if -8.2000000000000001e-11 < y.re < 3.7999999999999998e-10Initial program 47.0%
Taylor expanded in y.im around 0 56.1%
Taylor expanded in y.re around 0 56.1%
Taylor expanded in y.re around 0 84.1%
mul-1-neg84.1%
distribute-rgt-neg-out84.1%
Simplified84.1%
Final simplification83.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -7.5e-11) (not (<= y.re 2.1e-12))) (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 <= -7.5e-11) || !(y_46_re <= 2.1e-12)) {
tmp = 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 <= -7.5e-11) || !(y_46_re <= 2.1e-12)) {
tmp = 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 <= -7.5e-11) or not (y_46_re <= 2.1e-12): tmp = 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 <= -7.5e-11) || !(y_46_re <= 2.1e-12)) tmp = 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 <= -7.5e-11) || ~((y_46_re <= 2.1e-12))) tmp = 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, -7.5e-11], N[Not[LessEqual[y$46$re, 2.1e-12]], $MachinePrecision]], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 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 -7.5 \cdot 10^{-11} \lor \neg \left(y.re \leq 2.1 \cdot 10^{-12}\right):\\
\;\;\;\;{\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 < -7.5e-11 or 2.09999999999999994e-12 < y.re Initial program 36.0%
exp-diff28.0%
exp-to-pow28.0%
hypot-def28.0%
*-commutative28.0%
exp-prod27.2%
+-commutative27.2%
*-commutative27.2%
fma-def28.0%
hypot-def64.8%
Simplified64.8%
fma-udef64.8%
*-commutative64.8%
hypot-udef27.2%
+-commutative27.2%
add-cube-cbrt26.4%
pow327.2%
*-commutative27.2%
hypot-udef63.2%
fma-def63.2%
Applied egg-rr63.2%
Taylor expanded in y.im around inf 67.9%
Taylor expanded in y.im around 0 78.5%
unpow278.5%
unpow278.5%
hypot-def79.3%
Simplified79.3%
if -7.5e-11 < y.re < 2.09999999999999994e-12Initial program 47.0%
Taylor expanded in y.im around 0 56.1%
Taylor expanded in y.re around 0 56.1%
Taylor expanded in y.re around 0 84.1%
mul-1-neg84.1%
distribute-rgt-neg-out84.1%
Simplified84.1%
Final simplification81.7%
(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 41.6%
exp-diff37.7%
exp-to-pow37.7%
hypot-def37.7%
*-commutative37.7%
exp-prod37.1%
+-commutative37.1%
*-commutative37.1%
fma-def37.5%
hypot-def73.9%
Simplified73.9%
fma-udef73.9%
*-commutative73.9%
hypot-udef37.1%
+-commutative37.1%
add-cube-cbrt36.3%
pow335.9%
*-commutative35.9%
hypot-udef73.2%
fma-def73.2%
Applied egg-rr73.2%
Taylor expanded in y.im around inf 76.1%
Taylor expanded in y.im around 0 57.2%
unpow257.2%
unpow257.2%
hypot-def63.2%
Simplified63.2%
Final simplification63.2%
herbie shell --seed 2023230
(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)))))