
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im)))
(t_1 (* y.re (atan2 x.im x.re)))
(t_2
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im))))
(t_3 (log (hypot x.im x.re)))
(t_4 (* y.im t_3)))
(if (<= y.re -2e+23)
(* t_2 (- (cos t_4) (* y.re (* (atan2 x.im x.re) (sin t_4)))))
(if (<= y.re 3.6e+31)
(*
(exp (fma t_0 y.re (* (atan2 x.im x.re) (- y.im))))
(cos (fma t_0 y.im t_1)))
(* t_2 (fabs (cos (fma y.im t_3 t_1))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_re, x_46_im));
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double t_2 = 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)));
double t_3 = log(hypot(x_46_im, x_46_re));
double t_4 = y_46_im * t_3;
double tmp;
if (y_46_re <= -2e+23) {
tmp = t_2 * (cos(t_4) - (y_46_re * (atan2(x_46_im, x_46_re) * sin(t_4))));
} else if (y_46_re <= 3.6e+31) {
tmp = exp(fma(t_0, y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos(fma(t_0, y_46_im, t_1));
} else {
tmp = t_2 * fabs(cos(fma(y_46_im, t_3, t_1)));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_2 = 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_3 = log(hypot(x_46_im, x_46_re)) t_4 = Float64(y_46_im * t_3) tmp = 0.0 if (y_46_re <= -2e+23) tmp = Float64(t_2 * Float64(cos(t_4) - Float64(y_46_re * Float64(atan(x_46_im, x_46_re) * sin(t_4))))); elseif (y_46_re <= 3.6e+31) tmp = Float64(exp(fma(t_0, y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cos(fma(t_0, y_46_im, t_1))); else tmp = Float64(t_2 * abs(cos(fma(y_46_im, t_3, t_1)))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(y$46$im * t$95$3), $MachinePrecision]}, If[LessEqual[y$46$re, -2e+23], N[(t$95$2 * N[(N[Cos[t$95$4], $MachinePrecision] - N[(y$46$re * N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * N[Sin[t$95$4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 3.6e+31], N[(N[Exp[N[(t$95$0 * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$0 * y$46$im + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[Abs[N[Cos[N[(y$46$im * t$95$3 + t$95$1), $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 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
t_3 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_4 := y.im \cdot t_3\\
\mathbf{if}\;y.re \leq -2 \cdot 10^{+23}:\\
\;\;\;\;t_2 \cdot \left(\cos t_4 - y.re \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \sin t_4\right)\right)\\
\mathbf{elif}\;y.re \leq 3.6 \cdot 10^{+31}:\\
\;\;\;\;e^{\mathsf{fma}\left(t_0, y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \cdot \cos \left(\mathsf{fma}\left(t_0, y.im, t_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left|\cos \left(\mathsf{fma}\left(y.im, t_3, t_1\right)\right)\right|\\
\end{array}
\end{array}
if y.re < -1.9999999999999998e23Initial program 46.5%
Taylor expanded in y.re around 0 62.8%
mul-1-neg62.8%
unsub-neg62.8%
unpow262.8%
unpow262.8%
hypot-def62.8%
*-commutative62.8%
unpow262.8%
unpow262.8%
Simplified93.1%
if -1.9999999999999998e23 < y.re < 3.59999999999999996e31Initial program 40.2%
fma-neg40.2%
hypot-def40.2%
distribute-rgt-neg-out40.2%
fma-def40.2%
hypot-def86.9%
*-commutative86.9%
Simplified86.9%
if 3.59999999999999996e31 < y.re Initial program 30.9%
fma-def30.9%
hypot-udef56.0%
*-commutative56.0%
add-sqr-sqrt38.2%
sqrt-unprod75.1%
pow275.1%
fma-udef75.1%
*-commutative75.1%
*-commutative75.1%
fma-def75.1%
Applied egg-rr75.1%
unpow275.1%
rem-sqrt-square75.1%
*-commutative75.1%
hypot-def33.8%
unpow233.8%
unpow233.8%
+-commutative33.8%
unpow233.8%
unpow233.8%
hypot-def75.1%
Simplified75.1%
Final simplification84.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_1 (exp (- (* y.re t_0) (* (atan2 x.im x.re) y.im)))))
(if (<= (* t_1 (cos (+ (* y.re (atan2 x.im x.re)) (* t_0 y.im)))) INFINITY)
(* t_1 (cos (* y.im (log (hypot x.im x.re)))))
(/ (pow (hypot x.re x.im) y.re) (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 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_1 = exp(((y_46_re * t_0) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if ((t_1 * cos(((y_46_re * atan2(x_46_im, x_46_re)) + (t_0 * y_46_im)))) <= ((double) INFINITY)) {
tmp = t_1 * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
} else {
tmp = pow(hypot(x_46_re, x_46_im), y_46_re) / 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 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_1 = Math.exp(((y_46_re * t_0) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if ((t_1 * Math.cos(((y_46_re * Math.atan2(x_46_im, x_46_re)) + (t_0 * y_46_im)))) <= Double.POSITIVE_INFINITY) {
tmp = t_1 * Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))));
} else {
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));
}
return tmp;
}
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)))) t_1 = math.exp(((y_46_re * t_0) - (math.atan2(x_46_im, x_46_re) * y_46_im))) tmp = 0 if (t_1 * math.cos(((y_46_re * math.atan2(x_46_im, x_46_re)) + (t_0 * y_46_im)))) <= math.inf: tmp = t_1 * math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) else: 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)) return tmp
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)))) t_1 = exp(Float64(Float64(y_46_re * t_0) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (Float64(t_1 * cos(Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) + Float64(t_0 * y_46_im)))) <= Inf) tmp = Float64(t_1 * cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re))))); else tmp = Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(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 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); t_1 = exp(((y_46_re * t_0) - (atan2(x_46_im, x_46_re) * y_46_im))); tmp = 0.0; if ((t_1 * cos(((y_46_re * atan2(x_46_im, x_46_re)) + (t_0 * y_46_im)))) <= Inf) tmp = t_1 * cos((y_46_im * log(hypot(x_46_im, x_46_re)))); else tmp = (hypot(x_46_re, x_46_im) ^ y_46_re) / (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[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(y$46$re * t$95$0), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$1 * N[Cos[N[(N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], Infinity], 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[(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]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_1 := e^{y.re \cdot t_0 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;t_1 \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + t_0 \cdot y.im\right) \leq \infty:\\
\;\;\;\;t_1 \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\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}}}\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < +inf.0Initial program 78.8%
Taylor expanded in y.re around 0 81.9%
unpow281.9%
unpow281.9%
hypot-def81.9%
Simplified81.9%
if +inf.0 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) Initial program 0.0%
exp-diff0.0%
exp-to-pow0.0%
hypot-def0.0%
*-commutative0.0%
exp-prod0.0%
fma-def0.0%
hypot-def72.5%
*-commutative72.5%
Simplified72.5%
Taylor expanded in y.im around 0 73.1%
Taylor expanded in y.re around 0 78.4%
Final simplification80.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im))))
(if (or (<= y.im -1e-77) (not (<= y.im 1.6e+18)))
(*
(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)))))
(*
(cos (cbrt (pow (* y.im (log (hypot x.im x.re))) 3.0)))
(/ (pow (hypot x.re x.im) y.re) (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 = log(hypot(x_46_re, x_46_im));
double tmp;
if ((y_46_im <= -1e-77) || !(y_46_im <= 1.6e+18)) {
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 = cos(cbrt(pow((y_46_im * log(hypot(x_46_im, x_46_re))), 3.0))) * (pow(hypot(x_46_re, x_46_im), y_46_re) / pow(exp(y_46_im), 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)) tmp = 0.0 if ((y_46_im <= -1e-77) || !(y_46_im <= 1.6e+18)) 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(cos(cbrt((Float64(y_46_im * log(hypot(x_46_im, x_46_re))) ^ 3.0))) * Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ 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]}, If[Or[LessEqual[y$46$im, -1e-77], N[Not[LessEqual[y$46$im, 1.6e+18]], $MachinePrecision]], N[(N[Exp[N[(t$95$0 * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$0 * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[Power[N[Power[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
\mathbf{if}\;y.im \leq -1 \cdot 10^{-77} \lor \neg \left(y.im \leq 1.6 \cdot 10^{+18}\right):\\
\;\;\;\;e^{\mathsf{fma}\left(t_0, y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \cdot \cos \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\sqrt[3]{{\left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}^{3}}\right) \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}\\
\end{array}
\end{array}
if y.im < -9.9999999999999993e-78 or 1.6e18 < y.im Initial program 33.6%
fma-neg33.6%
hypot-def33.6%
distribute-rgt-neg-out33.6%
fma-def33.6%
hypot-def74.0%
*-commutative74.0%
Simplified74.0%
if -9.9999999999999993e-78 < y.im < 1.6e18Initial program 44.9%
exp-diff44.9%
exp-to-pow44.9%
hypot-def44.9%
*-commutative44.9%
exp-prod44.9%
fma-def44.9%
hypot-def83.9%
*-commutative83.9%
Simplified83.9%
add-cbrt-cube69.5%
pow369.5%
fma-udef69.5%
*-commutative69.5%
*-commutative69.5%
fma-def69.5%
Applied egg-rr69.5%
Taylor expanded in y.im around inf 47.5%
*-commutative47.5%
+-commutative47.5%
unpow247.5%
unpow247.5%
hypot-def93.1%
cube-prod93.9%
*-commutative93.9%
hypot-def48.3%
unpow248.3%
unpow248.3%
+-commutative48.3%
unpow248.3%
unpow248.3%
hypot-def93.9%
Simplified93.9%
Final simplification83.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= y.re -4.2e+27)
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(cos t_0))
(if (<= y.re 9.8e+22)
(*
(cos (fma (log (hypot x.re x.im)) y.im t_0))
(/ (pow (hypot x.re x.im) y.re) (pow (exp y.im) (atan2 x.im x.re))))
(pow (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 t_0 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_re <= -4.2e+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))) * cos(t_0);
} else if (y_46_re <= 9.8e+22) {
tmp = cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_0)) * (pow(hypot(x_46_re, x_46_im), y_46_re) / pow(exp(y_46_im), atan2(x_46_im, x_46_re)));
} else {
tmp = pow(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) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_re <= -4.2e+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))) * cos(t_0)); elseif (y_46_re <= 9.8e+22) tmp = Float64(cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_0)) * Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan(x_46_im, x_46_re)))); else tmp = hypot(x_46_im, x_46_re) ^ y_46_re; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -4.2e+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] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 9.8e+22], N[(N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im + t$95$0), $MachinePrecision]], $MachinePrecision] * N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.re \leq -4.2 \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 \cos t_0\\
\mathbf{elif}\;y.re \leq 9.8 \cdot 10^{+22}:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t_0\right)\right) \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.re < -4.19999999999999989e27Initial program 50.0%
Taylor expanded in y.im around 0 85.0%
if -4.19999999999999989e27 < y.re < 9.79999999999999958e22Initial program 39.4%
exp-diff39.4%
exp-to-pow39.4%
hypot-def39.4%
*-commutative39.4%
exp-prod39.2%
fma-def39.2%
hypot-def85.3%
*-commutative85.3%
Simplified85.3%
if 9.79999999999999958e22 < y.re Initial program 30.9%
exp-diff19.1%
exp-to-pow19.1%
hypot-def19.1%
*-commutative19.1%
exp-prod19.1%
fma-def19.1%
hypot-def41.2%
*-commutative41.2%
Simplified41.2%
Taylor expanded in y.im around 0 57.5%
unpow257.5%
unpow257.5%
hypot-def57.5%
Simplified57.5%
Taylor expanded in y.re around 0 72.2%
Final simplification81.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (cos (* y.re (atan2 x.im x.re)))))
(if (<= y.re -1e+28)
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
t_0)
(if (<= y.re 1.35e+24)
(*
t_0
(/ (pow (hypot x.re x.im) y.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 t_0 = cos((y_46_re * atan2(x_46_im, x_46_re)));
double tmp;
if (y_46_re <= -1e+28) {
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_0;
} else if (y_46_re <= 1.35e+24) {
tmp = t_0 * (pow(hypot(x_46_re, x_46_im), y_46_re) / pow(exp(y_46_im), atan2(x_46_im, x_46_re)));
} else {
tmp = pow(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 t_0 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
double tmp;
if (y_46_re <= -1e+28) {
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_0;
} else if (y_46_re <= 1.35e+24) {
tmp = t_0 * (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.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): t_0 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) tmp = 0 if y_46_re <= -1e+28: 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_0 elif y_46_re <= 1.35e+24: tmp = t_0 * (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.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) t_0 = cos(Float64(y_46_re * atan(x_46_im, x_46_re))) tmp = 0.0 if (y_46_re <= -1e+28) 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_0); elseif (y_46_re <= 1.35e+24) tmp = Float64(t_0 * Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan(x_46_im, x_46_re)))); else tmp = 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) t_0 = cos((y_46_re * atan2(x_46_im, x_46_re))); tmp = 0.0; if (y_46_re <= -1e+28) 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_0; elseif (y_46_re <= 1.35e+24) tmp = t_0 * ((hypot(x_46_re, x_46_im) ^ y_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_] := Block[{t$95$0 = N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -1e+28], 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$0), $MachinePrecision], If[LessEqual[y$46$re, 1.35e+24], N[(t$95$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]), $MachinePrecision], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;y.re \leq -1 \cdot 10^{+28}:\\
\;\;\;\;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_0\\
\mathbf{elif}\;y.re \leq 1.35 \cdot 10^{+24}:\\
\;\;\;\;t_0 \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.re < -9.99999999999999958e27Initial program 50.0%
Taylor expanded in y.im around 0 85.0%
if -9.99999999999999958e27 < y.re < 1.35e24Initial program 39.4%
exp-diff39.4%
exp-to-pow39.4%
hypot-def39.4%
*-commutative39.4%
exp-prod39.2%
fma-def39.2%
hypot-def85.3%
*-commutative85.3%
Simplified85.3%
Taylor expanded in y.im around 0 84.1%
if 1.35e24 < y.re Initial program 30.9%
exp-diff19.1%
exp-to-pow19.1%
hypot-def19.1%
*-commutative19.1%
exp-prod19.1%
fma-def19.1%
hypot-def41.2%
*-commutative41.2%
Simplified41.2%
Taylor expanded in y.im around 0 57.5%
unpow257.5%
unpow257.5%
hypot-def57.5%
Simplified57.5%
Taylor expanded in y.re around 0 72.2%
Final simplification81.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (cos (* y.re (atan2 x.im x.re))))
(t_1
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
t_0))
(t_2 (pow (hypot x.im x.re) y.re)))
(if (<= y.re -4.1e+27)
t_1
(if (<= y.re 7.2e+52)
(/ (pow (hypot x.re x.im) y.re) (pow (exp y.im) (atan2 x.im x.re)))
(if (<= y.re 1e+97) t_1 (if (<= y.re 2.2e+216) t_2 (* t_0 t_2)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = cos((y_46_re * atan2(x_46_im, x_46_re)));
double t_1 = 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_0;
double t_2 = pow(hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if (y_46_re <= -4.1e+27) {
tmp = t_1;
} else if (y_46_re <= 7.2e+52) {
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 if (y_46_re <= 1e+97) {
tmp = t_1;
} else if (y_46_re <= 2.2e+216) {
tmp = t_2;
} else {
tmp = t_0 * 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.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
double t_1 = 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_0;
double t_2 = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if (y_46_re <= -4.1e+27) {
tmp = t_1;
} else if (y_46_re <= 7.2e+52) {
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 if (y_46_re <= 1e+97) {
tmp = t_1;
} else if (y_46_re <= 2.2e+216) {
tmp = t_2;
} else {
tmp = t_0 * t_2;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) t_1 = 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_0 t_2 = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) tmp = 0 if y_46_re <= -4.1e+27: tmp = t_1 elif y_46_re <= 7.2e+52: 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)) elif y_46_re <= 1e+97: tmp = t_1 elif y_46_re <= 2.2e+216: tmp = t_2 else: tmp = t_0 * t_2 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos(Float64(y_46_re * atan(x_46_im, x_46_re))) t_1 = 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_0) t_2 = hypot(x_46_im, x_46_re) ^ y_46_re tmp = 0.0 if (y_46_re <= -4.1e+27) tmp = t_1; elseif (y_46_re <= 7.2e+52) tmp = Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan(x_46_im, x_46_re))); elseif (y_46_re <= 1e+97) tmp = t_1; elseif (y_46_re <= 2.2e+216) tmp = t_2; else tmp = Float64(t_0 * t_2); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos((y_46_re * atan2(x_46_im, x_46_re))); t_1 = 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_0; t_2 = hypot(x_46_im, x_46_re) ^ y_46_re; tmp = 0.0; if (y_46_re <= -4.1e+27) tmp = t_1; elseif (y_46_re <= 7.2e+52) tmp = (hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan2(x_46_im, x_46_re)); elseif (y_46_re <= 1e+97) tmp = t_1; elseif (y_46_re <= 2.2e+216) tmp = t_2; else tmp = t_0 * 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[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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$0), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, If[LessEqual[y$46$re, -4.1e+27], t$95$1, If[LessEqual[y$46$re, 7.2e+52], 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], If[LessEqual[y$46$re, 1e+97], t$95$1, If[LessEqual[y$46$re, 2.2e+216], t$95$2, N[(t$95$0 * t$95$2), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
t_1 := 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_0\\
t_2 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{if}\;y.re \leq -4.1 \cdot 10^{+27}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y.re \leq 7.2 \cdot 10^{+52}:\\
\;\;\;\;\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{elif}\;y.re \leq 10^{+97}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y.re \leq 2.2 \cdot 10^{+216}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot t_2\\
\end{array}
\end{array}
if y.re < -4.1000000000000002e27 or 7.2e52 < y.re < 1.0000000000000001e97Initial program 53.1%
Taylor expanded in y.im around 0 87.8%
if -4.1000000000000002e27 < y.re < 7.2e52Initial program 37.9%
exp-diff37.9%
exp-to-pow37.9%
hypot-def37.9%
*-commutative37.9%
exp-prod37.7%
fma-def37.7%
hypot-def82.0%
*-commutative82.0%
Simplified82.0%
Taylor expanded in y.im around 0 81.5%
Taylor expanded in y.re around 0 81.3%
if 1.0000000000000001e97 < y.re < 2.2e216Initial program 17.6%
exp-diff11.8%
exp-to-pow11.8%
hypot-def11.8%
*-commutative11.8%
exp-prod11.8%
fma-def11.8%
hypot-def38.2%
*-commutative38.2%
Simplified38.2%
Taylor expanded in y.im around 0 41.4%
unpow241.4%
unpow241.4%
hypot-def41.4%
Simplified41.4%
Taylor expanded in y.re around 0 79.6%
if 2.2e216 < y.re Initial program 47.4%
exp-diff31.6%
exp-to-pow31.6%
hypot-def31.6%
*-commutative31.6%
exp-prod31.6%
fma-def31.6%
hypot-def52.6%
*-commutative52.6%
Simplified52.6%
Taylor expanded in y.im around 0 84.2%
unpow284.2%
unpow284.2%
hypot-def84.2%
Simplified84.2%
Final simplification82.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (exp y.im) (atan2 x.im x.re))))
(if (<= x.im -2.2e-59)
(/
(cos (* y.re (atan2 x.im x.re)))
(exp (+ (* (atan2 x.im x.re) y.im) (* y.re (log (/ -1.0 x.im))))))
(if (or (<= x.im 9.5e-228) (not (<= x.im 8.5e-204)))
(/ (pow (hypot x.re x.im) y.re) t_0)
(/ (cos (* y.im (log x.im))) t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(exp(y_46_im), atan2(x_46_im, x_46_re));
double tmp;
if (x_46_im <= -2.2e-59) {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) / exp(((atan2(x_46_im, x_46_re) * y_46_im) + (y_46_re * log((-1.0 / x_46_im)))));
} else if ((x_46_im <= 9.5e-228) || !(x_46_im <= 8.5e-204)) {
tmp = pow(hypot(x_46_re, x_46_im), y_46_re) / t_0;
} else {
tmp = cos((y_46_im * log(x_46_im))) / 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.exp(y_46_im), Math.atan2(x_46_im, x_46_re));
double tmp;
if (x_46_im <= -2.2e-59) {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) / Math.exp(((Math.atan2(x_46_im, x_46_re) * y_46_im) + (y_46_re * Math.log((-1.0 / x_46_im)))));
} else if ((x_46_im <= 9.5e-228) || !(x_46_im <= 8.5e-204)) {
tmp = Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re) / t_0;
} else {
tmp = Math.cos((y_46_im * Math.log(x_46_im))) / t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.pow(math.exp(y_46_im), math.atan2(x_46_im, x_46_re)) tmp = 0 if x_46_im <= -2.2e-59: tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) / math.exp(((math.atan2(x_46_im, x_46_re) * y_46_im) + (y_46_re * math.log((-1.0 / x_46_im))))) elif (x_46_im <= 9.5e-228) or not (x_46_im <= 8.5e-204): tmp = math.pow(math.hypot(x_46_re, x_46_im), y_46_re) / t_0 else: tmp = math.cos((y_46_im * math.log(x_46_im))) / t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp(y_46_im) ^ atan(x_46_im, x_46_re) tmp = 0.0 if (x_46_im <= -2.2e-59) tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) / exp(Float64(Float64(atan(x_46_im, x_46_re) * y_46_im) + Float64(y_46_re * log(Float64(-1.0 / x_46_im)))))); elseif ((x_46_im <= 9.5e-228) || !(x_46_im <= 8.5e-204)) tmp = Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / t_0); else tmp = Float64(cos(Float64(y_46_im * log(x_46_im))) / t_0); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp(y_46_im) ^ atan2(x_46_im, x_46_re); tmp = 0.0; if (x_46_im <= -2.2e-59) tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) / exp(((atan2(x_46_im, x_46_re) * y_46_im) + (y_46_re * log((-1.0 / x_46_im))))); elseif ((x_46_im <= 9.5e-228) || ~((x_46_im <= 8.5e-204))) tmp = (hypot(x_46_re, x_46_im) ^ y_46_re) / t_0; else tmp = cos((y_46_im * log(x_46_im))) / t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -2.2e-59], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Exp[N[(N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision] + N[(y$46$re * N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x$46$im, 9.5e-228], N[Not[LessEqual[x$46$im, 8.5e-204]], $MachinePrecision]], N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[Cos[N[(y$46$im * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{if}\;x.im \leq -2.2 \cdot 10^{-59}:\\
\;\;\;\;\frac{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im + y.re \cdot \log \left(\frac{-1}{x.im}\right)}}\\
\mathbf{elif}\;x.im \leq 9.5 \cdot 10^{-228} \lor \neg \left(x.im \leq 8.5 \cdot 10^{-204}\right):\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(y.im \cdot \log x.im\right)}{t_0}\\
\end{array}
\end{array}
if x.im < -2.1999999999999999e-59Initial program 30.0%
exp-diff26.3%
exp-to-pow26.3%
hypot-def26.3%
*-commutative26.3%
exp-prod26.0%
fma-def26.0%
hypot-def67.9%
*-commutative67.9%
Simplified67.9%
Taylor expanded in x.im around -inf 67.2%
associate-/l*67.2%
+-commutative67.2%
mul-1-neg67.2%
unsub-neg67.2%
div-exp73.4%
mul-1-neg73.4%
distribute-rgt-neg-in73.4%
Simplified73.4%
Taylor expanded in y.im around 0 80.9%
if -2.1999999999999999e-59 < x.im < 9.50000000000000024e-228 or 8.4999999999999997e-204 < x.im Initial program 41.3%
exp-diff37.1%
exp-to-pow37.1%
hypot-def37.1%
*-commutative37.1%
exp-prod37.1%
fma-def37.1%
hypot-def72.6%
*-commutative72.6%
Simplified72.6%
Taylor expanded in y.im around 0 72.5%
Taylor expanded in y.re around 0 79.2%
if 9.50000000000000024e-228 < x.im < 8.4999999999999997e-204Initial program 75.0%
exp-diff50.0%
exp-to-pow50.0%
hypot-def50.0%
*-commutative50.0%
exp-prod50.0%
fma-def50.0%
hypot-def62.5%
*-commutative62.5%
Simplified62.5%
Taylor expanded in y.re around 0 62.9%
unpow262.9%
unpow262.9%
hypot-def75.5%
exp-prod87.6%
Simplified87.6%
Taylor expanded in x.im around inf 87.6%
mul-1-neg87.6%
distribute-rgt-neg-in87.6%
log-rec87.6%
remove-double-neg87.6%
Simplified87.6%
Final simplification80.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot x.im x.re) y.re)))
(if (<= y.re 7.2e+52)
(/ (pow (hypot x.re x.im) y.re) (pow (exp y.im) (atan2 x.im x.re)))
(if (or (<= y.re 2.5e+96) (not (<= y.re 1e+207)))
(* (cos (* y.re (atan2 x.im x.re))) t_0)
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 (y_46_re <= 7.2e+52) {
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 if ((y_46_re <= 2.5e+96) || !(y_46_re <= 1e+207)) {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * t_0;
} else {
tmp = 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 (y_46_re <= 7.2e+52) {
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 if ((y_46_re <= 2.5e+96) || !(y_46_re <= 1e+207)) {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * t_0;
} else {
tmp = 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 y_46_re <= 7.2e+52: 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)) elif (y_46_re <= 2.5e+96) or not (y_46_re <= 1e+207): tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * t_0 else: tmp = 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 (y_46_re <= 7.2e+52) tmp = Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan(x_46_im, x_46_re))); elseif ((y_46_re <= 2.5e+96) || !(y_46_re <= 1e+207)) tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * t_0); else tmp = 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 (y_46_re <= 7.2e+52) tmp = (hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan2(x_46_im, x_46_re)); elseif ((y_46_re <= 2.5e+96) || ~((y_46_re <= 1e+207))) tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * t_0; else tmp = 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[y$46$re, 7.2e+52], 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], If[Or[LessEqual[y$46$re, 2.5e+96], N[Not[LessEqual[y$46$re, 1e+207]], $MachinePrecision]], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{if}\;y.re \leq 7.2 \cdot 10^{+52}:\\
\;\;\;\;\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{elif}\;y.re \leq 2.5 \cdot 10^{+96} \lor \neg \left(y.re \leq 10^{+207}\right):\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y.re < 7.2e52Initial program 40.4%
exp-diff38.3%
exp-to-pow38.3%
hypot-def38.3%
*-commutative38.3%
exp-prod38.2%
fma-def38.2%
hypot-def79.0%
*-commutative79.0%
Simplified79.0%
Taylor expanded in y.im around 0 79.6%
Taylor expanded in y.re around 0 80.0%
if 7.2e52 < y.re < 2.5000000000000002e96 or 1e207 < y.re Initial program 53.6%
exp-diff32.1%
exp-to-pow32.1%
hypot-def32.1%
*-commutative32.1%
exp-prod32.1%
fma-def32.1%
hypot-def53.6%
*-commutative53.6%
Simplified53.6%
Taylor expanded in y.im around 0 85.8%
unpow285.8%
unpow285.8%
hypot-def85.8%
Simplified85.8%
if 2.5000000000000002e96 < y.re < 1e207Initial program 17.6%
exp-diff11.8%
exp-to-pow11.8%
hypot-def11.8%
*-commutative11.8%
exp-prod11.8%
fma-def11.8%
hypot-def38.2%
*-commutative38.2%
Simplified38.2%
Taylor expanded in y.im around 0 41.4%
unpow241.4%
unpow241.4%
hypot-def41.4%
Simplified41.4%
Taylor expanded in y.re around 0 79.6%
Final simplification80.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot x.im x.re) y.re)))
(if (<= y.re -1e-21)
(* (cos (* y.re (atan2 x.im x.re))) t_0)
(if (<= y.re 0.01) (/ 1.0 (pow (exp y.im) (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 (y_46_re <= -1e-21) {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * t_0;
} else if (y_46_re <= 0.01) {
tmp = 1.0 / pow(exp(y_46_im), atan2(x_46_im, x_46_re));
} else {
tmp = 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 (y_46_re <= -1e-21) {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * t_0;
} else if (y_46_re <= 0.01) {
tmp = 1.0 / Math.pow(Math.exp(y_46_im), Math.atan2(x_46_im, x_46_re));
} else {
tmp = 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 y_46_re <= -1e-21: tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * t_0 elif y_46_re <= 0.01: tmp = 1.0 / math.pow(math.exp(y_46_im), math.atan2(x_46_im, x_46_re)) else: tmp = 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 (y_46_re <= -1e-21) tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * t_0); elseif (y_46_re <= 0.01) tmp = Float64(1.0 / (exp(y_46_im) ^ atan(x_46_im, x_46_re))); else tmp = 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 (y_46_re <= -1e-21) tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * t_0; elseif (y_46_re <= 0.01) tmp = 1.0 / (exp(y_46_im) ^ atan2(x_46_im, x_46_re)); else tmp = 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[y$46$re, -1e-21], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[y$46$re, 0.01], N[(1.0 / N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{if}\;y.re \leq -1 \cdot 10^{-21}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot t_0\\
\mathbf{elif}\;y.re \leq 0.01:\\
\;\;\;\;\frac{1}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y.re < -9.99999999999999908e-22Initial program 49.0%
exp-diff41.5%
exp-to-pow41.5%
hypot-def41.5%
*-commutative41.5%
exp-prod41.5%
fma-def41.5%
hypot-def73.6%
*-commutative73.6%
Simplified73.6%
Taylor expanded in y.im around 0 79.4%
unpow279.4%
unpow279.4%
hypot-def81.2%
Simplified81.2%
if -9.99999999999999908e-22 < y.re < 0.0100000000000000002Initial program 39.0%
exp-diff39.0%
exp-to-pow39.0%
hypot-def39.0%
*-commutative39.0%
exp-prod38.8%
fma-def38.8%
hypot-def84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in y.re around 0 38.7%
unpow238.7%
unpow238.7%
hypot-def84.6%
exp-prod84.0%
Simplified84.0%
Taylor expanded in y.im around 0 83.3%
if 0.0100000000000000002 < y.re Initial program 31.1%
exp-diff20.3%
exp-to-pow20.3%
hypot-def20.3%
*-commutative20.3%
exp-prod20.3%
fma-def20.3%
hypot-def44.6%
*-commutative44.6%
Simplified44.6%
Taylor expanded in y.im around 0 58.3%
unpow258.3%
unpow258.3%
hypot-def59.6%
Simplified59.6%
Taylor expanded in y.re around 0 69.5%
Final simplification78.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -1.5e-21) (not (<= y.re 0.0037))) (pow (hypot x.im x.re) y.re) (/ 1.0 (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 tmp;
if ((y_46_re <= -1.5e-21) || !(y_46_re <= 0.0037)) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = 1.0 / 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 tmp;
if ((y_46_re <= -1.5e-21) || !(y_46_re <= 0.0037)) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = 1.0 / 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): tmp = 0 if (y_46_re <= -1.5e-21) or not (y_46_re <= 0.0037): tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = 1.0 / 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) tmp = 0.0 if ((y_46_re <= -1.5e-21) || !(y_46_re <= 0.0037)) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = Float64(1.0 / (exp(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) tmp = 0.0; if ((y_46_re <= -1.5e-21) || ~((y_46_re <= 0.0037))) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = 1.0 / (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_] := If[Or[LessEqual[y$46$re, -1.5e-21], N[Not[LessEqual[y$46$re, 0.0037]], $MachinePrecision]], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], N[(1.0 / 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}
\mathbf{if}\;y.re \leq -1.5 \cdot 10^{-21} \lor \neg \left(y.re \leq 0.0037\right):\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}}\\
\end{array}
\end{array}
if y.re < -1.49999999999999996e-21 or 0.0037000000000000002 < y.re Initial program 38.6%
exp-diff29.1%
exp-to-pow29.1%
hypot-def29.1%
*-commutative29.1%
exp-prod29.1%
fma-def29.1%
hypot-def56.7%
*-commutative56.7%
Simplified56.7%
Taylor expanded in y.im around 0 67.1%
unpow267.1%
unpow267.1%
hypot-def68.6%
Simplified68.6%
Taylor expanded in y.re around 0 74.0%
if -1.49999999999999996e-21 < y.re < 0.0037000000000000002Initial program 39.0%
exp-diff39.0%
exp-to-pow39.0%
hypot-def39.0%
*-commutative39.0%
exp-prod38.8%
fma-def38.8%
hypot-def84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in y.re around 0 38.7%
unpow238.7%
unpow238.7%
hypot-def84.6%
exp-prod84.0%
Simplified84.0%
Taylor expanded in y.im around 0 83.3%
Final simplification78.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 38.8%
exp-diff34.1%
exp-to-pow34.1%
hypot-def34.1%
*-commutative34.1%
exp-prod34.0%
fma-def34.0%
hypot-def70.8%
*-commutative70.8%
Simplified70.8%
Taylor expanded in y.im around 0 52.6%
unpow252.6%
unpow252.6%
hypot-def61.0%
Simplified61.0%
Taylor expanded in y.re around 0 63.7%
Final simplification63.7%
herbie shell --seed 2023298
(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)))))