
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im))))))
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(cos (+ (* t_0 y.im) (* (atan2 x.im x.re) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
t_0 = log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))
code = exp(((t_0 * y_46re) - (atan2(x_46im, x_46re) * y_46im))) * cos(((t_0 * y_46im) + (atan2(x_46im, x_46re) * y_46re)))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
return Math.exp(((t_0 * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((t_0 * y_46_im) + (Math.atan2(x_46_im, x_46_re) * y_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) return math.exp(((t_0 * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((t_0 * y_46_im) + (math.atan2(x_46_im, x_46_re) * y_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) return Float64(exp(Float64(Float64(t_0 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_0 * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); tmp = exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(N[Exp[N[(N[(t$95$0 * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$0 * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
e^{t\_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t\_0 \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\end{array}
\end{array}
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.im x.re)))
(t_1 (* y.re (atan2 x.im x.re)))
(t_2 (+ t_1 (* y.im (log x.re))))
(t_3
(exp
(fma (log (hypot x.re x.im)) y.re (* (atan2 x.im x.re) (- y.im)))))
(t_4 (fma (log x.re) y.im (* y.im (- (log x.re))))))
(if (<= x.re -1.8e-142)
(* t_3 (cos (- t_1 (* y.im (log (/ -1.0 x.re))))))
(if (<= x.re 1.95e-182)
(* t_3 (cos (* y.im t_0)))
(if (<= x.re 2e-119)
(*
(- (cos t_1) (* t_0 (* y.im (sin t_1))))
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im))))
(* t_3 (- (* (cos t_2) (cos t_4)) (* (sin t_2) (sin t_4)))))))))
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 = y_46_re * atan2(x_46_im, x_46_re);
double t_2 = t_1 + (y_46_im * log(x_46_re));
double t_3 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im)));
double t_4 = fma(log(x_46_re), y_46_im, (y_46_im * -log(x_46_re)));
double tmp;
if (x_46_re <= -1.8e-142) {
tmp = t_3 * cos((t_1 - (y_46_im * log((-1.0 / x_46_re)))));
} else if (x_46_re <= 1.95e-182) {
tmp = t_3 * cos((y_46_im * t_0));
} else if (x_46_re <= 2e-119) {
tmp = (cos(t_1) - (t_0 * (y_46_im * sin(t_1)))) * exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im)));
} else {
tmp = t_3 * ((cos(t_2) * cos(t_4)) - (sin(t_2) * sin(t_4)));
}
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 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_2 = Float64(t_1 + Float64(y_46_im * log(x_46_re))) t_3 = 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)))) t_4 = fma(log(x_46_re), y_46_im, Float64(y_46_im * Float64(-log(x_46_re)))) tmp = 0.0 if (x_46_re <= -1.8e-142) tmp = Float64(t_3 * cos(Float64(t_1 - Float64(y_46_im * log(Float64(-1.0 / x_46_re)))))); elseif (x_46_re <= 1.95e-182) tmp = Float64(t_3 * cos(Float64(y_46_im * t_0))); elseif (x_46_re <= 2e-119) tmp = Float64(Float64(cos(t_1) - Float64(t_0 * Float64(y_46_im * sin(t_1)))) * 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(t_3 * Float64(Float64(cos(t_2) * cos(t_4)) - Float64(sin(t_2) * sin(t_4)))); 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]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 + N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = 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]}, Block[{t$95$4 = N[(N[Log[x$46$re], $MachinePrecision] * y$46$im + N[(y$46$im * (-N[Log[x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -1.8e-142], N[(t$95$3 * N[Cos[N[(t$95$1 - N[(y$46$im * N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 1.95e-182], N[(t$95$3 * N[Cos[N[(y$46$im * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 2e-119], N[(N[(N[Cos[t$95$1], $MachinePrecision] - N[(t$95$0 * N[(y$46$im * N[Sin[t$95$1], $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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$3 * N[(N[(N[Cos[t$95$2], $MachinePrecision] * N[Cos[t$95$4], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[t$95$2], $MachinePrecision] * N[Sin[t$95$4], $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 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := t\_1 + y.im \cdot \log x.re\\
t_3 := 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)}\\
t_4 := \mathsf{fma}\left(\log x.re, y.im, y.im \cdot \left(-\log x.re\right)\right)\\
\mathbf{if}\;x.re \leq -1.8 \cdot 10^{-142}:\\
\;\;\;\;t\_3 \cdot \cos \left(t\_1 - y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)\\
\mathbf{elif}\;x.re \leq 1.95 \cdot 10^{-182}:\\
\;\;\;\;t\_3 \cdot \cos \left(y.im \cdot t\_0\right)\\
\mathbf{elif}\;x.re \leq 2 \cdot 10^{-119}:\\
\;\;\;\;\left(\cos t\_1 - t\_0 \cdot \left(y.im \cdot \sin t\_1\right)\right) \cdot 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}:\\
\;\;\;\;t\_3 \cdot \left(\cos t\_2 \cdot \cos t\_4 - \sin t\_2 \cdot \sin t\_4\right)\\
\end{array}
\end{array}
if x.re < -1.8e-142Initial program 44.4%
cancel-sign-sub-inv44.4%
fma-define44.4%
hypot-define44.4%
distribute-lft-neg-in44.4%
distribute-rgt-neg-out44.4%
fma-define44.4%
hypot-define79.8%
*-commutative79.8%
Simplified79.8%
Taylor expanded in x.re around -inf 83.8%
+-commutative83.8%
mul-1-neg83.8%
unsub-neg83.8%
Simplified83.8%
if -1.8e-142 < x.re < 1.95e-182Initial program 38.2%
cancel-sign-sub-inv38.2%
fma-define38.2%
hypot-define38.2%
distribute-lft-neg-in38.2%
distribute-rgt-neg-out38.2%
fma-define38.2%
hypot-define74.5%
*-commutative74.5%
Simplified74.5%
Taylor expanded in y.re around inf 32.7%
+-commutative32.7%
associate-/l*32.7%
unpow232.7%
unpow232.7%
hypot-undefine67.3%
Simplified67.3%
Taylor expanded in y.re around 0 43.6%
+-commutative43.6%
unpow243.6%
unpow243.6%
hypot-undefine83.6%
hypot-undefine43.6%
unpow243.6%
unpow243.6%
+-commutative43.6%
unpow243.6%
unpow243.6%
hypot-undefine83.6%
Simplified83.6%
if 1.95e-182 < x.re < 2.00000000000000003e-119Initial program 52.9%
Taylor expanded in y.im around 0 76.6%
*-commutative76.6%
mul-1-neg76.6%
unsub-neg76.6%
*-commutative76.6%
associate-*r*76.6%
*-commutative76.6%
*-commutative76.6%
associate-*l*76.6%
unpow276.6%
unpow276.6%
hypot-undefine82.4%
Simplified82.4%
if 2.00000000000000003e-119 < x.re Initial program 31.1%
cancel-sign-sub-inv31.1%
fma-define31.1%
hypot-define31.1%
distribute-lft-neg-in31.1%
distribute-rgt-neg-out31.1%
fma-define31.1%
hypot-define82.9%
*-commutative82.9%
Simplified82.9%
Taylor expanded in x.re around -inf 0.0%
+-commutative0.0%
mul-1-neg0.0%
unsub-neg0.0%
Simplified0.0%
prod-diff0.0%
*-commutative0.0%
fma-neg0.0%
cos-sum0.0%
Applied egg-rr89.2%
Final simplification85.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.im x.re)))
(t_1
(exp
(fma (log (hypot x.re x.im)) y.re (* (atan2 x.im x.re) (- y.im))))))
(if (<= y.re 4e+164)
(* t_1 (cos (* y.im t_0)))
(* t_1 (cos (* y.re (+ (atan2 x.im x.re) (* y.im (/ t_0 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_im, x_46_re));
double t_1 = 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 (y_46_re <= 4e+164) {
tmp = t_1 * cos((y_46_im * t_0));
} else {
tmp = t_1 * cos((y_46_re * (atan2(x_46_im, x_46_re) + (y_46_im * (t_0 / 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_im, x_46_re)) t_1 = 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 (y_46_re <= 4e+164) tmp = Float64(t_1 * cos(Float64(y_46_im * t_0))); else tmp = Float64(t_1 * cos(Float64(y_46_re * Float64(atan(x_46_im, x_46_re) + Float64(y_46_im * Float64(t_0 / 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$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = 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[y$46$re, 4e+164], N[(t$95$1 * N[Cos[N[(y$46$im * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Cos[N[(y$46$re * N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(y$46$im * N[(t$95$0 / y$46$re), $MachinePrecision]), $MachinePrecision]), $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^{\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}\;y.re \leq 4 \cdot 10^{+164}:\\
\;\;\;\;t\_1 \cdot \cos \left(y.im \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \cos \left(y.re \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \frac{t\_0}{y.re}\right)\right)\\
\end{array}
\end{array}
if y.re < 4e164Initial program 39.5%
cancel-sign-sub-inv39.5%
fma-define39.5%
hypot-define39.5%
distribute-lft-neg-in39.5%
distribute-rgt-neg-out39.5%
fma-define39.5%
hypot-define79.2%
*-commutative79.2%
Simplified79.2%
Taylor expanded in y.re around inf 33.4%
+-commutative33.4%
associate-/l*34.0%
unpow234.0%
unpow234.0%
hypot-undefine70.3%
Simplified70.3%
Taylor expanded in y.re around 0 40.8%
+-commutative40.8%
unpow240.8%
unpow240.8%
hypot-undefine82.4%
hypot-undefine40.8%
unpow240.8%
unpow240.8%
+-commutative40.8%
unpow240.8%
unpow240.8%
hypot-undefine82.4%
Simplified82.4%
if 4e164 < y.re Initial program 37.8%
cancel-sign-sub-inv37.8%
fma-define37.8%
hypot-define37.8%
distribute-lft-neg-in37.8%
distribute-rgt-neg-out37.8%
fma-define37.8%
hypot-define78.4%
*-commutative78.4%
Simplified78.4%
Taylor expanded in y.re around inf 37.8%
+-commutative37.8%
associate-/l*40.5%
unpow240.5%
unpow240.5%
hypot-undefine81.1%
Simplified81.1%
Final simplification82.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im))))
(if (<= y.re 8e+179)
(*
(exp (fma t_0 y.re (* (atan2 x.im x.re) (- y.im))))
(cos (* y.im (log (hypot x.im x.re)))))
(*
(pow (hypot x.re x.im) y.re)
(cos (fma t_0 y.im (* y.re (atan2 x.im x.re))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_re, x_46_im));
double tmp;
if (y_46_re <= 8e+179) {
tmp = exp(fma(t_0, y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
} else {
tmp = pow(hypot(x_46_re, x_46_im), y_46_re) * cos(fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) tmp = 0.0 if (y_46_re <= 8e+179) 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(hypot(x_46_im, x_46_re))))); else tmp = Float64((hypot(x_46_re, x_46_im) ^ y_46_re) * cos(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re))))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, 8e+179], 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[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[Cos[N[(t$95$0 * y$46$im + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
\mathbf{if}\;y.re \leq 8 \cdot 10^{+179}:\\
\;\;\;\;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(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \cos \left(\mathsf{fma}\left(t\_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\\
\end{array}
\end{array}
if y.re < 7.99999999999999984e179Initial program 38.6%
cancel-sign-sub-inv38.6%
fma-define38.6%
hypot-define38.6%
distribute-lft-neg-in38.6%
distribute-rgt-neg-out38.6%
fma-define38.6%
hypot-define78.3%
*-commutative78.3%
Simplified78.3%
Taylor expanded in y.re around inf 32.7%
+-commutative32.7%
associate-/l*33.6%
unpow233.6%
unpow233.6%
hypot-undefine70.1%
Simplified70.1%
Taylor expanded in y.re around 0 40.4%
+-commutative40.4%
unpow240.4%
unpow240.4%
hypot-undefine81.9%
hypot-undefine40.4%
unpow240.4%
unpow240.4%
+-commutative40.4%
unpow240.4%
unpow240.4%
hypot-undefine81.9%
Simplified81.9%
if 7.99999999999999984e179 < y.re Initial program 43.8%
exp-diff37.5%
exp-to-pow37.5%
hypot-define37.5%
*-commutative37.5%
exp-prod37.5%
fma-define37.5%
hypot-define62.5%
*-commutative62.5%
Simplified62.5%
Taylor expanded in y.im around 0 81.3%
Final simplification81.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (log (- x.re)))
(t_2 (* (atan2 x.im x.re) y.im)))
(if (<= x.re -6.5e-33)
(* (exp (- (* y.re t_1) t_2)) (cos (+ t_0 (* y.im t_1))))
(if (<= x.re 6.8e-120)
(*
(cos (* y.im (log (hypot x.im x.re))))
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_2)))
(* (cos t_0) (exp (- (* y.re (log x.re)) t_2)))))))
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(-x_46_re);
double t_2 = atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_re <= -6.5e-33) {
tmp = exp(((y_46_re * t_1) - t_2)) * cos((t_0 + (y_46_im * t_1)));
} else if (x_46_re <= 6.8e-120) {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_2));
} else {
tmp = cos(t_0) * exp(((y_46_re * log(x_46_re)) - t_2));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.log(-x_46_re);
double t_2 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_re <= -6.5e-33) {
tmp = Math.exp(((y_46_re * t_1) - t_2)) * Math.cos((t_0 + (y_46_im * t_1)));
} else if (x_46_re <= 6.8e-120) {
tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) * Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_2));
} else {
tmp = Math.cos(t_0) * Math.exp(((y_46_re * Math.log(x_46_re)) - t_2));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) t_1 = math.log(-x_46_re) t_2 = math.atan2(x_46_im, x_46_re) * y_46_im tmp = 0 if x_46_re <= -6.5e-33: tmp = math.exp(((y_46_re * t_1) - t_2)) * math.cos((t_0 + (y_46_im * t_1))) elif x_46_re <= 6.8e-120: tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) * math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_2)) else: tmp = math.cos(t_0) * math.exp(((y_46_re * math.log(x_46_re)) - t_2)) 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(Float64(-x_46_re)) t_2 = Float64(atan(x_46_im, x_46_re) * y_46_im) tmp = 0.0 if (x_46_re <= -6.5e-33) tmp = Float64(exp(Float64(Float64(y_46_re * t_1) - t_2)) * cos(Float64(t_0 + Float64(y_46_im * t_1)))); elseif (x_46_re <= 6.8e-120) tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - t_2))); else tmp = Float64(cos(t_0) * exp(Float64(Float64(y_46_re * log(x_46_re)) - t_2))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); t_1 = log(-x_46_re); t_2 = atan2(x_46_im, x_46_re) * y_46_im; tmp = 0.0; if (x_46_re <= -6.5e-33) tmp = exp(((y_46_re * t_1) - t_2)) * cos((t_0 + (y_46_im * t_1))); elseif (x_46_re <= 6.8e-120) tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_2)); else tmp = cos(t_0) * exp(((y_46_re * log(x_46_re)) - t_2)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[(-x$46$re)], $MachinePrecision]}, Block[{t$95$2 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, If[LessEqual[x$46$re, -6.5e-33], N[(N[Exp[N[(N[(y$46$re * t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$0 + N[(y$46$im * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 6.8e-120], 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[(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$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[t$95$0], $MachinePrecision] * N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$2), $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(-x.re\right)\\
t_2 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.re \leq -6.5 \cdot 10^{-33}:\\
\;\;\;\;e^{y.re \cdot t\_1 - t\_2} \cdot \cos \left(t\_0 + y.im \cdot t\_1\right)\\
\mathbf{elif}\;x.re \leq 6.8 \cdot 10^{-120}:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t\_2}\\
\mathbf{else}:\\
\;\;\;\;\cos t\_0 \cdot e^{y.re \cdot \log x.re - t\_2}\\
\end{array}
\end{array}
if x.re < -6.4999999999999993e-33Initial program 33.8%
Taylor expanded in x.re around -inf 59.0%
mul-1-neg75.3%
Simplified59.0%
Taylor expanded in x.re around -inf 80.5%
mul-1-neg75.3%
Simplified80.5%
if -6.4999999999999993e-33 < x.re < 6.8000000000000002e-120Initial program 51.6%
Taylor expanded in y.re around 0 52.7%
unpow252.7%
unpow252.7%
hypot-undefine69.1%
Simplified69.1%
if 6.8000000000000002e-120 < x.re Initial program 30.7%
Taylor expanded in y.im around 0 64.8%
Taylor expanded in x.re around inf 81.0%
Final simplification76.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (cos t_0))
(t_2 (log (- x.re)))
(t_3 (* (atan2 x.im x.re) y.im))
(t_4
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_3))))
(if (<= x.re -1.9e-30)
(* (exp (- (* y.re t_2) t_3)) (cos (+ t_0 (* y.im t_2))))
(if (<= x.re -5e-128)
(* t_1 t_4)
(if (<= x.re 6.2e-157)
t_4
(* t_1 (exp (- (* y.re (log x.re)) t_3))))))))
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 = cos(t_0);
double t_2 = log(-x_46_re);
double t_3 = atan2(x_46_im, x_46_re) * y_46_im;
double t_4 = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_3));
double tmp;
if (x_46_re <= -1.9e-30) {
tmp = exp(((y_46_re * t_2) - t_3)) * cos((t_0 + (y_46_im * t_2)));
} else if (x_46_re <= -5e-128) {
tmp = t_1 * t_4;
} else if (x_46_re <= 6.2e-157) {
tmp = t_4;
} else {
tmp = t_1 * exp(((y_46_re * log(x_46_re)) - t_3));
}
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) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_0 = y_46re * atan2(x_46im, x_46re)
t_1 = cos(t_0)
t_2 = log(-x_46re)
t_3 = atan2(x_46im, x_46re) * y_46im
t_4 = exp(((y_46re * log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))) - t_3))
if (x_46re <= (-1.9d-30)) then
tmp = exp(((y_46re * t_2) - t_3)) * cos((t_0 + (y_46im * t_2)))
else if (x_46re <= (-5d-128)) then
tmp = t_1 * t_4
else if (x_46re <= 6.2d-157) then
tmp = t_4
else
tmp = t_1 * exp(((y_46re * log(x_46re)) - t_3))
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_re * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.cos(t_0);
double t_2 = Math.log(-x_46_re);
double t_3 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double t_4 = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_3));
double tmp;
if (x_46_re <= -1.9e-30) {
tmp = Math.exp(((y_46_re * t_2) - t_3)) * Math.cos((t_0 + (y_46_im * t_2)));
} else if (x_46_re <= -5e-128) {
tmp = t_1 * t_4;
} else if (x_46_re <= 6.2e-157) {
tmp = t_4;
} else {
tmp = t_1 * Math.exp(((y_46_re * Math.log(x_46_re)) - t_3));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) t_1 = math.cos(t_0) t_2 = math.log(-x_46_re) t_3 = math.atan2(x_46_im, x_46_re) * y_46_im t_4 = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_3)) tmp = 0 if x_46_re <= -1.9e-30: tmp = math.exp(((y_46_re * t_2) - t_3)) * math.cos((t_0 + (y_46_im * t_2))) elif x_46_re <= -5e-128: tmp = t_1 * t_4 elif x_46_re <= 6.2e-157: tmp = t_4 else: tmp = t_1 * math.exp(((y_46_re * math.log(x_46_re)) - t_3)) 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 = cos(t_0) t_2 = log(Float64(-x_46_re)) t_3 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_4 = exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - t_3)) tmp = 0.0 if (x_46_re <= -1.9e-30) tmp = Float64(exp(Float64(Float64(y_46_re * t_2) - t_3)) * cos(Float64(t_0 + Float64(y_46_im * t_2)))); elseif (x_46_re <= -5e-128) tmp = Float64(t_1 * t_4); elseif (x_46_re <= 6.2e-157) tmp = t_4; else tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(x_46_re)) - t_3))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); t_1 = cos(t_0); t_2 = log(-x_46_re); t_3 = atan2(x_46_im, x_46_re) * y_46_im; t_4 = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_3)); tmp = 0.0; if (x_46_re <= -1.9e-30) tmp = exp(((y_46_re * t_2) - t_3)) * cos((t_0 + (y_46_im * t_2))); elseif (x_46_re <= -5e-128) tmp = t_1 * t_4; elseif (x_46_re <= 6.2e-157) tmp = t_4; else tmp = t_1 * exp(((y_46_re * log(x_46_re)) - t_3)); 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$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Log[(-x$46$re)], $MachinePrecision]}, Block[{t$95$3 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$4 = 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$3), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -1.9e-30], N[(N[Exp[N[(N[(y$46$re * t$95$2), $MachinePrecision] - t$95$3), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$0 + N[(y$46$im * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, -5e-128], N[(t$95$1 * t$95$4), $MachinePrecision], If[LessEqual[x$46$re, 6.2e-157], t$95$4, N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \cos t\_0\\
t_2 := \log \left(-x.re\right)\\
t_3 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_4 := e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t\_3}\\
\mathbf{if}\;x.re \leq -1.9 \cdot 10^{-30}:\\
\;\;\;\;e^{y.re \cdot t\_2 - t\_3} \cdot \cos \left(t\_0 + y.im \cdot t\_2\right)\\
\mathbf{elif}\;x.re \leq -5 \cdot 10^{-128}:\\
\;\;\;\;t\_1 \cdot t\_4\\
\mathbf{elif}\;x.re \leq 6.2 \cdot 10^{-157}:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot e^{y.re \cdot \log x.re - t\_3}\\
\end{array}
\end{array}
if x.re < -1.9000000000000002e-30Initial program 33.8%
Taylor expanded in x.re around -inf 59.0%
mul-1-neg75.3%
Simplified59.0%
Taylor expanded in x.re around -inf 80.5%
mul-1-neg75.3%
Simplified80.5%
if -1.9000000000000002e-30 < x.re < -5.0000000000000001e-128Initial program 83.3%
Taylor expanded in y.im around 0 100.0%
if -5.0000000000000001e-128 < x.re < 6.1999999999999996e-157Initial program 39.1%
Taylor expanded in y.im around 0 56.7%
Taylor expanded in y.re around 0 64.5%
if 6.1999999999999996e-157 < x.re Initial program 35.5%
Taylor expanded in y.im around 0 64.7%
Taylor expanded in x.re around inf 78.0%
Final simplification76.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (log (- x.re)))
(t_2 (* (atan2 x.im x.re) y.im)))
(if (<= x.re -2e-94)
(* (exp (- (* y.re t_1) t_2)) (cos (+ t_0 (* y.im t_1))))
(if (<= x.re 5.6e-157)
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_2))
(* (cos t_0) (exp (- (* y.re (log x.re)) t_2)))))))
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(-x_46_re);
double t_2 = atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_re <= -2e-94) {
tmp = exp(((y_46_re * t_1) - t_2)) * cos((t_0 + (y_46_im * t_1)));
} else if (x_46_re <= 5.6e-157) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_2));
} else {
tmp = cos(t_0) * exp(((y_46_re * log(x_46_re)) - t_2));
}
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) :: t_2
real(8) :: tmp
t_0 = y_46re * atan2(x_46im, x_46re)
t_1 = log(-x_46re)
t_2 = atan2(x_46im, x_46re) * y_46im
if (x_46re <= (-2d-94)) then
tmp = exp(((y_46re * t_1) - t_2)) * cos((t_0 + (y_46im * t_1)))
else if (x_46re <= 5.6d-157) then
tmp = exp(((y_46re * log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))) - t_2))
else
tmp = cos(t_0) * exp(((y_46re * log(x_46re)) - t_2))
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_re * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.log(-x_46_re);
double t_2 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_re <= -2e-94) {
tmp = Math.exp(((y_46_re * t_1) - t_2)) * Math.cos((t_0 + (y_46_im * t_1)));
} else if (x_46_re <= 5.6e-157) {
tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_2));
} else {
tmp = Math.cos(t_0) * Math.exp(((y_46_re * Math.log(x_46_re)) - t_2));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) t_1 = math.log(-x_46_re) t_2 = math.atan2(x_46_im, x_46_re) * y_46_im tmp = 0 if x_46_re <= -2e-94: tmp = math.exp(((y_46_re * t_1) - t_2)) * math.cos((t_0 + (y_46_im * t_1))) elif x_46_re <= 5.6e-157: tmp = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_2)) else: tmp = math.cos(t_0) * math.exp(((y_46_re * math.log(x_46_re)) - t_2)) 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(Float64(-x_46_re)) t_2 = Float64(atan(x_46_im, x_46_re) * y_46_im) tmp = 0.0 if (x_46_re <= -2e-94) tmp = Float64(exp(Float64(Float64(y_46_re * t_1) - t_2)) * cos(Float64(t_0 + Float64(y_46_im * t_1)))); elseif (x_46_re <= 5.6e-157) 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_2)); else tmp = Float64(cos(t_0) * exp(Float64(Float64(y_46_re * log(x_46_re)) - t_2))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); t_1 = log(-x_46_re); t_2 = atan2(x_46_im, x_46_re) * y_46_im; tmp = 0.0; if (x_46_re <= -2e-94) tmp = exp(((y_46_re * t_1) - t_2)) * cos((t_0 + (y_46_im * t_1))); elseif (x_46_re <= 5.6e-157) tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_2)); else tmp = cos(t_0) * exp(((y_46_re * log(x_46_re)) - t_2)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[(-x$46$re)], $MachinePrecision]}, Block[{t$95$2 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, If[LessEqual[x$46$re, -2e-94], N[(N[Exp[N[(N[(y$46$re * t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$0 + N[(y$46$im * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 5.6e-157], 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$2), $MachinePrecision]], $MachinePrecision], N[(N[Cos[t$95$0], $MachinePrecision] * N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$2), $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(-x.re\right)\\
t_2 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.re \leq -2 \cdot 10^{-94}:\\
\;\;\;\;e^{y.re \cdot t\_1 - t\_2} \cdot \cos \left(t\_0 + y.im \cdot t\_1\right)\\
\mathbf{elif}\;x.re \leq 5.6 \cdot 10^{-157}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t\_2}\\
\mathbf{else}:\\
\;\;\;\;\cos t\_0 \cdot e^{y.re \cdot \log x.re - t\_2}\\
\end{array}
\end{array}
if x.re < -1.9999999999999999e-94Initial program 40.4%
Taylor expanded in x.re around -inf 64.5%
mul-1-neg74.2%
Simplified64.5%
Taylor expanded in x.re around -inf 78.7%
mul-1-neg74.2%
Simplified78.7%
if -1.9999999999999999e-94 < x.re < 5.6000000000000002e-157Initial program 42.9%
Taylor expanded in y.im around 0 60.4%
Taylor expanded in y.re around 0 66.1%
if 5.6000000000000002e-157 < x.re Initial program 35.5%
Taylor expanded in y.im around 0 64.7%
Taylor expanded in x.re around inf 78.0%
Final simplification75.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (cos (* y.re (atan2 x.im x.re)))))
(if (<= x.im -6.5e-36)
(* t_1 (exp (- (* y.re (log (- x.im))) t_0)))
(if (or (<= x.im 4e-308) (and (not (<= x.im 5.5e-219)) (<= x.im 0.95)))
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_0))
(* 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 = cos((y_46_re * atan2(x_46_im, x_46_re)));
double tmp;
if (x_46_im <= -6.5e-36) {
tmp = t_1 * exp(((y_46_re * log(-x_46_im)) - t_0));
} else if ((x_46_im <= 4e-308) || (!(x_46_im <= 5.5e-219) && (x_46_im <= 0.95))) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
} else {
tmp = t_1 * 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 = cos((y_46re * atan2(x_46im, x_46re)))
if (x_46im <= (-6.5d-36)) then
tmp = t_1 * exp(((y_46re * log(-x_46im)) - t_0))
else if ((x_46im <= 4d-308) .or. (.not. (x_46im <= 5.5d-219)) .and. (x_46im <= 0.95d0)) then
tmp = exp(((y_46re * log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))) - t_0))
else
tmp = t_1 * 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.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
double tmp;
if (x_46_im <= -6.5e-36) {
tmp = t_1 * Math.exp(((y_46_re * Math.log(-x_46_im)) - t_0));
} else if ((x_46_im <= 4e-308) || (!(x_46_im <= 5.5e-219) && (x_46_im <= 0.95))) {
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 {
tmp = t_1 * 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.cos((y_46_re * math.atan2(x_46_im, x_46_re))) tmp = 0 if x_46_im <= -6.5e-36: tmp = t_1 * math.exp(((y_46_re * math.log(-x_46_im)) - t_0)) elif (x_46_im <= 4e-308) or (not (x_46_im <= 5.5e-219) and (x_46_im <= 0.95)): 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: tmp = t_1 * 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 = cos(Float64(y_46_re * atan(x_46_im, x_46_re))) tmp = 0.0 if (x_46_im <= -6.5e-36) tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(Float64(-x_46_im))) - t_0))); elseif ((x_46_im <= 4e-308) || (!(x_46_im <= 5.5e-219) && (x_46_im <= 0.95))) 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(t_1 * 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 = cos((y_46_re * atan2(x_46_im, x_46_re))); tmp = 0.0; if (x_46_im <= -6.5e-36) tmp = t_1 * exp(((y_46_re * log(-x_46_im)) - t_0)); elseif ((x_46_im <= 4e-308) || (~((x_46_im <= 5.5e-219)) && (x_46_im <= 0.95))) tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)); else tmp = t_1 * 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[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -6.5e-36], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[(-x$46$im)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x$46$im, 4e-308], And[N[Not[LessEqual[x$46$im, 5.5e-219]], $MachinePrecision], LessEqual[x$46$im, 0.95]]], 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[(t$95$1 * 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 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;x.im \leq -6.5 \cdot 10^{-36}:\\
\;\;\;\;t\_1 \cdot e^{y.re \cdot \log \left(-x.im\right) - t\_0}\\
\mathbf{elif}\;x.im \leq 4 \cdot 10^{-308} \lor \neg \left(x.im \leq 5.5 \cdot 10^{-219}\right) \land x.im \leq 0.95:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot e^{y.re \cdot \log x.im - t\_0}\\
\end{array}
\end{array}
if x.im < -6.50000000000000012e-36Initial program 26.6%
Taylor expanded in y.im around 0 56.4%
Taylor expanded in x.im around -inf 77.6%
mul-1-neg77.6%
Simplified77.6%
if -6.50000000000000012e-36 < x.im < 4.00000000000000013e-308 or 5.50000000000000017e-219 < x.im < 0.94999999999999996Initial program 56.7%
Taylor expanded in y.im around 0 66.9%
Taylor expanded in y.re around 0 69.0%
if 4.00000000000000013e-308 < x.im < 5.50000000000000017e-219 or 0.94999999999999996 < x.im Initial program 30.9%
Taylor expanded in y.im around 0 65.0%
Taylor expanded in x.re around 0 82.0%
Final simplification75.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im)))
(if (or (<= x.im 2.6e-306) (and (not (<= x.im 6.4e-219)) (<= x.im 0.25)))
(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 = atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if ((x_46_im <= 2.6e-306) || (!(x_46_im <= 6.4e-219) && (x_46_im <= 0.25))) {
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;
}
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 <= 2.6d-306) .or. (.not. (x_46im <= 6.4d-219)) .and. (x_46im <= 0.25d0)) then
tmp = exp(((y_46re * log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))) - t_0))
else
tmp = cos((y_46re * atan2(x_46im, x_46re))) * 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 <= 2.6e-306) || (!(x_46_im <= 6.4e-219) && (x_46_im <= 0.25))) {
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 {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * 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 <= 2.6e-306) or (not (x_46_im <= 6.4e-219) and (x_46_im <= 0.25)): 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: tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * 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 <= 2.6e-306) || (!(x_46_im <= 6.4e-219) && (x_46_im <= 0.25))) 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
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 <= 2.6e-306) || (~((x_46_im <= 6.4e-219)) && (x_46_im <= 0.25))) 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)); 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[Or[LessEqual[x$46$im, 2.6e-306], And[N[Not[LessEqual[x$46$im, 6.4e-219]], $MachinePrecision], LessEqual[x$46$im, 0.25]]], 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 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.im \leq 2.6 \cdot 10^{-306} \lor \neg \left(x.im \leq 6.4 \cdot 10^{-219}\right) \land x.im \leq 0.25:\\
\;\;\;\;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 < 2.6e-306 or 6.39999999999999995e-219 < x.im < 0.25Initial program 43.1%
Taylor expanded in y.im around 0 62.2%
Taylor expanded in y.re around 0 62.2%
if 2.6e-306 < x.im < 6.39999999999999995e-219 or 0.25 < x.im Initial program 30.9%
Taylor expanded in y.im around 0 65.0%
Taylor expanded in x.re around 0 82.0%
Final simplification68.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (cos (* y.re (atan2 x.im x.re)))))
(if (<= x.re -1e-94)
(* t_1 (exp (- (* y.re (log (- x.re))) t_0)))
(if (<= x.re 6.5e-157)
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_0))
(* t_1 (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 = atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = cos((y_46_re * atan2(x_46_im, x_46_re)));
double tmp;
if (x_46_re <= -1e-94) {
tmp = t_1 * exp(((y_46_re * log(-x_46_re)) - t_0));
} else if (x_46_re <= 6.5e-157) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
} else {
tmp = t_1 * 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) :: t_1
real(8) :: tmp
t_0 = atan2(x_46im, x_46re) * y_46im
t_1 = cos((y_46re * atan2(x_46im, x_46re)))
if (x_46re <= (-1d-94)) then
tmp = t_1 * exp(((y_46re * log(-x_46re)) - t_0))
else if (x_46re <= 6.5d-157) then
tmp = exp(((y_46re * log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))) - t_0))
else
tmp = t_1 * 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 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
double tmp;
if (x_46_re <= -1e-94) {
tmp = t_1 * Math.exp(((y_46_re * Math.log(-x_46_re)) - t_0));
} else if (x_46_re <= 6.5e-157) {
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 {
tmp = t_1 * 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 = math.atan2(x_46_im, x_46_re) * y_46_im t_1 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) tmp = 0 if x_46_re <= -1e-94: tmp = t_1 * math.exp(((y_46_re * math.log(-x_46_re)) - t_0)) elif x_46_re <= 6.5e-157: 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: tmp = t_1 * 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(atan(x_46_im, x_46_re) * y_46_im) t_1 = cos(Float64(y_46_re * atan(x_46_im, x_46_re))) tmp = 0.0 if (x_46_re <= -1e-94) tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(Float64(-x_46_re))) - t_0))); elseif (x_46_re <= 6.5e-157) 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(t_1 * 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 = atan2(x_46_im, x_46_re) * y_46_im; t_1 = cos((y_46_re * atan2(x_46_im, x_46_re))); tmp = 0.0; if (x_46_re <= -1e-94) tmp = t_1 * exp(((y_46_re * log(-x_46_re)) - t_0)); elseif (x_46_re <= 6.5e-157) tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)); else tmp = t_1 * 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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -1e-94], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[(-x$46$re)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 6.5e-157], 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[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;x.re \leq -1 \cdot 10^{-94}:\\
\;\;\;\;t\_1 \cdot e^{y.re \cdot \log \left(-x.re\right) - t\_0}\\
\mathbf{elif}\;x.re \leq 6.5 \cdot 10^{-157}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t\_0}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot e^{y.re \cdot \log x.re - t\_0}\\
\end{array}
\end{array}
if x.re < -9.9999999999999996e-95Initial program 40.4%
Taylor expanded in y.im around 0 63.4%
Taylor expanded in x.re around -inf 74.2%
mul-1-neg74.2%
Simplified74.2%
if -9.9999999999999996e-95 < x.re < 6.5000000000000002e-157Initial program 42.9%
Taylor expanded in y.im around 0 60.4%
Taylor expanded in y.re around 0 66.1%
if 6.5000000000000002e-157 < x.re Initial program 35.5%
Taylor expanded in y.im around 0 64.7%
Taylor expanded in x.re around inf 78.0%
Final simplification73.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im)))
(if (<= x.re 1.1e-157)
(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.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 (x_46_re <= 1.1e-157) {
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_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 = atan2(x_46im, x_46re) * y_46im
if (x_46re <= 1.1d-157) then
tmp = exp(((y_46re * log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))) - t_0))
else
tmp = cos((y_46re * atan2(x_46im, x_46re))) * 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 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_re <= 1.1e-157) {
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 {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * 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 = math.atan2(x_46_im, x_46_re) * y_46_im tmp = 0 if x_46_re <= 1.1e-157: 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: tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * 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(atan(x_46_im, x_46_re) * y_46_im) tmp = 0.0 if (x_46_re <= 1.1e-157) 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_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 = atan2(x_46_im, x_46_re) * y_46_im; tmp = 0.0; if (x_46_re <= 1.1e-157) 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_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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, If[LessEqual[x$46$re, 1.1e-157], 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$re], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.re \leq 1.1 \cdot 10^{-157}:\\
\;\;\;\;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.re - t\_0}\\
\end{array}
\end{array}
if x.re < 1.10000000000000005e-157Initial program 41.8%
Taylor expanded in y.im around 0 62.5%
Taylor expanded in y.re around 0 62.5%
if 1.10000000000000005e-157 < x.re Initial program 35.1%
Taylor expanded in y.im around 0 64.1%
Taylor expanded in x.re around inf 77.2%
Final simplification68.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im 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(sqrt(((x_46_re * x_46_re) + (x_46_im * 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(sqrt(((x_46re * x_46re) + (x_46im * 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(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)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return 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)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return 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))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) 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))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := 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]
\begin{array}{l}
\\
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}
\end{array}
Initial program 39.2%
Taylor expanded in y.im around 0 63.1%
Taylor expanded in y.re around 0 61.1%
Final simplification61.1%
herbie shell --seed 2024076
(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)))))