
(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 13 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 (log (hypot x.im x.re)))
(t_2
(exp
(fma (log (hypot x.re x.im)) y.re (* y.im (- (atan2 x.im x.re)))))))
(if (<= y.im -2.1e+14)
(* t_2 (- (cos t_0) (* y.im (* t_1 (sin t_0)))))
(* t_2 (cos (* y.im t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = log(hypot(x_46_im, x_46_re));
double t_2 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (y_46_im * -atan2(x_46_im, x_46_re))));
double tmp;
if (y_46_im <= -2.1e+14) {
tmp = t_2 * (cos(t_0) - (y_46_im * (t_1 * sin(t_0))));
} else {
tmp = t_2 * cos((y_46_im * t_1));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = log(hypot(x_46_im, x_46_re)) t_2 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))) tmp = 0.0 if (y_46_im <= -2.1e+14) tmp = Float64(t_2 * Float64(cos(t_0) - Float64(y_46_im * Float64(t_1 * sin(t_0))))); else tmp = Float64(t_2 * cos(Float64(y_46_im * t_1))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$im, -2.1e+14], N[(t$95$2 * N[(N[Cos[t$95$0], $MachinePrecision] - N[(y$46$im * N[(t$95$1 * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[Cos[N[(y$46$im * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_2 := e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\\
\mathbf{if}\;y.im \leq -2.1 \cdot 10^{+14}:\\
\;\;\;\;t_2 \cdot \left(\cos t_0 - y.im \cdot \left(t_1 \cdot \sin t_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \cos \left(y.im \cdot t_1\right)\\
\end{array}
\end{array}
if y.im < -2.1e14Initial program 27.1%
cancel-sign-sub-inv27.1%
fma-def27.1%
hypot-def27.1%
distribute-lft-neg-in27.1%
distribute-rgt-neg-out27.1%
fma-def27.1%
hypot-def57.8%
*-commutative57.8%
Simplified57.8%
add-sqr-sqrt21.5%
pow221.5%
fma-udef21.5%
*-commutative21.5%
*-commutative21.5%
fma-def21.5%
Applied egg-rr21.5%
Taylor expanded in y.im around 0 47.1%
mul-1-neg47.1%
unsub-neg47.1%
*-commutative47.1%
unpow247.1%
unpow247.1%
hypot-def70.9%
*-commutative70.9%
Simplified70.9%
if -2.1e14 < y.im Initial program 49.4%
cancel-sign-sub-inv49.4%
fma-def49.4%
hypot-def49.4%
distribute-lft-neg-in49.4%
distribute-rgt-neg-out49.4%
fma-def49.4%
hypot-def88.9%
*-commutative88.9%
Simplified88.9%
Taylor expanded in y.im around inf 51.6%
unpow251.6%
unpow251.6%
hypot-def92.6%
Simplified92.6%
Final simplification87.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= x.im -2.45e-260)
(*
(exp (fma (log (hypot x.re x.im)) y.re (* y.im (- (atan2 x.im x.re)))))
(cos (* y.im (- (log (/ -1.0 x.im))))))
(if (<= x.im 2.9e-63)
(*
(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))))
(*
(cos (* y.re (atan2 x.im x.re)))
(exp (- (* y.re (log x.im)) (* 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 (x_46_im <= -2.45e-260) {
tmp = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (y_46_im * -atan2(x_46_im, x_46_re)))) * cos((y_46_im * -log((-1.0 / x_46_im))));
} else if (x_46_im <= 2.9e-63) {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * (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 = cos((y_46_re * atan2(x_46_im, x_46_re))) * exp(((y_46_re * log(x_46_im)) - (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) tmp = 0.0 if (x_46_im <= -2.45e-260) tmp = Float64(exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))) * cos(Float64(y_46_im * Float64(-log(Float64(-1.0 / x_46_im)))))); elseif (x_46_im <= 2.9e-63) tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * 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(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * exp(Float64(Float64(y_46_re * log(x_46_im)) - Float64(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_] := If[LessEqual[x$46$im, -2.45e-260], N[(N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * (-N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 2.9e-63], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $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]), $MachinePrecision], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -2.45 \cdot 10^{-260}:\\
\;\;\;\;e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \cdot \cos \left(y.im \cdot \left(-\log \left(\frac{-1}{x.im}\right)\right)\right)\\
\mathbf{elif}\;x.im \leq 2.9 \cdot 10^{-63}:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\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}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log x.im - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\end{array}
\end{array}
if x.im < -2.4500000000000001e-260Initial program 46.2%
cancel-sign-sub-inv46.2%
fma-def46.2%
hypot-def46.2%
distribute-lft-neg-in46.2%
distribute-rgt-neg-out46.2%
fma-def46.2%
hypot-def82.8%
*-commutative82.8%
Simplified82.8%
Taylor expanded in y.im around inf 45.7%
unpow245.7%
unpow245.7%
hypot-def86.3%
Simplified86.3%
Taylor expanded in x.im around -inf 87.4%
associate-*r*87.4%
neg-mul-187.4%
Simplified87.4%
if -2.4500000000000001e-260 < x.im < 2.89999999999999975e-63Initial program 51.5%
exp-diff51.5%
exp-to-pow51.5%
hypot-def51.5%
*-commutative51.5%
exp-prod49.9%
fma-def49.9%
hypot-def78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in y.im around inf 54.6%
unpow256.2%
unpow256.2%
hypot-def87.5%
Simplified82.7%
if 2.89999999999999975e-63 < x.im Initial program 34.5%
Taylor expanded in y.im around 0 64.6%
Taylor expanded in x.re around 0 82.5%
Final simplification84.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (exp (fma (log (hypot x.re x.im)) y.re (* y.im (- (atan2 x.im x.re))))) (cos (* y.im (log (hypot x.im x.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (y_46_im * -atan2(x_46_im, x_46_re)))) * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))) * cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re))))) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)
\end{array}
Initial program 44.5%
cancel-sign-sub-inv44.5%
fma-def44.5%
hypot-def44.5%
distribute-lft-neg-in44.5%
distribute-rgt-neg-out44.5%
fma-def44.5%
hypot-def82.1%
*-commutative82.1%
Simplified82.1%
Taylor expanded in y.im around inf 46.2%
unpow246.2%
unpow246.2%
hypot-def86.2%
Simplified86.2%
Final simplification86.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (atan2 x.im x.re))))
(if (<= x.im -1.96e-292)
(*
(exp (fma (log (hypot x.re x.im)) y.re (* y.im (- (atan2 x.im x.re)))))
(cos (* y.im (- (log (/ -1.0 x.im))))))
(if (<= x.im 2.9e-38)
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_0))
(*
(cos (* y.re (atan2 x.im x.re)))
(exp (- (* y.re (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 = y_46_im * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_im <= -1.96e-292) {
tmp = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (y_46_im * -atan2(x_46_im, x_46_re)))) * cos((y_46_im * -log((-1.0 / x_46_im))));
} else if (x_46_im <= 2.9e-38) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
} else {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * exp(((y_46_re * log(x_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_im * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_im <= -1.96e-292) tmp = Float64(exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))) * cos(Float64(y_46_im * Float64(-log(Float64(-1.0 / x_46_im)))))); elseif (x_46_im <= 2.9e-38) 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)); else tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * exp(Float64(Float64(y_46_re * log(x_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$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, -1.96e-292], N[(N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * (-N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 2.9e-38], 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], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.im \leq -1.96 \cdot 10^{-292}:\\
\;\;\;\;e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \cdot \cos \left(y.im \cdot \left(-\log \left(\frac{-1}{x.im}\right)\right)\right)\\
\mathbf{elif}\;x.im \leq 2.9 \cdot 10^{-38}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_0}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log x.im - t_0}\\
\end{array}
\end{array}
if x.im < -1.96e-292Initial program 45.3%
cancel-sign-sub-inv45.3%
fma-def45.3%
hypot-def45.3%
distribute-lft-neg-in45.3%
distribute-rgt-neg-out45.3%
fma-def45.3%
hypot-def82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in y.im around inf 45.6%
unpow245.6%
unpow245.6%
hypot-def86.5%
Simplified86.5%
Taylor expanded in x.im around -inf 86.7%
associate-*r*86.7%
neg-mul-186.7%
Simplified86.7%
if -1.96e-292 < x.im < 2.89999999999999994e-38Initial program 55.0%
Taylor expanded in y.im around 0 75.1%
Taylor expanded in y.re around 0 78.5%
if 2.89999999999999994e-38 < x.im Initial program 32.4%
Taylor expanded in y.im around 0 63.3%
Taylor expanded in x.re around 0 84.3%
Final simplification84.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -7.9e+24)
(pow (hypot x.im x.re) y.re)
(if (<= y.re 0.024)
(*
(cos (* y.im (log (hypot x.im x.re))))
(exp (* y.im (- (atan2 x.im x.re)))))
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* 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 <= -7.9e+24) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
} else if (y_46_re <= 0.024) {
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 = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (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 <= -7.9e+24) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else if (y_46_re <= 0.024) {
tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) * Math.exp((y_46_im * -Math.atan2(x_46_im, x_46_re)));
} else {
tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (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 <= -7.9e+24: tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) elif y_46_re <= 0.024: tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) * math.exp((y_46_im * -math.atan2(x_46_im, x_46_re))) else: tmp = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (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 <= -7.9e+24) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; elseif (y_46_re <= 0.024) tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))); else tmp = exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - Float64(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 <= -7.9e+24) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; elseif (y_46_re <= 0.024) 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 = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (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[LessEqual[y$46$re, -7.9e+24], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], If[LessEqual[y$46$re, 0.024], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -7.9 \cdot 10^{+24}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{elif}\;y.re \leq 0.024:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\end{array}
\end{array}
if y.re < -7.8999999999999997e24Initial program 39.1%
cancel-sign-sub-inv39.1%
fma-def39.1%
hypot-def39.1%
distribute-lft-neg-in39.1%
distribute-rgt-neg-out39.1%
fma-def39.1%
hypot-def89.1%
*-commutative89.1%
Simplified89.1%
Taylor expanded in y.im around inf 40.6%
unpow240.6%
unpow240.6%
hypot-def93.8%
Simplified93.8%
Taylor expanded in y.im around 0 90.7%
unpow290.7%
unpow290.7%
hypot-def90.7%
Simplified90.7%
if -7.8999999999999997e24 < y.re < 0.024Initial program 46.2%
cancel-sign-sub-inv46.2%
fma-def46.2%
hypot-def46.2%
distribute-lft-neg-in46.2%
distribute-rgt-neg-out46.2%
fma-def46.2%
hypot-def82.3%
*-commutative82.3%
Simplified82.3%
Taylor expanded in y.im around inf 45.8%
unpow245.8%
unpow245.8%
hypot-def81.8%
Simplified81.8%
Taylor expanded in y.re around 0 81.2%
neg-mul-181.2%
*-commutative81.2%
distribute-rgt-neg-in81.2%
Simplified81.2%
if 0.024 < y.re Initial program 46.6%
Taylor expanded in y.im around 0 72.5%
Taylor expanded in y.re around 0 81.1%
Final simplification83.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (cos (* y.im (log (hypot x.im x.re))))))
(if (<= y.re -7.8e+24)
(pow (hypot x.im x.re) y.re)
(if (<= y.re 2.75)
(* t_0 (exp (* y.im (- (atan2 x.im x.re)))))
(* t_0 (pow (hypot x.re x.im) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = cos((y_46_im * log(hypot(x_46_im, x_46_re))));
double tmp;
if (y_46_re <= -7.8e+24) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
} else if (y_46_re <= 2.75) {
tmp = t_0 * exp((y_46_im * -atan2(x_46_im, x_46_re)));
} else {
tmp = t_0 * pow(hypot(x_46_re, x_46_im), 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_im * Math.log(Math.hypot(x_46_im, x_46_re))));
double tmp;
if (y_46_re <= -7.8e+24) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else if (y_46_re <= 2.75) {
tmp = t_0 * Math.exp((y_46_im * -Math.atan2(x_46_im, x_46_re)));
} else {
tmp = t_0 * Math.pow(Math.hypot(x_46_re, x_46_im), 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_im * math.log(math.hypot(x_46_im, x_46_re)))) tmp = 0 if y_46_re <= -7.8e+24: tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) elif y_46_re <= 2.75: tmp = t_0 * math.exp((y_46_im * -math.atan2(x_46_im, x_46_re))) else: tmp = t_0 * math.pow(math.hypot(x_46_re, x_46_im), 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_im * log(hypot(x_46_im, x_46_re)))) tmp = 0.0 if (y_46_re <= -7.8e+24) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; elseif (y_46_re <= 2.75) tmp = Float64(t_0 * exp(Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))); else tmp = Float64(t_0 * (hypot(x_46_re, x_46_im) ^ 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_im * log(hypot(x_46_im, x_46_re)))); tmp = 0.0; if (y_46_re <= -7.8e+24) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; elseif (y_46_re <= 2.75) tmp = t_0 * exp((y_46_im * -atan2(x_46_im, x_46_re))); else tmp = t_0 * (hypot(x_46_re, x_46_im) ^ 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$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -7.8e+24], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], If[LessEqual[y$46$re, 2.75], N[(t$95$0 * N[Exp[N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{if}\;y.re \leq -7.8 \cdot 10^{+24}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{elif}\;y.re \leq 2.75:\\
\;\;\;\;t_0 \cdot e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.re < -7.7999999999999995e24Initial program 39.1%
cancel-sign-sub-inv39.1%
fma-def39.1%
hypot-def39.1%
distribute-lft-neg-in39.1%
distribute-rgt-neg-out39.1%
fma-def39.1%
hypot-def89.1%
*-commutative89.1%
Simplified89.1%
Taylor expanded in y.im around inf 40.6%
unpow240.6%
unpow240.6%
hypot-def93.8%
Simplified93.8%
Taylor expanded in y.im around 0 90.7%
unpow290.7%
unpow290.7%
hypot-def90.7%
Simplified90.7%
if -7.7999999999999995e24 < y.re < 2.75Initial program 46.2%
cancel-sign-sub-inv46.2%
fma-def46.2%
hypot-def46.2%
distribute-lft-neg-in46.2%
distribute-rgt-neg-out46.2%
fma-def46.2%
hypot-def82.3%
*-commutative82.3%
Simplified82.3%
Taylor expanded in y.im around inf 45.8%
unpow245.8%
unpow245.8%
hypot-def81.8%
Simplified81.8%
Taylor expanded in y.re around 0 81.2%
neg-mul-181.2%
*-commutative81.2%
distribute-rgt-neg-in81.2%
Simplified81.2%
if 2.75 < y.re Initial program 46.6%
exp-diff43.1%
exp-to-pow43.1%
hypot-def43.1%
*-commutative43.1%
exp-prod41.4%
fma-def41.4%
hypot-def62.1%
*-commutative62.1%
Simplified62.1%
Taylor expanded in y.im around inf 48.3%
unpow253.4%
unpow253.4%
hypot-def87.9%
Simplified74.1%
Taylor expanded in y.im around 0 81.1%
Final simplification83.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -1e-7)
(pow (hypot x.im x.re) y.re)
(if (<= y.re 1.32)
(exp (* y.im (- (atan2 x.im x.re))))
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* 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 <= -1e-7) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
} else if (y_46_re <= 1.32) {
tmp = exp((y_46_im * -atan2(x_46_im, x_46_re)));
} else {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (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 <= -1e-7) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else if (y_46_re <= 1.32) {
tmp = Math.exp((y_46_im * -Math.atan2(x_46_im, x_46_re)));
} else {
tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (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 <= -1e-7: tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) elif y_46_re <= 1.32: tmp = math.exp((y_46_im * -math.atan2(x_46_im, x_46_re))) else: tmp = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (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 <= -1e-7) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; elseif (y_46_re <= 1.32) tmp = exp(Float64(y_46_im * Float64(-atan(x_46_im, x_46_re)))); else tmp = exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - Float64(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 <= -1e-7) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; elseif (y_46_re <= 1.32) tmp = exp((y_46_im * -atan2(x_46_im, x_46_re))); else tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (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[LessEqual[y$46$re, -1e-7], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], If[LessEqual[y$46$re, 1.32], N[Exp[N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1 \cdot 10^{-7}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{elif}\;y.re \leq 1.32:\\
\;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\end{array}
\end{array}
if y.re < -9.9999999999999995e-8Initial program 38.9%
cancel-sign-sub-inv38.9%
fma-def38.9%
hypot-def38.9%
distribute-lft-neg-in38.9%
distribute-rgt-neg-out38.9%
fma-def38.9%
hypot-def86.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in y.im around inf 39.8%
unpow239.8%
unpow239.8%
hypot-def89.8%
Simplified89.8%
Taylor expanded in y.im around 0 84.4%
unpow284.4%
unpow284.4%
hypot-def84.4%
Simplified84.4%
if -9.9999999999999995e-8 < y.re < 1.32000000000000006Initial program 46.8%
Taylor expanded in y.im around 0 50.9%
Taylor expanded in y.re around 0 50.9%
unpow250.9%
unpow250.9%
swap-sqr50.9%
unpow250.9%
*-commutative50.9%
Simplified50.9%
Taylor expanded in y.re around 0 81.8%
distribute-rgt-neg-in81.8%
Simplified81.8%
if 1.32000000000000006 < y.re Initial program 46.6%
Taylor expanded in y.im around 0 72.5%
Taylor expanded in y.re around 0 81.1%
Final simplification82.4%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -2e-9) (not (<= y.re 6.8))) (pow (hypot x.im x.re) y.re) (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 <= -2e-9) || !(y_46_re <= 6.8)) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = 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 <= -2e-9) || !(y_46_re <= 6.8)) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = 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 <= -2e-9) or not (y_46_re <= 6.8): tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = 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 <= -2e-9) || !(y_46_re <= 6.8)) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = exp(Float64(y_46_im * Float64(-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 <= -2e-9) || ~((y_46_re <= 6.8))) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = 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, -2e-9], N[Not[LessEqual[y$46$re, 6.8]], $MachinePrecision]], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], N[Exp[N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -2 \cdot 10^{-9} \lor \neg \left(y.re \leq 6.8\right):\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\
\end{array}
\end{array}
if y.re < -2.00000000000000012e-9 or 6.79999999999999982 < y.re Initial program 42.3%
cancel-sign-sub-inv42.3%
fma-def42.3%
hypot-def42.3%
distribute-lft-neg-in42.3%
distribute-rgt-neg-out42.3%
fma-def42.3%
hypot-def80.8%
*-commutative80.8%
Simplified80.8%
Taylor expanded in y.im around inf 45.9%
unpow245.9%
unpow245.9%
hypot-def89.0%
Simplified89.0%
Taylor expanded in y.im around 0 82.2%
unpow282.2%
unpow282.2%
hypot-def82.2%
Simplified82.2%
if -2.00000000000000012e-9 < y.re < 6.79999999999999982Initial program 46.8%
Taylor expanded in y.im around 0 50.9%
Taylor expanded in y.re around 0 50.9%
unpow250.9%
unpow250.9%
swap-sqr50.9%
unpow250.9%
*-commutative50.9%
Simplified50.9%
Taylor expanded in y.re around 0 81.8%
distribute-rgt-neg-in81.8%
Simplified81.8%
Final simplification82.0%
(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 44.5%
cancel-sign-sub-inv44.5%
fma-def44.5%
hypot-def44.5%
distribute-lft-neg-in44.5%
distribute-rgt-neg-out44.5%
fma-def44.5%
hypot-def82.1%
*-commutative82.1%
Simplified82.1%
Taylor expanded in y.im around inf 46.2%
unpow246.2%
unpow246.2%
hypot-def86.2%
Simplified86.2%
Taylor expanded in y.im around 0 57.5%
unpow257.5%
unpow257.5%
hypot-def66.4%
Simplified66.4%
Final simplification66.4%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.im -2.7e-176) (pow (- x.im) y.re) (if (<= x.im 1.55e-37) (pow (- x.re) y.re) (pow x.im y.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_im <= -2.7e-176) {
tmp = pow(-x_46_im, y_46_re);
} else if (x_46_im <= 1.55e-37) {
tmp = pow(-x_46_re, y_46_re);
} else {
tmp = pow(x_46_im, y_46_re);
}
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 (x_46im <= (-2.7d-176)) then
tmp = -x_46im ** y_46re
else if (x_46im <= 1.55d-37) then
tmp = -x_46re ** y_46re
else
tmp = x_46im ** y_46re
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 (x_46_im <= -2.7e-176) {
tmp = Math.pow(-x_46_im, y_46_re);
} else if (x_46_im <= 1.55e-37) {
tmp = Math.pow(-x_46_re, y_46_re);
} else {
tmp = Math.pow(x_46_im, y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if x_46_im <= -2.7e-176: tmp = math.pow(-x_46_im, y_46_re) elif x_46_im <= 1.55e-37: tmp = math.pow(-x_46_re, y_46_re) else: tmp = math.pow(x_46_im, y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (x_46_im <= -2.7e-176) tmp = Float64(-x_46_im) ^ y_46_re; elseif (x_46_im <= 1.55e-37) tmp = Float64(-x_46_re) ^ y_46_re; else tmp = x_46_im ^ y_46_re; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (x_46_im <= -2.7e-176) tmp = -x_46_im ^ y_46_re; elseif (x_46_im <= 1.55e-37) tmp = -x_46_re ^ y_46_re; else tmp = x_46_im ^ y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$im, -2.7e-176], N[Power[(-x$46$im), y$46$re], $MachinePrecision], If[LessEqual[x$46$im, 1.55e-37], N[Power[(-x$46$re), y$46$re], $MachinePrecision], N[Power[x$46$im, y$46$re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -2.7 \cdot 10^{-176}:\\
\;\;\;\;{\left(-x.im\right)}^{y.re}\\
\mathbf{elif}\;x.im \leq 1.55 \cdot 10^{-37}:\\
\;\;\;\;{\left(-x.re\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;{x.im}^{y.re}\\
\end{array}
\end{array}
if x.im < -2.6999999999999998e-176Initial program 46.5%
cancel-sign-sub-inv46.5%
fma-def46.5%
hypot-def46.5%
distribute-lft-neg-in46.5%
distribute-rgt-neg-out46.5%
fma-def46.5%
hypot-def85.0%
*-commutative85.0%
Simplified85.0%
Taylor expanded in y.im around inf 45.9%
unpow245.9%
unpow245.9%
hypot-def87.5%
Simplified87.5%
Taylor expanded in y.im around 0 58.0%
Taylor expanded in x.im around -inf 67.6%
mul-1-neg67.6%
Simplified67.6%
if -2.6999999999999998e-176 < x.im < 1.54999999999999997e-37Initial program 50.2%
cancel-sign-sub-inv50.2%
fma-def50.2%
hypot-def50.2%
distribute-lft-neg-in50.2%
distribute-rgt-neg-out50.2%
fma-def50.2%
hypot-def79.3%
*-commutative79.3%
Simplified79.3%
Taylor expanded in y.im around inf 53.3%
unpow253.3%
unpow253.3%
hypot-def84.5%
Simplified84.5%
Taylor expanded in y.im around 0 63.5%
Taylor expanded in x.re around -inf 61.6%
mul-1-neg61.6%
Simplified61.6%
if 1.54999999999999997e-37 < x.im Initial program 32.4%
cancel-sign-sub-inv32.4%
fma-def32.4%
hypot-def32.4%
distribute-lft-neg-in32.4%
distribute-rgt-neg-out32.4%
fma-def32.4%
hypot-def81.9%
*-commutative81.9%
Simplified81.9%
Taylor expanded in y.im around inf 35.7%
unpow235.7%
unpow235.7%
hypot-def86.8%
Simplified86.8%
Taylor expanded in y.im around 0 47.0%
Taylor expanded in x.im around inf 60.1%
Final simplification63.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= x.im -3e+164) (not (<= x.im 5.5e-204))) (pow x.im y.re) (pow x.re y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((x_46_im <= -3e+164) || !(x_46_im <= 5.5e-204)) {
tmp = pow(x_46_im, y_46_re);
} else {
tmp = pow(x_46_re, y_46_re);
}
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 ((x_46im <= (-3d+164)) .or. (.not. (x_46im <= 5.5d-204))) then
tmp = x_46im ** y_46re
else
tmp = x_46re ** y_46re
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 ((x_46_im <= -3e+164) || !(x_46_im <= 5.5e-204)) {
tmp = Math.pow(x_46_im, y_46_re);
} else {
tmp = Math.pow(x_46_re, y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (x_46_im <= -3e+164) or not (x_46_im <= 5.5e-204): tmp = math.pow(x_46_im, y_46_re) else: tmp = math.pow(x_46_re, y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((x_46_im <= -3e+164) || !(x_46_im <= 5.5e-204)) tmp = x_46_im ^ y_46_re; else tmp = x_46_re ^ y_46_re; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((x_46_im <= -3e+164) || ~((x_46_im <= 5.5e-204))) tmp = x_46_im ^ y_46_re; else tmp = x_46_re ^ y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[x$46$im, -3e+164], N[Not[LessEqual[x$46$im, 5.5e-204]], $MachinePrecision]], N[Power[x$46$im, y$46$re], $MachinePrecision], N[Power[x$46$re, y$46$re], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -3 \cdot 10^{+164} \lor \neg \left(x.im \leq 5.5 \cdot 10^{-204}\right):\\
\;\;\;\;{x.im}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;{x.re}^{y.re}\\
\end{array}
\end{array}
if x.im < -3.00000000000000001e164 or 5.4999999999999999e-204 < x.im Initial program 28.3%
cancel-sign-sub-inv28.3%
fma-def28.3%
hypot-def28.3%
distribute-lft-neg-in28.3%
distribute-rgt-neg-out28.3%
fma-def28.3%
hypot-def82.1%
*-commutative82.1%
Simplified82.1%
Taylor expanded in y.im around inf 30.7%
unpow230.7%
unpow230.7%
hypot-def86.9%
Simplified86.9%
Taylor expanded in y.im around 0 50.5%
Taylor expanded in x.im around inf 54.2%
if -3.00000000000000001e164 < x.im < 5.4999999999999999e-204Initial program 59.5%
cancel-sign-sub-inv59.5%
fma-def59.5%
hypot-def59.5%
distribute-lft-neg-in59.5%
distribute-rgt-neg-out59.5%
fma-def59.5%
hypot-def82.2%
*-commutative82.2%
Simplified82.2%
Taylor expanded in y.im around inf 60.6%
unpow260.6%
unpow260.6%
hypot-def85.5%
Simplified85.5%
Taylor expanded in y.im around 0 63.9%
Taylor expanded in x.im around 0 51.5%
Final simplification52.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.im -1.4e-202) (pow (- x.im) y.re) (if (<= x.im 1.25e-201) (pow x.re y.re) (pow x.im y.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_im <= -1.4e-202) {
tmp = pow(-x_46_im, y_46_re);
} else if (x_46_im <= 1.25e-201) {
tmp = pow(x_46_re, y_46_re);
} else {
tmp = pow(x_46_im, y_46_re);
}
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 (x_46im <= (-1.4d-202)) then
tmp = -x_46im ** y_46re
else if (x_46im <= 1.25d-201) then
tmp = x_46re ** y_46re
else
tmp = x_46im ** y_46re
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 (x_46_im <= -1.4e-202) {
tmp = Math.pow(-x_46_im, y_46_re);
} else if (x_46_im <= 1.25e-201) {
tmp = Math.pow(x_46_re, y_46_re);
} else {
tmp = Math.pow(x_46_im, y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if x_46_im <= -1.4e-202: tmp = math.pow(-x_46_im, y_46_re) elif x_46_im <= 1.25e-201: tmp = math.pow(x_46_re, y_46_re) else: tmp = math.pow(x_46_im, y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (x_46_im <= -1.4e-202) tmp = Float64(-x_46_im) ^ y_46_re; elseif (x_46_im <= 1.25e-201) tmp = x_46_re ^ y_46_re; else tmp = x_46_im ^ y_46_re; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (x_46_im <= -1.4e-202) tmp = -x_46_im ^ y_46_re; elseif (x_46_im <= 1.25e-201) tmp = x_46_re ^ y_46_re; else tmp = x_46_im ^ y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$im, -1.4e-202], N[Power[(-x$46$im), y$46$re], $MachinePrecision], If[LessEqual[x$46$im, 1.25e-201], N[Power[x$46$re, y$46$re], $MachinePrecision], N[Power[x$46$im, y$46$re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.4 \cdot 10^{-202}:\\
\;\;\;\;{\left(-x.im\right)}^{y.re}\\
\mathbf{elif}\;x.im \leq 1.25 \cdot 10^{-201}:\\
\;\;\;\;{x.re}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;{x.im}^{y.re}\\
\end{array}
\end{array}
if x.im < -1.4000000000000001e-202Initial program 45.6%
cancel-sign-sub-inv45.6%
fma-def45.6%
hypot-def45.6%
distribute-lft-neg-in45.6%
distribute-rgt-neg-out45.6%
fma-def45.6%
hypot-def84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in y.im around inf 45.1%
unpow245.1%
unpow245.1%
hypot-def88.0%
Simplified88.0%
Taylor expanded in y.im around 0 57.8%
Taylor expanded in x.im around -inf 67.9%
mul-1-neg67.9%
Simplified67.9%
if -1.4000000000000001e-202 < x.im < 1.25e-201Initial program 51.9%
cancel-sign-sub-inv51.9%
fma-def51.9%
hypot-def51.9%
distribute-lft-neg-in51.9%
distribute-rgt-neg-out51.9%
fma-def51.9%
hypot-def79.2%
*-commutative79.2%
Simplified79.2%
Taylor expanded in y.im around inf 55.2%
unpow255.2%
unpow255.2%
hypot-def84.1%
Simplified84.1%
Taylor expanded in y.im around 0 69.2%
Taylor expanded in x.im around 0 64.1%
if 1.25e-201 < x.im Initial program 38.2%
cancel-sign-sub-inv38.2%
fma-def38.2%
hypot-def38.2%
distribute-lft-neg-in38.2%
distribute-rgt-neg-out38.2%
fma-def38.2%
hypot-def81.2%
*-commutative81.2%
Simplified81.2%
Taylor expanded in y.im around inf 41.5%
unpow241.5%
unpow241.5%
hypot-def85.6%
Simplified85.6%
Taylor expanded in y.im around 0 49.1%
Taylor expanded in x.im around inf 55.7%
Final simplification62.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (pow x.im y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return pow(x_46_im, 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
code = x_46im ** y_46re
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.pow(x_46_im, y_46_re);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.pow(x_46_im, y_46_re)
function code(x_46_re, x_46_im, y_46_re, y_46_im) return x_46_im ^ y_46_re end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = x_46_im ^ y_46_re; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Power[x$46$im, y$46$re], $MachinePrecision]
\begin{array}{l}
\\
{x.im}^{y.re}
\end{array}
Initial program 44.5%
cancel-sign-sub-inv44.5%
fma-def44.5%
hypot-def44.5%
distribute-lft-neg-in44.5%
distribute-rgt-neg-out44.5%
fma-def44.5%
hypot-def82.1%
*-commutative82.1%
Simplified82.1%
Taylor expanded in y.im around inf 46.2%
unpow246.2%
unpow246.2%
hypot-def86.2%
Simplified86.2%
Taylor expanded in y.im around 0 57.5%
Taylor expanded in x.im around inf 39.9%
Final simplification39.9%
herbie shell --seed 2024026
(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)))))