
(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.re x.im)))
(t_1 (exp (fma t_0 y.re (* (atan2 x.im x.re) (- y.im))))))
(if (<= x.re -1.2e-211)
(* t_1 (cos (* y.im (log (/ -1.0 x.re)))))
(* t_1 (cos (* t_0 y.im))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_re, x_46_im));
double t_1 = exp(fma(t_0, y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im)));
double tmp;
if (x_46_re <= -1.2e-211) {
tmp = t_1 * cos((y_46_im * log((-1.0 / x_46_re))));
} else {
tmp = t_1 * cos((t_0 * y_46_im));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) t_1 = exp(fma(t_0, y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) tmp = 0.0 if (x_46_re <= -1.2e-211) tmp = Float64(t_1 * cos(Float64(y_46_im * log(Float64(-1.0 / x_46_re))))); else tmp = Float64(t_1 * cos(Float64(t_0 * y_46_im))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(t$95$0 * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -1.2e-211], N[(t$95$1 * N[Cos[N[(y$46$im * N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Cos[N[(t$95$0 * y$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := e^{\mathsf{fma}\left(t\_0, y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)}\\
\mathbf{if}\;x.re \leq -1.2 \cdot 10^{-211}:\\
\;\;\;\;t\_1 \cdot \cos \left(y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \cos \left(t\_0 \cdot y.im\right)\\
\end{array}
\end{array}
if x.re < -1.2000000000000001e-211Initial program 46.1%
fma-neg46.1%
hypot-define46.1%
distribute-rgt-neg-out46.1%
fma-define46.1%
hypot-define87.3%
*-commutative87.3%
Simplified87.3%
fma-undefine87.3%
hypot-define46.1%
*-commutative46.1%
add-cube-cbrt46.1%
pow347.1%
fma-define47.1%
hypot-define86.3%
Applied egg-rr86.3%
Taylor expanded in y.re around 0 43.6%
+-commutative43.6%
unpow243.6%
unpow243.6%
hypot-undefine85.7%
Simplified85.7%
Taylor expanded in x.re around -inf 91.6%
mul-1-neg91.6%
cos-neg91.6%
Simplified91.6%
if -1.2000000000000001e-211 < x.re Initial program 34.5%
fma-neg34.5%
hypot-define34.5%
distribute-rgt-neg-out34.5%
fma-define34.5%
hypot-define75.0%
*-commutative75.0%
Simplified75.0%
fma-undefine75.0%
hypot-define34.5%
*-commutative34.5%
add-cube-cbrt36.0%
pow335.3%
fma-define34.7%
hypot-define73.9%
Applied egg-rr73.9%
Taylor expanded in y.re around 0 41.0%
+-commutative41.0%
unpow241.0%
unpow241.0%
hypot-undefine86.0%
Simplified86.0%
Final simplification88.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im))))
(if (<= x.re -1e-211)
(*
(exp (fma t_0 y.re (* (atan2 x.im x.re) (- y.im))))
(cos (* y.im (log (/ -1.0 x.re)))))
(*
(cos (* t_0 y.im))
(exp
(*
y.re
(- (log (hypot x.im x.re)) (* (atan2 x.im x.re) (/ y.im y.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 (x_46_re <= -1e-211) {
tmp = exp(fma(t_0, y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos((y_46_im * log((-1.0 / x_46_re))));
} else {
tmp = cos((t_0 * y_46_im)) * exp((y_46_re * (log(hypot(x_46_im, x_46_re)) - (atan2(x_46_im, x_46_re) * (y_46_im / y_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 (x_46_re <= -1e-211) tmp = Float64(exp(fma(t_0, y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cos(Float64(y_46_im * log(Float64(-1.0 / x_46_re))))); else tmp = Float64(cos(Float64(t_0 * y_46_im)) * exp(Float64(y_46_re * Float64(log(hypot(x_46_im, x_46_re)) - Float64(atan(x_46_im, x_46_re) * Float64(y_46_im / 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[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -1e-211], 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[(y$46$im * N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(t$95$0 * y$46$im), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(y$46$re * N[(N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * N[(y$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]), $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}\;x.re \leq -1 \cdot 10^{-211}:\\
\;\;\;\;e^{\mathsf{fma}\left(t\_0, y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \cdot \cos \left(y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(t\_0 \cdot y.im\right) \cdot e^{y.re \cdot \left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot \frac{y.im}{y.re}\right)}\\
\end{array}
\end{array}
if x.re < -1.00000000000000009e-211Initial program 46.1%
fma-neg46.1%
hypot-define46.1%
distribute-rgt-neg-out46.1%
fma-define46.1%
hypot-define87.3%
*-commutative87.3%
Simplified87.3%
fma-undefine87.3%
hypot-define46.1%
*-commutative46.1%
add-cube-cbrt46.1%
pow347.1%
fma-define47.1%
hypot-define86.3%
Applied egg-rr86.3%
Taylor expanded in y.re around 0 43.6%
+-commutative43.6%
unpow243.6%
unpow243.6%
hypot-undefine85.7%
Simplified85.7%
Taylor expanded in x.re around -inf 91.6%
mul-1-neg91.6%
cos-neg91.6%
Simplified91.6%
if -1.00000000000000009e-211 < x.re Initial program 34.5%
fma-neg34.5%
hypot-define34.5%
distribute-rgt-neg-out34.5%
fma-define34.5%
hypot-define75.0%
*-commutative75.0%
Simplified75.0%
fma-undefine75.0%
hypot-define34.5%
*-commutative34.5%
add-cube-cbrt36.0%
pow335.3%
fma-define34.7%
hypot-define73.9%
Applied egg-rr73.9%
Taylor expanded in y.re around 0 41.0%
+-commutative41.0%
unpow241.0%
unpow241.0%
hypot-undefine86.0%
Simplified86.0%
Taylor expanded in y.re around inf 71.9%
+-commutative71.9%
unpow271.9%
unpow271.9%
hypot-undefine86.0%
mul-1-neg86.0%
unsub-neg86.0%
hypot-undefine71.9%
unpow271.9%
unpow271.9%
+-commutative71.9%
unpow271.9%
unpow271.9%
hypot-define86.0%
*-commutative86.0%
associate-/l*85.8%
Simplified85.8%
Final simplification88.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(exp
(fma (log (hypot x.re x.im)) y.re (* (atan2 x.im x.re) (- y.im))))))
(if (<= x.re -5e-309)
(* t_0 (cos (* y.im (log (/ -1.0 x.re)))))
(* t_0 (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 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im)));
double tmp;
if (x_46_re <= -5e-309) {
tmp = t_0 * cos((y_46_im * log((-1.0 / x_46_re))));
} else {
tmp = t_0 * 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 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) tmp = 0.0 if (x_46_re <= -5e-309) tmp = Float64(t_0 * cos(Float64(y_46_im * log(Float64(-1.0 / x_46_re))))); else tmp = Float64(t_0 * 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[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -5e-309], N[(t$95$0 * N[Cos[N[(y$46$im * N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Cos[N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)}\\
\mathbf{if}\;x.re \leq -5 \cdot 10^{-309}:\\
\;\;\;\;t\_0 \cdot \cos \left(y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \cos \left(y.im \cdot \log x.re\right)\\
\end{array}
\end{array}
if x.re < -4.9999999999999995e-309Initial program 42.9%
fma-neg42.9%
hypot-define42.9%
distribute-rgt-neg-out42.9%
fma-define42.9%
hypot-define82.7%
*-commutative82.7%
Simplified82.7%
fma-undefine82.7%
hypot-define42.9%
*-commutative42.9%
add-cube-cbrt42.9%
pow344.4%
fma-define43.6%
hypot-define82.7%
Applied egg-rr82.7%
Taylor expanded in y.re around 0 43.2%
+-commutative43.2%
unpow243.2%
unpow243.2%
hypot-undefine87.6%
Simplified87.6%
Taylor expanded in x.re around -inf 89.8%
mul-1-neg89.8%
cos-neg89.8%
Simplified89.8%
if -4.9999999999999995e-309 < x.re Initial program 35.1%
fma-neg35.1%
hypot-define35.1%
distribute-rgt-neg-out35.1%
fma-define35.1%
hypot-define76.8%
*-commutative76.8%
Simplified76.8%
Taylor expanded in x.im around 0 76.0%
Taylor expanded in y.re around 0 80.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.re -6e-57) (not (<= y.re 24000000.0)))
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(*
(cos (* (log (hypot x.re x.im)) y.im))
(exp (* (atan2 x.im x.re) (- y.im))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_re <= -6e-57) || !(y_46_re <= 24000000.0)) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im)));
} else {
tmp = cos((log(hypot(x_46_re, x_46_im)) * y_46_im)) * exp((atan2(x_46_im, x_46_re) * -y_46_im));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_re <= -6e-57) || !(y_46_re <= 24000000.0)) {
tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
} else {
tmp = Math.cos((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_im)) * Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_re <= -6e-57) or not (y_46_re <= 24000000.0): tmp = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (math.atan2(x_46_im, x_46_re) * y_46_im))) else: tmp = math.cos((math.log(math.hypot(x_46_re, x_46_im)) * y_46_im)) * math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_re <= -6e-57) || !(y_46_re <= 24000000.0)) tmp = exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - Float64(atan(x_46_im, x_46_re) * y_46_im))); else tmp = Float64(cos(Float64(log(hypot(x_46_re, x_46_im)) * y_46_im)) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_re <= -6e-57) || ~((y_46_re <= 24000000.0))) tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im))); else tmp = cos((log(hypot(x_46_re, x_46_im)) * y_46_im)) * exp((atan2(x_46_im, x_46_re) * -y_46_im)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$re, -6e-57], N[Not[LessEqual[y$46$re, 24000000.0]], $MachinePrecision]], N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -6 \cdot 10^{-57} \lor \neg \left(y.re \leq 24000000\right):\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\end{array}
\end{array}
if y.re < -6.00000000000000001e-57 or 2.4e7 < y.re Initial program 39.0%
Taylor expanded in y.im around 0 72.1%
Taylor expanded in y.re around 0 81.3%
if -6.00000000000000001e-57 < y.re < 2.4e7Initial program 39.3%
fma-neg39.3%
hypot-define39.3%
distribute-rgt-neg-out39.3%
fma-define39.3%
hypot-define83.7%
*-commutative83.7%
Simplified83.7%
fma-undefine83.7%
hypot-define39.3%
*-commutative39.3%
add-cube-cbrt40.3%
pow340.3%
fma-define40.3%
hypot-define84.0%
Applied egg-rr84.0%
Taylor expanded in y.re around 0 39.3%
+-commutative39.3%
unpow239.3%
unpow239.3%
hypot-undefine83.7%
Simplified83.7%
Taylor expanded in y.re around 0 82.8%
neg-mul-182.8%
distribute-rgt-neg-in82.8%
Simplified82.8%
Final simplification82.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im)))
(if (or (<= y.im -550000000000.0) (not (<= y.im 1.95e-32)))
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_0))
(exp (fma (log (hypot x.re x.im)) y.re t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if ((y_46_im <= -550000000000.0) || !(y_46_im <= 1.95e-32)) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
} else {
tmp = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, t_0));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im) tmp = 0.0 if ((y_46_im <= -550000000000.0) || !(y_46_im <= 1.95e-32)) 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 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, t_0)); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, If[Or[LessEqual[y$46$im, -550000000000.0], N[Not[LessEqual[y$46$im, 1.95e-32]], $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] - t$95$0), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + t$95$0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;y.im \leq -550000000000 \lor \neg \left(y.im \leq 1.95 \cdot 10^{-32}\right):\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, t\_0\right)}\\
\end{array}
\end{array}
if y.im < -5.5e11 or 1.9500000000000001e-32 < y.im Initial program 38.8%
Taylor expanded in y.im around 0 59.9%
Taylor expanded in y.re around 0 62.1%
if -5.5e11 < y.im < 1.9500000000000001e-32Initial program 39.5%
Taylor expanded in y.im around 0 64.6%
Taylor expanded in y.re around 0 72.5%
fma-neg72.5%
distribute-rgt-neg-out72.5%
hypot-define94.0%
*-commutative94.0%
add-sqr-sqrt50.3%
sqrt-unprod94.0%
sqr-neg94.0%
sqrt-unprod43.7%
add-sqr-sqrt94.0%
Applied egg-rr94.0%
Final simplification76.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (exp (- (* y.re (log (- x.im))) t_0))))
(if (<= x.im -1.32e-45)
t_1
(if (<= x.im -7.5e-183)
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_0))
(if (<= x.im -2e-310) t_1 (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 = atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = exp(((y_46_re * log(-x_46_im)) - t_0));
double tmp;
if (x_46_im <= -1.32e-45) {
tmp = t_1;
} else if (x_46_im <= -7.5e-183) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
} else if (x_46_im <= -2e-310) {
tmp = t_1;
} else {
tmp = exp(((y_46_re * log(x_46_im)) - 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) :: t_1
real(8) :: tmp
t_0 = atan2(x_46im, x_46re) * y_46im
t_1 = exp(((y_46re * log(-x_46im)) - t_0))
if (x_46im <= (-1.32d-45)) then
tmp = t_1
else if (x_46im <= (-7.5d-183)) then
tmp = exp(((y_46re * log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))) - t_0))
else if (x_46im <= (-2d-310)) then
tmp = t_1
else
tmp = exp(((y_46re * log(x_46im)) - 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 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = Math.exp(((y_46_re * Math.log(-x_46_im)) - t_0));
double tmp;
if (x_46_im <= -1.32e-45) {
tmp = t_1;
} else if (x_46_im <= -7.5e-183) {
tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
} else if (x_46_im <= -2e-310) {
tmp = t_1;
} else {
tmp = Math.exp(((y_46_re * 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.atan2(x_46_im, x_46_re) * y_46_im t_1 = math.exp(((y_46_re * math.log(-x_46_im)) - t_0)) tmp = 0 if x_46_im <= -1.32e-45: tmp = t_1 elif x_46_im <= -7.5e-183: tmp = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)) elif x_46_im <= -2e-310: tmp = t_1 else: tmp = math.exp(((y_46_re * 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 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_1 = exp(Float64(Float64(y_46_re * log(Float64(-x_46_im))) - t_0)) tmp = 0.0 if (x_46_im <= -1.32e-45) tmp = t_1; elseif (x_46_im <= -7.5e-183) tmp = exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - t_0)); elseif (x_46_im <= -2e-310) tmp = t_1; else tmp = exp(Float64(Float64(y_46_re * 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 = atan2(x_46_im, x_46_re) * y_46_im; t_1 = exp(((y_46_re * log(-x_46_im)) - t_0)); tmp = 0.0; if (x_46_im <= -1.32e-45) tmp = t_1; elseif (x_46_im <= -7.5e-183) tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)); elseif (x_46_im <= -2e-310) tmp = t_1; else tmp = exp(((y_46_re * 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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(y$46$re * N[Log[(-x$46$im)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -1.32e-45], t$95$1, If[LessEqual[x$46$im, -7.5e-183], N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], If[LessEqual[x$46$im, -2e-310], t$95$1, N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := e^{y.re \cdot \log \left(-x.im\right) - t\_0}\\
\mathbf{if}\;x.im \leq -1.32 \cdot 10^{-45}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x.im \leq -7.5 \cdot 10^{-183}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t\_0}\\
\mathbf{elif}\;x.im \leq -2 \cdot 10^{-310}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - t\_0}\\
\end{array}
\end{array}
if x.im < -1.32000000000000005e-45 or -7.5000000000000004e-183 < x.im < -1.999999999999994e-310Initial program 24.4%
Taylor expanded in y.im around 0 59.1%
Taylor expanded in y.re around 0 67.5%
Taylor expanded in x.im around -inf 81.6%
mul-1-neg81.6%
Simplified81.6%
if -1.32000000000000005e-45 < x.im < -7.5000000000000004e-183Initial program 47.6%
Taylor expanded in y.im around 0 62.2%
Taylor expanded in y.re around 0 73.9%
if -1.999999999999994e-310 < x.im Initial program 47.9%
Taylor expanded in y.im around 0 64.1%
Taylor expanded in y.re around 0 65.5%
Taylor expanded in x.re around 0 76.5%
Final simplification78.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im)))
(if (<= x.im -2e-310)
(exp (- (* y.re (log (- x.im))) t_0))
(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 = atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_im <= -2e-310) {
tmp = exp(((y_46_re * log(-x_46_im)) - t_0));
} else {
tmp = exp(((y_46_re * log(x_46_im)) - 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 = atan2(x_46im, x_46re) * y_46im
if (x_46im <= (-2d-310)) then
tmp = exp(((y_46re * log(-x_46im)) - t_0))
else
tmp = exp(((y_46re * log(x_46im)) - 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 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_im <= -2e-310) {
tmp = Math.exp(((y_46_re * Math.log(-x_46_im)) - t_0));
} else {
tmp = Math.exp(((y_46_re * 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.atan2(x_46_im, x_46_re) * y_46_im tmp = 0 if x_46_im <= -2e-310: tmp = math.exp(((y_46_re * math.log(-x_46_im)) - t_0)) else: tmp = math.exp(((y_46_re * 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 = Float64(atan(x_46_im, x_46_re) * y_46_im) tmp = 0.0 if (x_46_im <= -2e-310) tmp = exp(Float64(Float64(y_46_re * log(Float64(-x_46_im))) - t_0)); else tmp = exp(Float64(Float64(y_46_re * 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 = atan2(x_46_im, x_46_re) * y_46_im; tmp = 0.0; if (x_46_im <= -2e-310) tmp = exp(((y_46_re * log(-x_46_im)) - t_0)); else tmp = exp(((y_46_re * 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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, If[LessEqual[x$46$im, -2e-310], N[Exp[N[(N[(y$46$re * N[Log[(-x$46$im)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.im \leq -2 \cdot 10^{-310}:\\
\;\;\;\;e^{y.re \cdot \log \left(-x.im\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - t\_0}\\
\end{array}
\end{array}
if x.im < -1.999999999999994e-310Initial program 28.6%
Taylor expanded in y.im around 0 59.6%
Taylor expanded in y.re around 0 68.7%
Taylor expanded in x.im around -inf 75.8%
mul-1-neg75.8%
Simplified75.8%
if -1.999999999999994e-310 < x.im Initial program 47.9%
Taylor expanded in y.im around 0 64.1%
Taylor expanded in y.re around 0 65.5%
Taylor expanded in x.re around 0 76.5%
Final simplification76.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im)))
(if (<= x.im 1.35e-301)
(exp (- (* y.re (log x.re)) t_0))
(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 = atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_im <= 1.35e-301) {
tmp = exp(((y_46_re * log(x_46_re)) - t_0));
} else {
tmp = exp(((y_46_re * log(x_46_im)) - 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 = atan2(x_46im, x_46re) * y_46im
if (x_46im <= 1.35d-301) then
tmp = exp(((y_46re * log(x_46re)) - t_0))
else
tmp = exp(((y_46re * log(x_46im)) - 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 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_im <= 1.35e-301) {
tmp = Math.exp(((y_46_re * Math.log(x_46_re)) - t_0));
} else {
tmp = Math.exp(((y_46_re * 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.atan2(x_46_im, x_46_re) * y_46_im tmp = 0 if x_46_im <= 1.35e-301: tmp = math.exp(((y_46_re * math.log(x_46_re)) - t_0)) else: tmp = math.exp(((y_46_re * 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 = Float64(atan(x_46_im, x_46_re) * y_46_im) tmp = 0.0 if (x_46_im <= 1.35e-301) tmp = exp(Float64(Float64(y_46_re * log(x_46_re)) - t_0)); else tmp = exp(Float64(Float64(y_46_re * 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 = atan2(x_46_im, x_46_re) * y_46_im; tmp = 0.0; if (x_46_im <= 1.35e-301) tmp = exp(((y_46_re * log(x_46_re)) - t_0)); else tmp = exp(((y_46_re * 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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, If[LessEqual[x$46$im, 1.35e-301], N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.im \leq 1.35 \cdot 10^{-301}:\\
\;\;\;\;e^{y.re \cdot \log x.re - t\_0}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - t\_0}\\
\end{array}
\end{array}
if x.im < 1.35e-301Initial program 29.0%
Taylor expanded in y.im around 0 59.5%
Taylor expanded in y.re around 0 68.4%
Taylor expanded in x.re around inf 34.6%
if 1.35e-301 < x.im Initial program 47.8%
Taylor expanded in y.im around 0 64.3%
Taylor expanded in y.re around 0 65.7%
Taylor expanded in x.re around 0 77.4%
Final simplification57.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (exp (- (* y.re (log x.im)) (* (atan2 x.im x.re) y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return exp(((y_46_re * log(x_46_im)) - (atan2(x_46_im, x_46_re) * y_46_im)));
}
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 = exp(((y_46re * log(x_46im)) - (atan2(x_46im, x_46re) * y_46im)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.exp(((y_46_re * Math.log(x_46_im)) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.exp(((y_46_re * math.log(x_46_im)) - (math.atan2(x_46_im, x_46_re) * y_46_im)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return exp(Float64(Float64(y_46_re * log(x_46_im)) - Float64(atan(x_46_im, x_46_re) * y_46_im))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = exp(((y_46_re * log(x_46_im)) - (atan2(x_46_im, x_46_re) * y_46_im))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{y.re \cdot \log x.im - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}
\end{array}
Initial program 39.1%
Taylor expanded in y.im around 0 62.1%
Taylor expanded in y.re around 0 66.9%
Taylor expanded in x.re around 0 41.8%
Final simplification41.8%
herbie shell --seed 2024089
(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)))))