
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.im x.re)))
(t_1 (exp (* y.re (- t_0 (* y.im (/ (atan2 x.im x.re) y.re)))))))
(if (<= x.re -5e-308)
(* t_1 (cos (* t_0 y.im)))
(* t_1 (cos (* y.im (log 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_im, x_46_re));
double t_1 = exp((y_46_re * (t_0 - (y_46_im * (atan2(x_46_im, x_46_re) / y_46_re)))));
double tmp;
if (x_46_re <= -5e-308) {
tmp = t_1 * cos((t_0 * y_46_im));
} else {
tmp = t_1 * cos((y_46_im * log(x_46_re)));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.hypot(x_46_im, x_46_re));
double t_1 = Math.exp((y_46_re * (t_0 - (y_46_im * (Math.atan2(x_46_im, x_46_re) / y_46_re)))));
double tmp;
if (x_46_re <= -5e-308) {
tmp = t_1 * Math.cos((t_0 * y_46_im));
} else {
tmp = t_1 * Math.cos((y_46_im * Math.log(x_46_re)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.hypot(x_46_im, x_46_re)) t_1 = math.exp((y_46_re * (t_0 - (y_46_im * (math.atan2(x_46_im, x_46_re) / y_46_re))))) tmp = 0 if x_46_re <= -5e-308: tmp = t_1 * math.cos((t_0 * y_46_im)) else: tmp = t_1 * math.cos((y_46_im * math.log(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_im, x_46_re)) t_1 = exp(Float64(y_46_re * Float64(t_0 - Float64(y_46_im * Float64(atan(x_46_im, x_46_re) / y_46_re))))) tmp = 0.0 if (x_46_re <= -5e-308) tmp = Float64(t_1 * cos(Float64(t_0 * y_46_im))); else tmp = Float64(t_1 * cos(Float64(y_46_im * log(x_46_re)))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_im, x_46_re)); t_1 = exp((y_46_re * (t_0 - (y_46_im * (atan2(x_46_im, x_46_re) / y_46_re))))); tmp = 0.0; if (x_46_re <= -5e-308) tmp = t_1 * cos((t_0 * y_46_im)); else tmp = t_1 * cos((y_46_im * log(x_46_re))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(y$46$re * N[(t$95$0 - N[(y$46$im * N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -5e-308], N[(t$95$1 * N[Cos[N[(t$95$0 * y$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Cos[N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_1 := e^{y.re \cdot \left(t\_0 - y.im \cdot \frac{\tan^{-1}_* \frac{x.im}{x.re}}{y.re}\right)}\\
\mathbf{if}\;x.re \leq -5 \cdot 10^{-308}:\\
\;\;\;\;t\_1 \cdot \cos \left(t\_0 \cdot y.im\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \cos \left(y.im \cdot \log x.re\right)\\
\end{array}
\end{array}
if x.re < -4.99999999999999955e-308Initial program 34.6%
fmm-def34.6%
hypot-define34.6%
distribute-rgt-neg-out34.6%
fma-define34.6%
hypot-define85.4%
*-commutative85.4%
Simplified85.4%
Taylor expanded in y.im around inf 35.4%
unpow235.4%
unpow235.4%
hypot-undefine86.9%
Simplified86.9%
Taylor expanded in y.re around inf 61.3%
mul-1-neg61.3%
unsub-neg61.3%
unpow261.3%
unpow261.3%
hypot-undefine86.9%
associate-/l*86.9%
Simplified86.9%
if -4.99999999999999955e-308 < x.re Initial program 32.9%
fmm-def32.9%
hypot-define32.9%
distribute-rgt-neg-out32.9%
fma-define32.9%
hypot-define72.0%
*-commutative72.0%
Simplified72.0%
Taylor expanded in y.im around inf 36.7%
unpow236.7%
unpow236.7%
hypot-undefine78.2%
Simplified78.2%
Taylor expanded in y.re around inf 60.6%
mul-1-neg60.6%
unsub-neg60.6%
unpow260.6%
unpow260.6%
hypot-undefine78.2%
associate-/l*78.2%
Simplified78.2%
Taylor expanded in x.im around 0 83.2%
Final simplification85.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.im x.re))))
(if (<= x.re -2e-188)
(*
(cos (* t_0 y.im))
(exp (- (* (log (/ -1.0 x.re)) (- y.re)) (* y.im (atan2 x.im x.re)))))
(if (<= x.re 2.6e-264)
(exp (fma (log (hypot x.re x.im)) y.re (* y.im (- (atan2 x.im x.re)))))
(*
(exp (* y.re (- t_0 (* y.im (/ (atan2 x.im x.re) y.re)))))
(cos (* y.im (log 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_im, x_46_re));
double tmp;
if (x_46_re <= -2e-188) {
tmp = cos((t_0 * y_46_im)) * exp(((log((-1.0 / x_46_re)) * -y_46_re) - (y_46_im * atan2(x_46_im, x_46_re))));
} else if (x_46_re <= 2.6e-264) {
tmp = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (y_46_im * -atan2(x_46_im, x_46_re))));
} else {
tmp = exp((y_46_re * (t_0 - (y_46_im * (atan2(x_46_im, x_46_re) / y_46_re))))) * cos((y_46_im * log(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_im, x_46_re)) tmp = 0.0 if (x_46_re <= -2e-188) tmp = Float64(cos(Float64(t_0 * y_46_im)) * exp(Float64(Float64(log(Float64(-1.0 / x_46_re)) * Float64(-y_46_re)) - Float64(y_46_im * atan(x_46_im, x_46_re))))); elseif (x_46_re <= 2.6e-264) tmp = 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))))); else tmp = Float64(exp(Float64(y_46_re * Float64(t_0 - Float64(y_46_im * Float64(atan(x_46_im, x_46_re) / y_46_re))))) * cos(Float64(y_46_im * log(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$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -2e-188], N[(N[Cos[N[(t$95$0 * y$46$im), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision] * (-y$46$re)), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 2.6e-264], 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[(N[Exp[N[(y$46$re * N[(t$95$0 - N[(y$46$im * N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
\mathbf{if}\;x.re \leq -2 \cdot 10^{-188}:\\
\;\;\;\;\cos \left(t\_0 \cdot y.im\right) \cdot e^{\log \left(\frac{-1}{x.re}\right) \cdot \left(-y.re\right) - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{elif}\;x.re \leq 2.6 \cdot 10^{-264}:\\
\;\;\;\;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{else}:\\
\;\;\;\;e^{y.re \cdot \left(t\_0 - y.im \cdot \frac{\tan^{-1}_* \frac{x.im}{x.re}}{y.re}\right)} \cdot \cos \left(y.im \cdot \log x.re\right)\\
\end{array}
\end{array}
if x.re < -1.9999999999999999e-188Initial program 32.3%
fmm-def32.3%
hypot-define32.3%
distribute-rgt-neg-out32.3%
fma-define32.3%
hypot-define85.9%
*-commutative85.9%
Simplified85.9%
Taylor expanded in y.im around inf 33.3%
unpow233.3%
unpow233.3%
hypot-undefine87.9%
Simplified87.9%
Taylor expanded in x.re around -inf 82.9%
+-commutative82.9%
neg-mul-182.9%
unsub-neg82.9%
mul-1-neg82.9%
distribute-rgt-neg-in82.9%
Simplified82.9%
if -1.9999999999999999e-188 < x.re < 2.6000000000000002e-264Initial program 34.8%
fmm-def34.8%
hypot-define34.8%
distribute-rgt-neg-out34.8%
fma-define34.8%
hypot-define76.1%
*-commutative76.1%
Simplified76.1%
Taylor expanded in y.im around inf 37.0%
unpow237.0%
unpow237.0%
hypot-undefine78.3%
Simplified78.3%
Taylor expanded in y.im around 0 93.5%
if 2.6000000000000002e-264 < x.re Initial program 34.7%
fmm-def34.7%
hypot-define34.7%
distribute-rgt-neg-out34.7%
fma-define34.7%
hypot-define73.6%
*-commutative73.6%
Simplified73.6%
Taylor expanded in y.im around inf 38.1%
unpow238.1%
unpow238.1%
hypot-undefine79.8%
Simplified79.8%
Taylor expanded in y.re around inf 62.4%
mul-1-neg62.4%
unsub-neg62.4%
unpow262.4%
unpow262.4%
hypot-undefine79.8%
associate-/l*79.8%
Simplified79.8%
Taylor expanded in x.im around 0 82.8%
Final simplification84.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.re -1.95e-16) (not (<= y.re 34000.0)))
(pow (hypot x.im x.re) y.re)
(*
(cos (* (log (hypot x.im x.re)) y.im))
(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.95e-16) || !(y_46_re <= 34000.0)) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = cos((log(hypot(x_46_im, x_46_re)) * y_46_im)) * 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.95e-16) || !(y_46_re <= 34000.0)) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = Math.cos((Math.log(Math.hypot(x_46_im, x_46_re)) * y_46_im)) * 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.95e-16) or not (y_46_re <= 34000.0): tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = math.cos((math.log(math.hypot(x_46_im, x_46_re)) * y_46_im)) * 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.95e-16) || !(y_46_re <= 34000.0)) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = Float64(cos(Float64(log(hypot(x_46_im, x_46_re)) * y_46_im)) * 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 <= -1.95e-16) || ~((y_46_re <= 34000.0))) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = cos((log(hypot(x_46_im, x_46_re)) * y_46_im)) * 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.95e-16], N[Not[LessEqual[y$46$re, 34000.0]], $MachinePrecision]], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], N[(N[Cos[N[(N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision] * N[Exp[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.95 \cdot 10^{-16} \lor \neg \left(y.re \leq 34000\right):\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot y.im\right) \cdot e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}\\
\end{array}
\end{array}
if y.re < -1.94999999999999989e-16 or 34000 < y.re Initial program 30.5%
fmm-def30.5%
hypot-define30.5%
distribute-rgt-neg-out30.5%
fma-define30.5%
hypot-define75.8%
*-commutative75.8%
Simplified75.8%
Taylor expanded in y.im around inf 35.2%
unpow235.2%
unpow235.2%
hypot-undefine83.6%
Simplified83.6%
Taylor expanded in y.re around inf 77.5%
mul-1-neg77.5%
unsub-neg77.5%
unpow277.5%
unpow277.5%
hypot-undefine83.6%
associate-/l*83.6%
Simplified83.6%
Taylor expanded in y.im around 0 37.5%
associate-*r*37.5%
unpow237.5%
unpow237.5%
hypot-undefine68.8%
Simplified68.8%
Taylor expanded in y.im around 0 74.4%
unpow274.4%
unpow274.4%
hypot-undefine76.0%
Simplified76.0%
if -1.94999999999999989e-16 < y.re < 34000Initial program 37.1%
fmm-def37.1%
hypot-define37.1%
distribute-rgt-neg-out37.1%
fma-define37.1%
hypot-define81.8%
*-commutative81.8%
Simplified81.8%
Taylor expanded in y.im around inf 36.9%
unpow236.9%
unpow236.9%
hypot-undefine81.7%
Simplified81.7%
Taylor expanded in y.re around inf 44.4%
mul-1-neg44.4%
unsub-neg44.4%
unpow244.4%
unpow244.4%
hypot-undefine81.7%
associate-/l*81.7%
Simplified81.7%
Taylor expanded in y.re around 0 81.3%
neg-mul-181.3%
distribute-rgt-neg-in81.3%
Simplified81.3%
Final simplification78.6%
(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))))))
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))));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return 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))))) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := 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]
\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)}
\end{array}
Initial program 33.8%
fmm-def33.8%
hypot-define33.8%
distribute-rgt-neg-out33.8%
fma-define33.8%
hypot-define78.8%
*-commutative78.8%
Simplified78.8%
Taylor expanded in y.im around inf 36.0%
unpow236.0%
unpow236.0%
hypot-undefine82.6%
Simplified82.6%
Taylor expanded in y.im around 0 80.3%
Final simplification80.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (atan2 x.im x.re)))
(t_1 (pow (hypot x.im x.re) y.re))
(t_2 (exp (- (* (log (/ -1.0 x.im)) (- y.re)) t_0))))
(if (<= x.im -5.6e-6)
t_2
(if (<= x.im -1.5e-121)
t_1
(if (<= x.im -5e-310)
t_2
(if (or (<= x.im 9.5e-279) (not (<= x.im 3e-108)))
(exp (- (* y.re (log x.im)) t_0))
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_im * atan2(x_46_im, x_46_re);
double t_1 = pow(hypot(x_46_im, x_46_re), y_46_re);
double t_2 = exp(((log((-1.0 / x_46_im)) * -y_46_re) - t_0));
double tmp;
if (x_46_im <= -5.6e-6) {
tmp = t_2;
} else if (x_46_im <= -1.5e-121) {
tmp = t_1;
} else if (x_46_im <= -5e-310) {
tmp = t_2;
} else if ((x_46_im <= 9.5e-279) || !(x_46_im <= 3e-108)) {
tmp = exp(((y_46_re * log(x_46_im)) - t_0));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
double t_2 = Math.exp(((Math.log((-1.0 / x_46_im)) * -y_46_re) - t_0));
double tmp;
if (x_46_im <= -5.6e-6) {
tmp = t_2;
} else if (x_46_im <= -1.5e-121) {
tmp = t_1;
} else if (x_46_im <= -5e-310) {
tmp = t_2;
} else if ((x_46_im <= 9.5e-279) || !(x_46_im <= 3e-108)) {
tmp = Math.exp(((y_46_re * Math.log(x_46_im)) - t_0));
} else {
tmp = t_1;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_im * math.atan2(x_46_im, x_46_re) t_1 = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) t_2 = math.exp(((math.log((-1.0 / x_46_im)) * -y_46_re) - t_0)) tmp = 0 if x_46_im <= -5.6e-6: tmp = t_2 elif x_46_im <= -1.5e-121: tmp = t_1 elif x_46_im <= -5e-310: tmp = t_2 elif (x_46_im <= 9.5e-279) or not (x_46_im <= 3e-108): tmp = math.exp(((y_46_re * math.log(x_46_im)) - t_0)) else: tmp = t_1 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)) t_1 = hypot(x_46_im, x_46_re) ^ y_46_re t_2 = exp(Float64(Float64(log(Float64(-1.0 / x_46_im)) * Float64(-y_46_re)) - t_0)) tmp = 0.0 if (x_46_im <= -5.6e-6) tmp = t_2; elseif (x_46_im <= -1.5e-121) tmp = t_1; elseif (x_46_im <= -5e-310) tmp = t_2; elseif ((x_46_im <= 9.5e-279) || !(x_46_im <= 3e-108)) tmp = exp(Float64(Float64(y_46_re * log(x_46_im)) - t_0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_im * atan2(x_46_im, x_46_re); t_1 = hypot(x_46_im, x_46_re) ^ y_46_re; t_2 = exp(((log((-1.0 / x_46_im)) * -y_46_re) - t_0)); tmp = 0.0; if (x_46_im <= -5.6e-6) tmp = t_2; elseif (x_46_im <= -1.5e-121) tmp = t_1; elseif (x_46_im <= -5e-310) tmp = t_2; elseif ((x_46_im <= 9.5e-279) || ~((x_46_im <= 3e-108))) tmp = exp(((y_46_re * log(x_46_im)) - t_0)); else tmp = t_1; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[(N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision] * (-y$46$re)), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -5.6e-6], t$95$2, If[LessEqual[x$46$im, -1.5e-121], t$95$1, If[LessEqual[x$46$im, -5e-310], t$95$2, If[Or[LessEqual[x$46$im, 9.5e-279], N[Not[LessEqual[x$46$im, 3e-108]], $MachinePrecision]], N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
t_2 := e^{\log \left(\frac{-1}{x.im}\right) \cdot \left(-y.re\right) - t\_0}\\
\mathbf{if}\;x.im \leq -5.6 \cdot 10^{-6}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x.im \leq -1.5 \cdot 10^{-121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x.im \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x.im \leq 9.5 \cdot 10^{-279} \lor \neg \left(x.im \leq 3 \cdot 10^{-108}\right):\\
\;\;\;\;e^{y.re \cdot \log x.im - t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x.im < -5.59999999999999975e-6 or -1.5e-121 < x.im < -4.999999999999985e-310Initial program 28.3%
fmm-def28.3%
hypot-define28.3%
distribute-rgt-neg-out28.3%
fma-define28.3%
hypot-define81.8%
*-commutative81.8%
Simplified81.8%
Taylor expanded in y.im around inf 30.5%
unpow230.5%
unpow230.5%
hypot-undefine88.3%
Simplified88.3%
Taylor expanded in y.im around 0 87.4%
Taylor expanded in x.im around -inf 84.2%
+-commutative84.2%
neg-mul-184.2%
unsub-neg84.2%
mul-1-neg84.2%
distribute-rgt-neg-in84.2%
Simplified84.2%
if -5.59999999999999975e-6 < x.im < -1.5e-121 or 9.4999999999999996e-279 < x.im < 2.99999999999999993e-108Initial program 50.0%
fmm-def50.0%
hypot-define50.0%
distribute-rgt-neg-out50.0%
fma-define50.0%
hypot-define83.9%
*-commutative83.9%
Simplified83.9%
Taylor expanded in y.im around inf 51.4%
unpow251.4%
unpow251.4%
hypot-undefine85.3%
Simplified85.3%
Taylor expanded in y.re around inf 74.0%
mul-1-neg74.0%
unsub-neg74.0%
unpow274.0%
unpow274.0%
hypot-undefine85.3%
associate-/l*85.3%
Simplified85.3%
Taylor expanded in y.im around 0 52.5%
associate-*r*52.5%
unpow252.5%
unpow252.5%
hypot-undefine75.7%
Simplified75.7%
Taylor expanded in y.im around 0 64.1%
unpow264.1%
unpow264.1%
hypot-undefine69.7%
Simplified69.7%
if -4.999999999999985e-310 < x.im < 9.4999999999999996e-279 or 2.99999999999999993e-108 < x.im Initial program 27.3%
fmm-def27.3%
hypot-define27.3%
distribute-rgt-neg-out27.3%
fma-define27.3%
hypot-define72.3%
*-commutative72.3%
Simplified72.3%
Taylor expanded in y.im around inf 30.3%
unpow230.3%
unpow230.3%
hypot-undefine75.2%
Simplified75.2%
Taylor expanded in y.im around 0 73.9%
Taylor expanded in x.re around 0 70.5%
+-commutative70.5%
neg-mul-170.5%
unsub-neg70.5%
*-commutative70.5%
Simplified70.5%
Final simplification75.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (atan2 x.im x.re))))
(if (<= x.re -2e-310)
(exp (- (* (log (/ -1.0 x.re)) (- y.re)) t_0))
(exp (- (* y.re (log 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 = y_46_im * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -2e-310) {
tmp = exp(((log((-1.0 / x_46_re)) * -y_46_re) - t_0));
} else {
tmp = exp(((y_46_re * log(x_46_re)) - t_0));
}
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) :: t_0
real(8) :: tmp
t_0 = y_46im * atan2(x_46im, x_46re)
if (x_46re <= (-2d-310)) then
tmp = exp(((log(((-1.0d0) / x_46re)) * -y_46re) - t_0))
else
tmp = exp(((y_46re * log(x_46re)) - t_0))
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 t_0 = y_46_im * Math.atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -2e-310) {
tmp = Math.exp(((Math.log((-1.0 / x_46_re)) * -y_46_re) - t_0));
} else {
tmp = Math.exp(((y_46_re * Math.log(x_46_re)) - t_0));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_im * math.atan2(x_46_im, x_46_re) tmp = 0 if x_46_re <= -2e-310: tmp = math.exp(((math.log((-1.0 / x_46_re)) * -y_46_re) - t_0)) else: tmp = math.exp(((y_46_re * math.log(x_46_re)) - 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_re <= -2e-310) tmp = exp(Float64(Float64(log(Float64(-1.0 / x_46_re)) * Float64(-y_46_re)) - t_0)); else tmp = exp(Float64(Float64(y_46_re * log(x_46_re)) - t_0)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_im * atan2(x_46_im, x_46_re); tmp = 0.0; if (x_46_re <= -2e-310) tmp = exp(((log((-1.0 / x_46_re)) * -y_46_re) - t_0)); else tmp = exp(((y_46_re * log(x_46_re)) - t_0)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -2e-310], N[Exp[N[(N[(N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision] * (-y$46$re)), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.re \leq -2 \cdot 10^{-310}:\\
\;\;\;\;e^{\log \left(\frac{-1}{x.re}\right) \cdot \left(-y.re\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - t\_0}\\
\end{array}
\end{array}
if x.re < -1.999999999999994e-310Initial program 34.6%
fmm-def34.6%
hypot-define34.6%
distribute-rgt-neg-out34.6%
fma-define34.6%
hypot-define85.4%
*-commutative85.4%
Simplified85.4%
Taylor expanded in y.im around inf 35.4%
unpow235.4%
unpow235.4%
hypot-undefine86.9%
Simplified86.9%
Taylor expanded in x.re around -inf 81.5%
+-commutative81.5%
neg-mul-181.5%
unsub-neg81.5%
mul-1-neg81.5%
distribute-rgt-neg-in81.5%
Simplified81.5%
Taylor expanded in y.im around 0 76.6%
if -1.999999999999994e-310 < x.re Initial program 32.9%
fmm-def32.9%
hypot-define32.9%
distribute-rgt-neg-out32.9%
fma-define32.9%
hypot-define72.0%
*-commutative72.0%
Simplified72.0%
Taylor expanded in y.im around inf 36.7%
unpow236.7%
unpow236.7%
hypot-undefine78.2%
Simplified78.2%
Taylor expanded in y.im around 0 78.4%
Taylor expanded in x.im around 0 73.3%
+-commutative73.3%
neg-mul-173.3%
unsub-neg73.3%
Simplified73.3%
Final simplification75.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.re 2.5e-301) (pow (hypot x.im x.re) y.re) (exp (- (* y.re (log x.re)) (* 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_re <= 2.5e-301) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = exp(((y_46_re * log(x_46_re)) - (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 (x_46_re <= 2.5e-301) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = Math.exp(((y_46_re * Math.log(x_46_re)) - (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 x_46_re <= 2.5e-301: tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = math.exp(((y_46_re * math.log(x_46_re)) - (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 (x_46_re <= 2.5e-301) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = exp(Float64(Float64(y_46_re * log(x_46_re)) - 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 (x_46_re <= 2.5e-301) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = exp(((y_46_re * log(x_46_re)) - (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[x$46$re, 2.5e-301], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $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}\;x.re \leq 2.5 \cdot 10^{-301}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\end{array}
\end{array}
if x.re < 2.50000000000000006e-301Initial program 34.1%
fmm-def34.1%
hypot-define34.1%
distribute-rgt-neg-out34.1%
fma-define34.1%
hypot-define84.8%
*-commutative84.8%
Simplified84.8%
Taylor expanded in y.im around inf 35.6%
unpow235.6%
unpow235.6%
hypot-undefine87.1%
Simplified87.1%
Taylor expanded in y.re around inf 61.1%
mul-1-neg61.1%
unsub-neg61.1%
unpow261.1%
unpow261.1%
hypot-undefine87.1%
associate-/l*87.1%
Simplified87.1%
Taylor expanded in y.im around 0 39.4%
associate-*r*39.4%
unpow239.4%
unpow239.4%
hypot-undefine71.2%
Simplified71.2%
Taylor expanded in y.im around 0 50.2%
unpow250.2%
unpow250.2%
hypot-undefine59.5%
Simplified59.5%
if 2.50000000000000006e-301 < x.re Initial program 33.4%
fmm-def33.4%
hypot-define33.4%
distribute-rgt-neg-out33.4%
fma-define33.4%
hypot-define72.4%
*-commutative72.4%
Simplified72.4%
Taylor expanded in y.im around inf 36.5%
unpow236.5%
unpow236.5%
hypot-undefine77.9%
Simplified77.9%
Taylor expanded in y.im around 0 78.1%
Taylor expanded in x.im around 0 73.9%
+-commutative73.9%
neg-mul-173.9%
unsub-neg73.9%
Simplified73.9%
Final simplification66.5%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.im 3.5e-107) (pow (hypot x.im x.re) y.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 <= 3.5e-107) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = exp(((y_46_re * log(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 (x_46_im <= 3.5e-107) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = Math.exp(((y_46_re * Math.log(x_46_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 x_46_im <= 3.5e-107: tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = math.exp(((y_46_re * math.log(x_46_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 (x_46_im <= 3.5e-107) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = 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
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (x_46_im <= 3.5e-107) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = exp(((y_46_re * log(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[x$46$im, 3.5e-107], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $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}\;x.im \leq 3.5 \cdot 10^{-107}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\end{array}
\end{array}
if x.im < 3.49999999999999985e-107Initial program 36.6%
fmm-def36.6%
hypot-define36.6%
distribute-rgt-neg-out36.6%
fma-define36.6%
hypot-define83.0%
*-commutative83.0%
Simplified83.0%
Taylor expanded in y.im around inf 38.4%
unpow238.4%
unpow238.4%
hypot-undefine87.1%
Simplified87.1%
Taylor expanded in y.re around inf 64.8%
mul-1-neg64.8%
unsub-neg64.8%
unpow264.8%
unpow264.8%
hypot-undefine87.1%
associate-/l*87.1%
Simplified87.1%
Taylor expanded in y.im around 0 36.5%
associate-*r*36.5%
unpow236.5%
unpow236.5%
hypot-undefine69.2%
Simplified69.2%
Taylor expanded in y.im around 0 54.6%
unpow254.6%
unpow254.6%
hypot-undefine64.1%
Simplified64.1%
if 3.49999999999999985e-107 < x.im Initial program 28.4%
fmm-def28.4%
hypot-define28.4%
distribute-rgt-neg-out28.4%
fma-define28.4%
hypot-define70.9%
*-commutative70.9%
Simplified70.9%
Taylor expanded in y.im around inf 31.6%
unpow231.6%
unpow231.6%
hypot-undefine74.1%
Simplified74.1%
Taylor expanded in y.im around 0 73.8%
Taylor expanded in x.re around 0 71.3%
+-commutative71.3%
neg-mul-171.3%
unsub-neg71.3%
*-commutative71.3%
Simplified71.3%
Final simplification66.5%
(FPCore (x.re x.im y.re y.im) :precision binary64 (pow (hypot x.im x.re) y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return pow(hypot(x_46_im, x_46_re), y_46_re);
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.pow(math.hypot(x_46_im, x_46_re), y_46_re)
function code(x_46_re, x_46_im, y_46_re, y_46_im) return hypot(x_46_im, x_46_re) ^ y_46_re end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]
\begin{array}{l}
\\
{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}
\end{array}
Initial program 33.8%
fmm-def33.8%
hypot-define33.8%
distribute-rgt-neg-out33.8%
fma-define33.8%
hypot-define78.8%
*-commutative78.8%
Simplified78.8%
Taylor expanded in y.im around inf 36.0%
unpow236.0%
unpow236.0%
hypot-undefine82.6%
Simplified82.6%
Taylor expanded in y.re around inf 61.0%
mul-1-neg61.0%
unsub-neg61.0%
unpow261.0%
unpow261.0%
hypot-undefine82.6%
associate-/l*82.6%
Simplified82.6%
Taylor expanded in y.im around 0 36.9%
associate-*r*36.9%
unpow236.9%
unpow236.9%
hypot-undefine66.5%
Simplified66.5%
Taylor expanded in y.im around 0 52.2%
unpow252.2%
unpow252.2%
hypot-undefine61.7%
Simplified61.7%
Final simplification61.7%
herbie shell --seed 2024112
(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)))))