
(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 (* y.re (atan2 x.im x.re)))
(t_1 (log (hypot x.re x.im)))
(t_2 (cos (pow (cbrt (fma y.im t_1 t_0)) 3.0))))
(if (<= y.re -2.4e-59)
(*
(exp (fma t_1 y.re (* (atan2 x.im x.re) (- y.im))))
(cos (fma t_1 y.im t_0)))
(if (<= y.re 1.3e+20)
(* (pow (exp (- y.im)) (atan2 x.im x.re)) t_2)
(if (<= y.re 1e+188)
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(fabs (cos (fma y.im (log (hypot x.im x.re)) t_0))))
(* t_2 (pow (hypot x.im x.re) y.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = log(hypot(x_46_re, x_46_im));
double t_2 = cos(pow(cbrt(fma(y_46_im, t_1, t_0)), 3.0));
double tmp;
if (y_46_re <= -2.4e-59) {
tmp = exp(fma(t_1, y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos(fma(t_1, y_46_im, t_0));
} else if (y_46_re <= 1.3e+20) {
tmp = pow(exp(-y_46_im), atan2(x_46_im, x_46_re)) * t_2;
} else if (y_46_re <= 1e+188) {
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))) * fabs(cos(fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_0)));
} else {
tmp = t_2 * pow(hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = log(hypot(x_46_re, x_46_im)) t_2 = cos((cbrt(fma(y_46_im, t_1, t_0)) ^ 3.0)) tmp = 0.0 if (y_46_re <= -2.4e-59) tmp = Float64(exp(fma(t_1, y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cos(fma(t_1, y_46_im, t_0))); elseif (y_46_re <= 1.3e+20) tmp = Float64((exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re)) * t_2); elseif (y_46_re <= 1e+188) tmp = Float64(exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * abs(cos(fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_0)))); else tmp = Float64(t_2 * (hypot(x_46_im, x_46_re) ^ y_46_re)); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[Power[N[Power[N[(y$46$im * t$95$1 + t$95$0), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -2.4e-59], N[(N[Exp[N[(t$95$1 * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$1 * y$46$im + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.3e+20], N[(N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[y$46$re, 1e+188], N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Abs[N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_2 := \cos \left({\left(\sqrt[3]{\mathsf{fma}\left(y.im, t\_1, t\_0\right)}\right)}^{3}\right)\\
\mathbf{if}\;y.re \leq -2.4 \cdot 10^{-59}:\\
\;\;\;\;e^{\mathsf{fma}\left(t\_1, y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \cdot \cos \left(\mathsf{fma}\left(t\_1, y.im, t\_0\right)\right)\\
\mathbf{elif}\;y.re \leq 1.3 \cdot 10^{+20}:\\
\;\;\;\;{\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot t\_2\\
\mathbf{elif}\;y.re \leq 10^{+188}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left|\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), t\_0\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;t\_2 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.re < -2.40000000000000015e-59Initial 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-define89.5%
*-commutative89.5%
Simplified89.5%
if -2.40000000000000015e-59 < y.re < 1.3e20Initial program 34.4%
exp-diff34.4%
exp-to-pow34.4%
hypot-define34.4%
*-commutative34.4%
exp-prod33.6%
fma-define33.6%
hypot-define76.5%
*-commutative76.5%
Simplified76.5%
Taylor expanded in y.re around 0 78.0%
rec-exp78.0%
distribute-lft-neg-in78.0%
exp-prod77.2%
Simplified77.2%
fma-undefine77.2%
hypot-define33.6%
*-commutative33.6%
add-sqr-sqrt22.2%
unpow222.2%
add-cube-cbrt24.0%
pow323.1%
Applied egg-rr83.5%
if 1.3e20 < y.re < 1e188Initial program 45.0%
fma-define45.0%
hypot-define65.0%
*-commutative65.0%
add-sqr-sqrt55.0%
sqrt-unprod90.0%
pow290.0%
fma-undefine90.0%
*-commutative90.0%
*-commutative90.0%
fma-define90.0%
Applied egg-rr90.0%
unpow290.0%
rem-sqrt-square90.0%
hypot-undefine50.0%
unpow250.0%
unpow250.0%
+-commutative50.0%
*-commutative50.0%
unpow250.0%
unpow250.0%
hypot-undefine90.0%
Simplified90.0%
if 1e188 < y.re Initial program 42.3%
exp-diff34.6%
exp-to-pow34.6%
hypot-define34.6%
*-commutative34.6%
exp-prod34.6%
fma-define34.6%
hypot-define61.5%
*-commutative61.5%
Simplified61.5%
Taylor expanded in y.im around 0 76.9%
unpow276.9%
unpow276.9%
hypot-undefine76.9%
Simplified76.9%
fma-undefine32.1%
hypot-define19.9%
*-commutative19.9%
add-sqr-sqrt4.0%
unpow24.0%
add-cube-cbrt4.1%
pow34.1%
Applied egg-rr88.5%
Final simplification86.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 (hypot x.re x.im)))
(t_2 (* y.im (log (hypot x.im x.re)))))
(if (<= y.re -1.8e-60)
(*
(exp (fma t_1 y.re (* (atan2 x.im x.re) (- y.im))))
(cos (fma t_1 y.im t_0)))
(if (<= y.re 1.3e+20)
(*
(pow (exp (- y.im)) (atan2 x.im x.re))
(cos (pow (cbrt (fma y.im t_1 t_0)) 3.0)))
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(- (cos t_2) (* t_0 (sin 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(hypot(x_46_re, x_46_im));
double t_2 = y_46_im * log(hypot(x_46_im, x_46_re));
double tmp;
if (y_46_re <= -1.8e-60) {
tmp = exp(fma(t_1, y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos(fma(t_1, y_46_im, t_0));
} else if (y_46_re <= 1.3e+20) {
tmp = pow(exp(-y_46_im), atan2(x_46_im, x_46_re)) * cos(pow(cbrt(fma(y_46_im, t_1, t_0)), 3.0));
} else {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im))) * (cos(t_2) - (t_0 * sin(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(hypot(x_46_re, x_46_im)) t_2 = Float64(y_46_im * log(hypot(x_46_im, x_46_re))) tmp = 0.0 if (y_46_re <= -1.8e-60) tmp = Float64(exp(fma(t_1, y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cos(fma(t_1, y_46_im, t_0))); elseif (y_46_re <= 1.3e+20) tmp = Float64((exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re)) * cos((cbrt(fma(y_46_im, t_1, t_0)) ^ 3.0))); else tmp = Float64(exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * Float64(cos(t_2) - Float64(t_0 * sin(t_2)))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -1.8e-60], N[(N[Exp[N[(t$95$1 * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$1 * y$46$im + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.3e+20], N[(N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision] * N[Cos[N[Power[N[Power[N[(y$46$im * t$95$1 + t$95$0), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t$95$2], $MachinePrecision] - N[(t$95$0 * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_2 := y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
\mathbf{if}\;y.re \leq -1.8 \cdot 10^{-60}:\\
\;\;\;\;e^{\mathsf{fma}\left(t\_1, y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \cdot \cos \left(\mathsf{fma}\left(t\_1, y.im, t\_0\right)\right)\\
\mathbf{elif}\;y.re \leq 1.3 \cdot 10^{+20}:\\
\;\;\;\;{\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left({\left(\sqrt[3]{\mathsf{fma}\left(y.im, t\_1, t\_0\right)}\right)}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(\cos t\_2 - t\_0 \cdot \sin t\_2\right)\\
\end{array}
\end{array}
if y.re < -1.8e-60Initial 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-define89.5%
*-commutative89.5%
Simplified89.5%
if -1.8e-60 < y.re < 1.3e20Initial program 34.4%
exp-diff34.4%
exp-to-pow34.4%
hypot-define34.4%
*-commutative34.4%
exp-prod33.6%
fma-define33.6%
hypot-define76.5%
*-commutative76.5%
Simplified76.5%
Taylor expanded in y.re around 0 78.0%
rec-exp78.0%
distribute-lft-neg-in78.0%
exp-prod77.2%
Simplified77.2%
fma-undefine77.2%
hypot-define33.6%
*-commutative33.6%
add-sqr-sqrt22.2%
unpow222.2%
add-cube-cbrt24.0%
pow323.1%
Applied egg-rr83.5%
if 1.3e20 < y.re Initial program 43.9%
Taylor expanded in y.re around 0 51.5%
+-commutative51.5%
unpow251.5%
unpow251.5%
hypot-undefine51.5%
mul-1-neg51.5%
unsub-neg51.5%
Simplified83.4%
Final simplification85.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))))
(if (<= y.re -3.4e-6)
(* t_1 (cos t_0))
(if (<= y.re 1.3e+20)
(*
(pow (exp (- y.im)) (atan2 x.im x.re))
(cos (pow (cbrt (fma y.im (log (hypot x.re x.im)) t_0)) 3.0)))
(* t_1 (cos (* y.im (log (hypot x.im x.re)))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (y_46_re <= -3.4e-6) {
tmp = t_1 * cos(t_0);
} else if (y_46_re <= 1.3e+20) {
tmp = pow(exp(-y_46_im), atan2(x_46_im, x_46_re)) * cos(pow(cbrt(fma(y_46_im, log(hypot(x_46_re, x_46_im)), t_0)), 3.0));
} else {
tmp = t_1 * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) 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))) tmp = 0.0 if (y_46_re <= -3.4e-6) tmp = Float64(t_1 * cos(t_0)); elseif (y_46_re <= 1.3e+20) tmp = Float64((exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re)) * cos((cbrt(fma(y_46_im, log(hypot(x_46_re, x_46_im)), t_0)) ^ 3.0))); else tmp = Float64(t_1 * cos(Float64(y_46_im * log(hypot(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[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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]}, If[LessEqual[y$46$re, -3.4e-6], N[(t$95$1 * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.3e+20], N[(N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision] * N[Cos[N[Power[N[Power[N[(y$46$im * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] + t$95$0), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;y.re \leq -3.4 \cdot 10^{-6}:\\
\;\;\;\;t\_1 \cdot \cos t\_0\\
\mathbf{elif}\;y.re \leq 1.3 \cdot 10^{+20}:\\
\;\;\;\;{\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left({\left(\sqrt[3]{\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), t\_0\right)}\right)}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\end{array}
\end{array}
if y.re < -3.40000000000000006e-6Initial program 39.4%
Taylor expanded in y.im around 0 86.4%
if -3.40000000000000006e-6 < y.re < 1.3e20Initial program 34.1%
exp-diff34.1%
exp-to-pow34.1%
hypot-define34.1%
*-commutative34.1%
exp-prod33.3%
fma-define33.3%
hypot-define77.6%
*-commutative77.6%
Simplified77.6%
Taylor expanded in y.re around 0 78.2%
rec-exp78.2%
distribute-lft-neg-in78.2%
exp-prod77.5%
Simplified77.5%
fma-undefine77.5%
hypot-define33.3%
*-commutative33.3%
add-sqr-sqrt21.2%
unpow221.2%
add-cube-cbrt22.8%
pow322.0%
Applied egg-rr83.3%
if 1.3e20 < y.re Initial program 43.9%
Taylor expanded in y.re around 0 47.0%
+-commutative47.0%
unpow247.0%
unpow247.0%
hypot-undefine75.8%
hypot-undefine47.0%
unpow247.0%
unpow247.0%
+-commutative47.0%
unpow247.0%
unpow247.0%
hypot-undefine75.8%
Simplified75.8%
Final simplification82.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))) (t_1 (log (hypot x.re x.im))))
(if (<= y.re -1e-59)
(*
(exp (fma t_1 y.re (* (atan2 x.im x.re) (- y.im))))
(cos (fma t_1 y.im t_0)))
(if (<= y.re 1.3e+20)
(*
(pow (exp (- y.im)) (atan2 x.im x.re))
(cos (pow (cbrt (fma y.im t_1 t_0)) 3.0)))
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(cos (* y.im (log (hypot x.im x.re)))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = log(hypot(x_46_re, x_46_im));
double tmp;
if (y_46_re <= -1e-59) {
tmp = exp(fma(t_1, y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos(fma(t_1, y_46_im, t_0));
} else if (y_46_re <= 1.3e+20) {
tmp = pow(exp(-y_46_im), atan2(x_46_im, x_46_re)) * cos(pow(cbrt(fma(y_46_im, t_1, t_0)), 3.0));
} else {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = log(hypot(x_46_re, x_46_im)) tmp = 0.0 if (y_46_re <= -1e-59) tmp = Float64(exp(fma(t_1, y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cos(fma(t_1, y_46_im, t_0))); elseif (y_46_re <= 1.3e+20) tmp = Float64((exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re)) * cos((cbrt(fma(y_46_im, t_1, t_0)) ^ 3.0))); else tmp = Float64(exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(y_46_im * log(hypot(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[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -1e-59], N[(N[Exp[N[(t$95$1 * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$1 * y$46$im + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.3e+20], N[(N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision] * N[Cos[N[Power[N[Power[N[(y$46$im * t$95$1 + t$95$0), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
\mathbf{if}\;y.re \leq -1 \cdot 10^{-59}:\\
\;\;\;\;e^{\mathsf{fma}\left(t\_1, y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \cdot \cos \left(\mathsf{fma}\left(t\_1, y.im, t\_0\right)\right)\\
\mathbf{elif}\;y.re \leq 1.3 \cdot 10^{+20}:\\
\;\;\;\;{\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos \left({\left(\sqrt[3]{\mathsf{fma}\left(y.im, t\_1, t\_0\right)}\right)}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\end{array}
\end{array}
if y.re < -1e-59Initial 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-define89.5%
*-commutative89.5%
Simplified89.5%
if -1e-59 < y.re < 1.3e20Initial program 34.4%
exp-diff34.4%
exp-to-pow34.4%
hypot-define34.4%
*-commutative34.4%
exp-prod33.6%
fma-define33.6%
hypot-define76.5%
*-commutative76.5%
Simplified76.5%
Taylor expanded in y.re around 0 78.0%
rec-exp78.0%
distribute-lft-neg-in78.0%
exp-prod77.2%
Simplified77.2%
fma-undefine77.2%
hypot-define33.6%
*-commutative33.6%
add-sqr-sqrt22.2%
unpow222.2%
add-cube-cbrt24.0%
pow323.1%
Applied egg-rr83.5%
if 1.3e20 < y.re Initial program 43.9%
Taylor expanded in y.re around 0 47.0%
+-commutative47.0%
unpow247.0%
unpow247.0%
hypot-undefine75.8%
hypot-undefine47.0%
unpow247.0%
unpow247.0%
+-commutative47.0%
unpow247.0%
unpow247.0%
hypot-undefine75.8%
Simplified75.8%
Final simplification83.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot x.im x.re) y.re))
(t_1 (log (hypot x.re x.im)))
(t_2 (* y.re (atan2 x.im x.re))))
(if (<= y.re -6.8e-18)
(*
t_0
(cos
(*
y.re
(+ (atan2 x.im x.re) (* y.im (/ (log (hypot x.im x.re)) y.re))))))
(if (<= y.re 6.5e-26)
(* (cos (fma t_1 y.im t_2)) (exp (* (atan2 x.im x.re) (- y.im))))
(if (<= y.re 4.7e+44)
(* (pow (exp (- y.im)) (atan2 x.im x.re)) (cos t_2))
(* (cos (pow (cbrt (fma y.im t_1 t_2)) 3.0)) t_0))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(hypot(x_46_im, x_46_re), y_46_re);
double t_1 = log(hypot(x_46_re, x_46_im));
double t_2 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_re <= -6.8e-18) {
tmp = t_0 * cos((y_46_re * (atan2(x_46_im, x_46_re) + (y_46_im * (log(hypot(x_46_im, x_46_re)) / y_46_re)))));
} else if (y_46_re <= 6.5e-26) {
tmp = cos(fma(t_1, y_46_im, t_2)) * exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else if (y_46_re <= 4.7e+44) {
tmp = pow(exp(-y_46_im), atan2(x_46_im, x_46_re)) * cos(t_2);
} else {
tmp = cos(pow(cbrt(fma(y_46_im, t_1, t_2)), 3.0)) * t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re t_1 = log(hypot(x_46_re, x_46_im)) t_2 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_re <= -6.8e-18) tmp = Float64(t_0 * cos(Float64(y_46_re * Float64(atan(x_46_im, x_46_re) + Float64(y_46_im * Float64(log(hypot(x_46_im, x_46_re)) / y_46_re)))))); elseif (y_46_re <= 6.5e-26) tmp = Float64(cos(fma(t_1, y_46_im, t_2)) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))); elseif (y_46_re <= 4.7e+44) tmp = Float64((exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re)) * cos(t_2)); else tmp = Float64(cos((cbrt(fma(y_46_im, t_1, t_2)) ^ 3.0)) * t_0); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, Block[{t$95$1 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -6.8e-18], N[(t$95$0 * N[Cos[N[(y$46$re * N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(y$46$im * N[(N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 6.5e-26], N[(N[Cos[N[(t$95$1 * y$46$im + t$95$2), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 4.7e+44], N[(N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision] * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[Power[N[Power[N[(y$46$im * t$95$1 + t$95$2), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
t_1 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.re \leq -6.8 \cdot 10^{-18}:\\
\;\;\;\;t\_0 \cdot \cos \left(y.re \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \frac{\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}{y.re}\right)\right)\\
\mathbf{elif}\;y.re \leq 6.5 \cdot 10^{-26}:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(t\_1, y.im, t\_2\right)\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{elif}\;y.re \leq 4.7 \cdot 10^{+44}:\\
\;\;\;\;{\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos t\_2\\
\mathbf{else}:\\
\;\;\;\;\cos \left({\left(\sqrt[3]{\mathsf{fma}\left(y.im, t\_1, t\_2\right)}\right)}^{3}\right) \cdot t\_0\\
\end{array}
\end{array}
if y.re < -6.80000000000000002e-18Initial program 37.1%
exp-diff30.0%
exp-to-pow30.0%
hypot-define30.0%
*-commutative30.0%
exp-prod30.0%
fma-define30.0%
hypot-define74.3%
*-commutative74.3%
Simplified74.3%
Taylor expanded in y.im around 0 78.8%
unpow278.8%
unpow278.8%
hypot-undefine83.0%
Simplified83.0%
Taylor expanded in y.re around inf 34.3%
+-commutative34.3%
associate-/l*35.8%
unpow235.8%
unpow235.8%
hypot-undefine84.4%
Simplified84.4%
if -6.80000000000000002e-18 < y.re < 6.5e-26Initial program 36.5%
exp-diff36.5%
exp-to-pow36.5%
hypot-define36.5%
*-commutative36.5%
exp-prod35.7%
fma-define35.7%
hypot-define80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in y.re around 0 81.3%
rec-exp81.3%
distribute-lft-neg-in81.3%
Simplified81.3%
if 6.5e-26 < y.re < 4.70000000000000018e44Initial program 37.5%
exp-diff18.8%
exp-to-pow18.8%
hypot-define18.8%
*-commutative18.8%
exp-prod18.8%
fma-define18.8%
hypot-define32.4%
*-commutative32.4%
Simplified32.4%
Taylor expanded in y.re around 0 50.9%
rec-exp50.9%
distribute-lft-neg-in50.9%
exp-prod50.9%
Simplified50.9%
Taylor expanded in y.im around 0 75.9%
if 4.70000000000000018e44 < y.re Initial program 42.1%
exp-diff36.8%
exp-to-pow36.8%
hypot-define36.8%
*-commutative36.8%
exp-prod33.3%
fma-define33.3%
hypot-define56.1%
*-commutative56.1%
Simplified56.1%
Taylor expanded in y.im around 0 70.2%
unpow270.2%
unpow270.2%
hypot-undefine70.2%
Simplified70.2%
fma-undefine22.5%
hypot-define14.9%
*-commutative14.9%
add-sqr-sqrt2.1%
unpow22.1%
add-cube-cbrt3.9%
pow35.6%
Applied egg-rr78.9%
Final simplification81.3%
(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))))
(if (<= y.re -6.8e-18)
(*
(pow (hypot x.im x.re) y.re)
(cos (* y.re (+ (atan2 x.im x.re) (* y.im (/ t_0 y.re))))))
(if (<= y.re 1.85e-25)
(*
(cos (fma (log (hypot x.re x.im)) y.im t_1))
(exp (* (atan2 x.im x.re) (- y.im))))
(if (<= y.re 3.5e+20)
(* (pow (exp (- y.im)) (atan2 x.im x.re)) (cos t_1))
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(cos (* y.im t_0))))))))
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 tmp;
if (y_46_re <= -6.8e-18) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re) * cos((y_46_re * (atan2(x_46_im, x_46_re) + (y_46_im * (t_0 / y_46_re)))));
} else if (y_46_re <= 1.85e-25) {
tmp = cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_1)) * exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else if (y_46_re <= 3.5e+20) {
tmp = pow(exp(-y_46_im), atan2(x_46_im, x_46_re)) * cos(t_1);
} else {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos((y_46_im * t_0));
}
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)) tmp = 0.0 if (y_46_re <= -6.8e-18) tmp = Float64((hypot(x_46_im, x_46_re) ^ y_46_re) * cos(Float64(y_46_re * Float64(atan(x_46_im, x_46_re) + Float64(y_46_im * Float64(t_0 / y_46_re)))))); elseif (y_46_re <= 1.85e-25) tmp = Float64(cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_1)) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))); elseif (y_46_re <= 3.5e+20) tmp = Float64((exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re)) * cos(t_1)); else tmp = Float64(exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(y_46_im * t_0))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[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]}, If[LessEqual[y$46$re, -6.8e-18], N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * 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], If[LessEqual[y$46$re, 1.85e-25], N[(N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im + t$95$1), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 3.5e+20], N[(N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision] * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * t$95$0), $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}\\
\mathbf{if}\;y.re \leq -6.8 \cdot 10^{-18}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(y.re \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \frac{t\_0}{y.re}\right)\right)\\
\mathbf{elif}\;y.re \leq 1.85 \cdot 10^{-25}:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t\_1\right)\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{elif}\;y.re \leq 3.5 \cdot 10^{+20}:\\
\;\;\;\;{\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(y.im \cdot t\_0\right)\\
\end{array}
\end{array}
if y.re < -6.80000000000000002e-18Initial program 37.1%
exp-diff30.0%
exp-to-pow30.0%
hypot-define30.0%
*-commutative30.0%
exp-prod30.0%
fma-define30.0%
hypot-define74.3%
*-commutative74.3%
Simplified74.3%
Taylor expanded in y.im around 0 78.8%
unpow278.8%
unpow278.8%
hypot-undefine83.0%
Simplified83.0%
Taylor expanded in y.re around inf 34.3%
+-commutative34.3%
associate-/l*35.8%
unpow235.8%
unpow235.8%
hypot-undefine84.4%
Simplified84.4%
if -6.80000000000000002e-18 < y.re < 1.85000000000000004e-25Initial program 36.5%
exp-diff36.5%
exp-to-pow36.5%
hypot-define36.5%
*-commutative36.5%
exp-prod35.7%
fma-define35.7%
hypot-define80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in y.re around 0 81.3%
rec-exp81.3%
distribute-lft-neg-in81.3%
Simplified81.3%
if 1.85000000000000004e-25 < y.re < 3.5e20Initial program 12.5%
exp-diff12.5%
exp-to-pow12.5%
hypot-define12.5%
*-commutative12.5%
exp-prod12.5%
fma-define12.5%
hypot-define27.4%
*-commutative27.4%
Simplified27.4%
Taylor expanded in y.re around 0 38.4%
rec-exp38.4%
distribute-lft-neg-in38.4%
exp-prod38.4%
Simplified38.4%
Taylor expanded in y.im around 0 88.6%
if 3.5e20 < y.re Initial program 44.6%
Taylor expanded in y.re around 0 47.7%
+-commutative47.7%
unpow247.7%
unpow247.7%
hypot-undefine76.9%
hypot-undefine47.7%
unpow247.7%
unpow247.7%
+-commutative47.7%
unpow247.7%
unpow247.7%
hypot-undefine76.9%
Simplified76.9%
Final simplification81.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.im x.re)))
(t_1 (pow (hypot x.im x.re) y.re))
(t_2 (* y.re (atan2 x.im x.re))))
(if (<= y.re -6.8e-18)
(* t_1 (cos (* y.re (+ (atan2 x.im x.re) (* y.im (/ t_0 y.re))))))
(if (<= y.re 1.3e-25)
(*
(cos (fma (log (hypot x.re x.im)) y.im t_2))
(exp (* (atan2 x.im x.re) (- y.im))))
(if (<= y.re 3.4e+42)
(* (pow (exp (- y.im)) (atan2 x.im x.re)) (cos t_2))
(* (cos (* y.im t_0)) t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_im, x_46_re));
double t_1 = pow(hypot(x_46_im, x_46_re), y_46_re);
double t_2 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_re <= -6.8e-18) {
tmp = t_1 * cos((y_46_re * (atan2(x_46_im, x_46_re) + (y_46_im * (t_0 / y_46_re)))));
} else if (y_46_re <= 1.3e-25) {
tmp = cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_2)) * exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else if (y_46_re <= 3.4e+42) {
tmp = pow(exp(-y_46_im), atan2(x_46_im, x_46_re)) * cos(t_2);
} else {
tmp = cos((y_46_im * t_0)) * t_1;
}
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 = hypot(x_46_im, x_46_re) ^ y_46_re t_2 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_re <= -6.8e-18) 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)))))); elseif (y_46_re <= 1.3e-25) tmp = Float64(cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_2)) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))); elseif (y_46_re <= 3.4e+42) tmp = Float64((exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re)) * cos(t_2)); else tmp = Float64(cos(Float64(y_46_im * t_0)) * t_1); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, Block[{t$95$2 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -6.8e-18], 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], If[LessEqual[y$46$re, 1.3e-25], N[(N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im + t$95$2), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 3.4e+42], N[(N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision] * N[Cos[t$95$2], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(y$46$im * t$95$0), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_1 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
t_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.re \leq -6.8 \cdot 10^{-18}:\\
\;\;\;\;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)\\
\mathbf{elif}\;y.re \leq 1.3 \cdot 10^{-25}:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t\_2\right)\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{elif}\;y.re \leq 3.4 \cdot 10^{+42}:\\
\;\;\;\;{\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot \cos t\_2\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.im \cdot t\_0\right) \cdot t\_1\\
\end{array}
\end{array}
if y.re < -6.80000000000000002e-18Initial program 37.1%
exp-diff30.0%
exp-to-pow30.0%
hypot-define30.0%
*-commutative30.0%
exp-prod30.0%
fma-define30.0%
hypot-define74.3%
*-commutative74.3%
Simplified74.3%
Taylor expanded in y.im around 0 78.8%
unpow278.8%
unpow278.8%
hypot-undefine83.0%
Simplified83.0%
Taylor expanded in y.re around inf 34.3%
+-commutative34.3%
associate-/l*35.8%
unpow235.8%
unpow235.8%
hypot-undefine84.4%
Simplified84.4%
if -6.80000000000000002e-18 < y.re < 1.3e-25Initial program 36.5%
exp-diff36.5%
exp-to-pow36.5%
hypot-define36.5%
*-commutative36.5%
exp-prod35.7%
fma-define35.7%
hypot-define80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in y.re around 0 81.3%
rec-exp81.3%
distribute-lft-neg-in81.3%
Simplified81.3%
if 1.3e-25 < y.re < 3.39999999999999975e42Initial program 33.3%
exp-diff13.3%
exp-to-pow13.3%
hypot-define13.3%
*-commutative13.3%
exp-prod13.3%
fma-define13.3%
hypot-define27.9%
*-commutative27.9%
Simplified27.9%
Taylor expanded in y.re around 0 47.6%
rec-exp47.6%
distribute-lft-neg-in47.6%
exp-prod47.6%
Simplified47.6%
Taylor expanded in y.im around 0 74.3%
if 3.39999999999999975e42 < y.re Initial program 43.1%
exp-diff37.9%
exp-to-pow37.9%
hypot-define37.9%
*-commutative37.9%
exp-prod34.5%
fma-define34.5%
hypot-define56.9%
*-commutative56.9%
Simplified56.9%
Taylor expanded in y.im around 0 70.7%
unpow270.7%
unpow270.7%
hypot-undefine70.7%
Simplified70.7%
Taylor expanded in y.im around inf 46.6%
unpow246.6%
unpow246.6%
hypot-undefine77.6%
Simplified77.6%
Final simplification80.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.im x.re)))
(t_1 (cos (* y.im t_0)))
(t_2 (pow (hypot x.im x.re) y.re))
(t_3 (pow (exp (- y.im)) (atan2 x.im x.re))))
(if (<= y.re -6.8e-18)
(* t_2 (cos (* y.re (+ (atan2 x.im x.re) (* y.im (/ t_0 y.re))))))
(if (<= y.re 1e-24)
(* t_3 t_1)
(if (<= y.re 3.4e+42)
(* t_3 (cos (* y.re (atan2 x.im x.re))))
(* t_1 t_2))))))
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 = cos((y_46_im * t_0));
double t_2 = pow(hypot(x_46_im, x_46_re), y_46_re);
double t_3 = pow(exp(-y_46_im), atan2(x_46_im, x_46_re));
double tmp;
if (y_46_re <= -6.8e-18) {
tmp = t_2 * cos((y_46_re * (atan2(x_46_im, x_46_re) + (y_46_im * (t_0 / y_46_re)))));
} else if (y_46_re <= 1e-24) {
tmp = t_3 * t_1;
} else if (y_46_re <= 3.4e+42) {
tmp = t_3 * cos((y_46_re * atan2(x_46_im, x_46_re)));
} else {
tmp = t_1 * t_2;
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.log(Math.hypot(x_46_im, x_46_re));
double t_1 = Math.cos((y_46_im * t_0));
double t_2 = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
double t_3 = Math.pow(Math.exp(-y_46_im), Math.atan2(x_46_im, x_46_re));
double tmp;
if (y_46_re <= -6.8e-18) {
tmp = t_2 * Math.cos((y_46_re * (Math.atan2(x_46_im, x_46_re) + (y_46_im * (t_0 / y_46_re)))));
} else if (y_46_re <= 1e-24) {
tmp = t_3 * t_1;
} else if (y_46_re <= 3.4e+42) {
tmp = t_3 * Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
} else {
tmp = t_1 * t_2;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.log(math.hypot(x_46_im, x_46_re)) t_1 = math.cos((y_46_im * t_0)) t_2 = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) t_3 = math.pow(math.exp(-y_46_im), math.atan2(x_46_im, x_46_re)) tmp = 0 if y_46_re <= -6.8e-18: tmp = t_2 * math.cos((y_46_re * (math.atan2(x_46_im, x_46_re) + (y_46_im * (t_0 / y_46_re))))) elif y_46_re <= 1e-24: tmp = t_3 * t_1 elif y_46_re <= 3.4e+42: tmp = t_3 * math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) else: tmp = t_1 * t_2 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 = cos(Float64(y_46_im * t_0)) t_2 = hypot(x_46_im, x_46_re) ^ y_46_re t_3 = exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re) tmp = 0.0 if (y_46_re <= -6.8e-18) tmp = Float64(t_2 * cos(Float64(y_46_re * Float64(atan(x_46_im, x_46_re) + Float64(y_46_im * Float64(t_0 / y_46_re)))))); elseif (y_46_re <= 1e-24) tmp = Float64(t_3 * t_1); elseif (y_46_re <= 3.4e+42) tmp = Float64(t_3 * cos(Float64(y_46_re * atan(x_46_im, x_46_re)))); else tmp = Float64(t_1 * t_2); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_im, x_46_re)); t_1 = cos((y_46_im * t_0)); t_2 = hypot(x_46_im, x_46_re) ^ y_46_re; t_3 = exp(-y_46_im) ^ atan2(x_46_im, x_46_re); tmp = 0.0; if (y_46_re <= -6.8e-18) tmp = t_2 * cos((y_46_re * (atan2(x_46_im, x_46_re) + (y_46_im * (t_0 / y_46_re))))); elseif (y_46_re <= 1e-24) tmp = t_3 * t_1; elseif (y_46_re <= 3.4e+42) tmp = t_3 * cos((y_46_re * atan2(x_46_im, x_46_re))); else tmp = t_1 * 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[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(y$46$im * t$95$0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -6.8e-18], N[(t$95$2 * 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], If[LessEqual[y$46$re, 1e-24], N[(t$95$3 * t$95$1), $MachinePrecision], If[LessEqual[y$46$re, 3.4e+42], N[(t$95$3 * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t$95$2), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_1 := \cos \left(y.im \cdot t\_0\right)\\
t_2 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
t_3 := {\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{if}\;y.re \leq -6.8 \cdot 10^{-18}:\\
\;\;\;\;t\_2 \cdot \cos \left(y.re \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \frac{t\_0}{y.re}\right)\right)\\
\mathbf{elif}\;y.re \leq 10^{-24}:\\
\;\;\;\;t\_3 \cdot t\_1\\
\mathbf{elif}\;y.re \leq 3.4 \cdot 10^{+42}:\\
\;\;\;\;t\_3 \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\end{array}
\end{array}
if y.re < -6.80000000000000002e-18Initial program 37.1%
exp-diff30.0%
exp-to-pow30.0%
hypot-define30.0%
*-commutative30.0%
exp-prod30.0%
fma-define30.0%
hypot-define74.3%
*-commutative74.3%
Simplified74.3%
Taylor expanded in y.im around 0 78.8%
unpow278.8%
unpow278.8%
hypot-undefine83.0%
Simplified83.0%
Taylor expanded in y.re around inf 34.3%
+-commutative34.3%
associate-/l*35.8%
unpow235.8%
unpow235.8%
hypot-undefine84.4%
Simplified84.4%
if -6.80000000000000002e-18 < y.re < 9.99999999999999924e-25Initial program 36.5%
exp-diff36.5%
exp-to-pow36.5%
hypot-define36.5%
*-commutative36.5%
exp-prod35.7%
fma-define35.7%
hypot-define80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in y.re around 0 81.3%
rec-exp81.3%
distribute-lft-neg-in81.3%
exp-prod80.5%
Simplified80.5%
Taylor expanded in y.im around inf 35.7%
unpow220.2%
unpow220.2%
hypot-undefine46.7%
Simplified80.5%
if 9.99999999999999924e-25 < y.re < 3.39999999999999975e42Initial program 33.3%
exp-diff13.3%
exp-to-pow13.3%
hypot-define13.3%
*-commutative13.3%
exp-prod13.3%
fma-define13.3%
hypot-define27.9%
*-commutative27.9%
Simplified27.9%
Taylor expanded in y.re around 0 47.6%
rec-exp47.6%
distribute-lft-neg-in47.6%
exp-prod47.6%
Simplified47.6%
Taylor expanded in y.im around 0 74.3%
if 3.39999999999999975e42 < y.re Initial program 43.1%
exp-diff37.9%
exp-to-pow37.9%
hypot-define37.9%
*-commutative37.9%
exp-prod34.5%
fma-define34.5%
hypot-define56.9%
*-commutative56.9%
Simplified56.9%
Taylor expanded in y.im around 0 70.7%
unpow270.7%
unpow270.7%
hypot-undefine70.7%
Simplified70.7%
Taylor expanded in y.im around inf 46.6%
unpow246.6%
unpow246.6%
hypot-undefine77.6%
Simplified77.6%
Final simplification80.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (exp (- y.im)) (atan2 x.im x.re)))
(t_1 (cos (* y.im (log (hypot x.im x.re)))))
(t_2 (pow (hypot x.im x.re) y.re))
(t_3 (cos (* y.re (atan2 x.im x.re)))))
(if (<= y.re -6.8e-18)
(* t_2 t_3)
(if (<= y.re 2.9e-25)
(* t_0 t_1)
(if (<= y.re 3.7e+42) (* t_0 t_3) (* t_1 t_2))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(exp(-y_46_im), atan2(x_46_im, x_46_re));
double t_1 = cos((y_46_im * log(hypot(x_46_im, x_46_re))));
double t_2 = pow(hypot(x_46_im, x_46_re), y_46_re);
double t_3 = cos((y_46_re * atan2(x_46_im, x_46_re)));
double tmp;
if (y_46_re <= -6.8e-18) {
tmp = t_2 * t_3;
} else if (y_46_re <= 2.9e-25) {
tmp = t_0 * t_1;
} else if (y_46_re <= 3.7e+42) {
tmp = t_0 * t_3;
} else {
tmp = t_1 * t_2;
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.pow(Math.exp(-y_46_im), Math.atan2(x_46_im, x_46_re));
double t_1 = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))));
double t_2 = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
double t_3 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
double tmp;
if (y_46_re <= -6.8e-18) {
tmp = t_2 * t_3;
} else if (y_46_re <= 2.9e-25) {
tmp = t_0 * t_1;
} else if (y_46_re <= 3.7e+42) {
tmp = t_0 * t_3;
} else {
tmp = t_1 * t_2;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.pow(math.exp(-y_46_im), math.atan2(x_46_im, x_46_re)) t_1 = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) t_2 = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) t_3 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) tmp = 0 if y_46_re <= -6.8e-18: tmp = t_2 * t_3 elif y_46_re <= 2.9e-25: tmp = t_0 * t_1 elif y_46_re <= 3.7e+42: tmp = t_0 * t_3 else: tmp = t_1 * t_2 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re) t_1 = cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) t_2 = hypot(x_46_im, x_46_re) ^ y_46_re t_3 = cos(Float64(y_46_re * atan(x_46_im, x_46_re))) tmp = 0.0 if (y_46_re <= -6.8e-18) tmp = Float64(t_2 * t_3); elseif (y_46_re <= 2.9e-25) tmp = Float64(t_0 * t_1); elseif (y_46_re <= 3.7e+42) tmp = Float64(t_0 * t_3); else tmp = Float64(t_1 * t_2); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp(-y_46_im) ^ atan2(x_46_im, x_46_re); t_1 = cos((y_46_im * log(hypot(x_46_im, x_46_re)))); t_2 = hypot(x_46_im, x_46_re) ^ y_46_re; t_3 = cos((y_46_re * atan2(x_46_im, x_46_re))); tmp = 0.0; if (y_46_re <= -6.8e-18) tmp = t_2 * t_3; elseif (y_46_re <= 2.9e-25) tmp = t_0 * t_1; elseif (y_46_re <= 3.7e+42) tmp = t_0 * t_3; else tmp = t_1 * 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[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, Block[{t$95$3 = N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -6.8e-18], N[(t$95$2 * t$95$3), $MachinePrecision], If[LessEqual[y$46$re, 2.9e-25], N[(t$95$0 * t$95$1), $MachinePrecision], If[LessEqual[y$46$re, 3.7e+42], N[(t$95$0 * t$95$3), $MachinePrecision], N[(t$95$1 * t$95$2), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}\\
t_1 := \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
t_2 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
t_3 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;y.re \leq -6.8 \cdot 10^{-18}:\\
\;\;\;\;t\_2 \cdot t\_3\\
\mathbf{elif}\;y.re \leq 2.9 \cdot 10^{-25}:\\
\;\;\;\;t\_0 \cdot t\_1\\
\mathbf{elif}\;y.re \leq 3.7 \cdot 10^{+42}:\\
\;\;\;\;t\_0 \cdot t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\end{array}
\end{array}
if y.re < -6.80000000000000002e-18Initial program 37.1%
exp-diff30.0%
exp-to-pow30.0%
hypot-define30.0%
*-commutative30.0%
exp-prod30.0%
fma-define30.0%
hypot-define74.3%
*-commutative74.3%
Simplified74.3%
Taylor expanded in y.im around 0 78.8%
unpow278.8%
unpow278.8%
hypot-undefine83.0%
Simplified83.0%
Taylor expanded in y.im around 0 81.5%
if -6.80000000000000002e-18 < y.re < 2.9000000000000001e-25Initial program 36.5%
exp-diff36.5%
exp-to-pow36.5%
hypot-define36.5%
*-commutative36.5%
exp-prod35.7%
fma-define35.7%
hypot-define80.5%
*-commutative80.5%
Simplified80.5%
Taylor expanded in y.re around 0 81.3%
rec-exp81.3%
distribute-lft-neg-in81.3%
exp-prod80.5%
Simplified80.5%
Taylor expanded in y.im around inf 35.7%
unpow220.2%
unpow220.2%
hypot-undefine46.7%
Simplified80.5%
if 2.9000000000000001e-25 < y.re < 3.69999999999999996e42Initial program 33.3%
exp-diff13.3%
exp-to-pow13.3%
hypot-define13.3%
*-commutative13.3%
exp-prod13.3%
fma-define13.3%
hypot-define27.9%
*-commutative27.9%
Simplified27.9%
Taylor expanded in y.re around 0 47.6%
rec-exp47.6%
distribute-lft-neg-in47.6%
exp-prod47.6%
Simplified47.6%
Taylor expanded in y.im around 0 74.3%
if 3.69999999999999996e42 < y.re Initial program 43.1%
exp-diff37.9%
exp-to-pow37.9%
hypot-define37.9%
*-commutative37.9%
exp-prod34.5%
fma-define34.5%
hypot-define56.9%
*-commutative56.9%
Simplified56.9%
Taylor expanded in y.im around 0 70.7%
unpow270.7%
unpow270.7%
hypot-undefine70.7%
Simplified70.7%
Taylor expanded in y.im around inf 46.6%
unpow246.6%
unpow246.6%
hypot-undefine77.6%
Simplified77.6%
Final simplification79.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot x.im x.re) y.re))
(t_1 (cos (* y.re (atan2 x.im x.re)))))
(if (<= y.re -1e-50)
(* t_0 t_1)
(if (<= y.re 3.4e+42)
(* (pow (exp (- y.im)) (atan2 x.im x.re)) t_1)
(* (cos (* y.im (log (hypot x.im x.re)))) t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(hypot(x_46_im, x_46_re), y_46_re);
double t_1 = cos((y_46_re * atan2(x_46_im, x_46_re)));
double tmp;
if (y_46_re <= -1e-50) {
tmp = t_0 * t_1;
} else if (y_46_re <= 3.4e+42) {
tmp = pow(exp(-y_46_im), atan2(x_46_im, x_46_re)) * t_1;
} else {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * t_0;
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
double t_1 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
double tmp;
if (y_46_re <= -1e-50) {
tmp = t_0 * t_1;
} else if (y_46_re <= 3.4e+42) {
tmp = Math.pow(Math.exp(-y_46_im), Math.atan2(x_46_im, x_46_re)) * t_1;
} else {
tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) * t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) t_1 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) tmp = 0 if y_46_re <= -1e-50: tmp = t_0 * t_1 elif y_46_re <= 3.4e+42: tmp = math.pow(math.exp(-y_46_im), math.atan2(x_46_im, x_46_re)) * t_1 else: tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) * t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re t_1 = cos(Float64(y_46_re * atan(x_46_im, x_46_re))) tmp = 0.0 if (y_46_re <= -1e-50) tmp = Float64(t_0 * t_1); elseif (y_46_re <= 3.4e+42) tmp = Float64((exp(Float64(-y_46_im)) ^ atan(x_46_im, x_46_re)) * t_1); else tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, 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 = hypot(x_46_im, x_46_re) ^ y_46_re; t_1 = cos((y_46_re * atan2(x_46_im, x_46_re))); tmp = 0.0; if (y_46_re <= -1e-50) tmp = t_0 * t_1; elseif (y_46_re <= 3.4e+42) tmp = (exp(-y_46_im) ^ atan2(x_46_im, x_46_re)) * t_1; else tmp = cos((y_46_im * log(hypot(x_46_im, 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[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -1e-50], N[(t$95$0 * t$95$1), $MachinePrecision], If[LessEqual[y$46$re, 3.4e+42], N[(N[Power[N[Exp[(-y$46$im)], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;y.re \leq -1 \cdot 10^{-50}:\\
\;\;\;\;t\_0 \cdot t\_1\\
\mathbf{elif}\;y.re \leq 3.4 \cdot 10^{+42}:\\
\;\;\;\;{\left(e^{-y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot t\_0\\
\end{array}
\end{array}
if y.re < -1.00000000000000001e-50Initial program 37.0%
exp-diff30.1%
exp-to-pow30.1%
hypot-define30.1%
*-commutative30.1%
exp-prod30.1%
fma-define30.1%
hypot-define75.3%
*-commutative75.3%
Simplified75.3%
Taylor expanded in y.im around 0 75.7%
unpow275.7%
unpow275.7%
hypot-undefine82.3%
Simplified82.3%
Taylor expanded in y.im around 0 80.9%
if -1.00000000000000001e-50 < y.re < 3.39999999999999975e42Initial program 36.2%
exp-diff33.8%
exp-to-pow33.8%
hypot-define33.8%
*-commutative33.8%
exp-prod33.1%
fma-define33.1%
hypot-define73.7%
*-commutative73.7%
Simplified73.7%
Taylor expanded in y.re around 0 76.8%
rec-exp76.8%
distribute-lft-neg-in76.8%
exp-prod76.1%
Simplified76.1%
Taylor expanded in y.im around 0 74.3%
if 3.39999999999999975e42 < y.re Initial program 43.1%
exp-diff37.9%
exp-to-pow37.9%
hypot-define37.9%
*-commutative37.9%
exp-prod34.5%
fma-define34.5%
hypot-define56.9%
*-commutative56.9%
Simplified56.9%
Taylor expanded in y.im around 0 70.7%
unpow270.7%
unpow270.7%
hypot-undefine70.7%
Simplified70.7%
Taylor expanded in y.im around inf 46.6%
unpow246.6%
unpow246.6%
hypot-undefine77.6%
Simplified77.6%
Final simplification76.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (pow (hypot x.im x.re) y.re) (cos (* 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) {
return pow(hypot(x_46_im, x_46_re), y_46_re) * cos((y_46_re * atan2(x_46_im, x_46_re)));
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re) * Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.pow(math.hypot(x_46_im, x_46_re), y_46_re) * math.cos((y_46_re * math.atan2(x_46_im, x_46_re)))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64((hypot(x_46_im, x_46_re) ^ y_46_re) * cos(Float64(y_46_re * atan(x_46_im, x_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = (hypot(x_46_im, x_46_re) ^ y_46_re) * cos((y_46_re * atan2(x_46_im, x_46_re))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)
\end{array}
Initial program 38.0%
exp-diff33.7%
exp-to-pow33.7%
hypot-define33.7%
*-commutative33.7%
exp-prod32.6%
fma-define32.6%
hypot-define70.4%
*-commutative70.4%
Simplified70.4%
Taylor expanded in y.im around 0 52.9%
unpow252.9%
unpow252.9%
hypot-undefine60.9%
Simplified60.9%
Taylor expanded in y.im around 0 61.0%
Final simplification61.0%
herbie shell --seed 2024080
(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)))))