
(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 12 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
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im))))
(t_2 (log (hypot x.re x.im)))
(t_3 (log (hypot x.im x.re)))
(t_4 (* y.im t_3)))
(if (<= y.re -3.7e-23)
(* (fabs (cos (fma y.im t_3 t_0))) t_1)
(if (<= y.re 1e-151)
(*
(/ (pow (hypot x.re x.im) y.re) (pow (exp y.im) (atan2 x.im x.re)))
(cos (pow (cbrt (fma y.im t_2 t_0)) 3.0)))
(if (<= y.re 1.05e+27)
(*
(exp (fma t_2 y.re (* (atan2 x.im x.re) (- y.im))))
(cos (fma t_2 y.im t_0)))
(* (- (cos t_4) (* y.re (* (atan2 x.im x.re) (sin t_4)))) t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = 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 t_2 = log(hypot(x_46_re, x_46_im));
double t_3 = log(hypot(x_46_im, x_46_re));
double t_4 = y_46_im * t_3;
double tmp;
if (y_46_re <= -3.7e-23) {
tmp = fabs(cos(fma(y_46_im, t_3, t_0))) * t_1;
} else if (y_46_re <= 1e-151) {
tmp = (pow(hypot(x_46_re, x_46_im), y_46_re) / pow(exp(y_46_im), atan2(x_46_im, x_46_re))) * cos(pow(cbrt(fma(y_46_im, t_2, t_0)), 3.0));
} else if (y_46_re <= 1.05e+27) {
tmp = exp(fma(t_2, y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos(fma(t_2, y_46_im, t_0));
} else {
tmp = (cos(t_4) - (y_46_re * (atan2(x_46_im, x_46_re) * sin(t_4)))) * t_1;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = 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))) t_2 = log(hypot(x_46_re, x_46_im)) t_3 = log(hypot(x_46_im, x_46_re)) t_4 = Float64(y_46_im * t_3) tmp = 0.0 if (y_46_re <= -3.7e-23) tmp = Float64(abs(cos(fma(y_46_im, t_3, t_0))) * t_1); elseif (y_46_re <= 1e-151) tmp = Float64(Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan(x_46_im, x_46_re))) * cos((cbrt(fma(y_46_im, t_2, t_0)) ^ 3.0))); elseif (y_46_re <= 1.05e+27) tmp = Float64(exp(fma(t_2, y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cos(fma(t_2, y_46_im, t_0))); else tmp = Float64(Float64(cos(t_4) - Float64(y_46_re * Float64(atan(x_46_im, x_46_re) * sin(t_4)))) * t_1); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[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]}, Block[{t$95$2 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(y$46$im * t$95$3), $MachinePrecision]}, If[LessEqual[y$46$re, -3.7e-23], N[(N[Abs[N[Cos[N[(y$46$im * t$95$3 + t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[y$46$re, 1e-151], N[(N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[Power[N[Power[N[(y$46$im * t$95$2 + t$95$0), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 1.05e+27], N[(N[Exp[N[(t$95$2 * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$2 * y$46$im + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[t$95$4], $MachinePrecision] - N[(y$46$re * N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * N[Sin[t$95$4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $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}\\
t_2 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_3 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_4 := y.im \cdot t_3\\
\mathbf{if}\;y.re \leq -3.7 \cdot 10^{-23}:\\
\;\;\;\;\left|\cos \left(\mathsf{fma}\left(y.im, t_3, t_0\right)\right)\right| \cdot t_1\\
\mathbf{elif}\;y.re \leq 10^{-151}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left({\left(\sqrt[3]{\mathsf{fma}\left(y.im, t_2, t_0\right)}\right)}^{3}\right)\\
\mathbf{elif}\;y.re \leq 1.05 \cdot 10^{+27}:\\
\;\;\;\;e^{\mathsf{fma}\left(t_2, y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \cdot \cos \left(\mathsf{fma}\left(t_2, y.im, t_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\cos t_4 - y.re \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \sin t_4\right)\right) \cdot t_1\\
\end{array}
\end{array}
if y.re < -3.7000000000000003e-23Initial program 29.5%
fma-def29.5%
hypot-udef77.1%
*-commutative77.1%
add-sqr-sqrt34.1%
sqrt-unprod84.8%
pow284.8%
fma-udef84.8%
*-commutative84.8%
*-commutative84.8%
fma-def84.8%
Applied egg-rr84.8%
unpow284.8%
rem-sqrt-square84.8%
*-commutative84.8%
hypot-def35.6%
unpow235.6%
unpow235.6%
+-commutative35.6%
fma-def35.6%
fma-def35.6%
unpow235.6%
unpow235.6%
hypot-def84.8%
Simplified84.8%
if -3.7000000000000003e-23 < y.re < 9.9999999999999994e-152Initial program 39.4%
exp-diff39.4%
exp-to-pow39.4%
hypot-def39.4%
*-commutative39.4%
exp-prod39.4%
fma-def39.4%
hypot-def78.0%
*-commutative78.0%
Simplified78.0%
add-cube-cbrt84.0%
pow384.0%
fma-udef84.0%
*-commutative84.0%
*-commutative84.0%
fma-def84.0%
Applied egg-rr84.0%
if 9.9999999999999994e-152 < y.re < 1.04999999999999997e27Initial program 45.5%
fma-neg45.5%
hypot-def45.5%
distribute-rgt-neg-out45.5%
fma-def45.5%
hypot-def82.7%
*-commutative82.7%
Simplified82.7%
if 1.04999999999999997e27 < y.re Initial program 35.4%
Taylor expanded in y.re around 0 43.8%
mul-1-neg43.8%
unsub-neg43.8%
unpow243.8%
unpow243.8%
hypot-def43.8%
*-commutative43.8%
unpow243.8%
unpow243.8%
Simplified77.1%
Final simplification82.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_2 (exp (- (* y.re t_1) (* (atan2 x.im x.re) y.im))))
(t_3 (* (cos (+ t_0 (* t_1 y.im))) t_2)))
(if (<= t_3 0.2)
(* t_2 (fabs (cos t_0)))
(if (<= t_3 INFINITY)
(* (cos (* y.im (log (hypot x.im x.re)))) t_2)
(*
(/ (pow (hypot x.re x.im) y.re) (pow (exp y.im) (atan2 x.im x.re)))
(cos (fma (log (hypot x.re x.im)) 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 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_2 = exp(((y_46_re * t_1) - (atan2(x_46_im, x_46_re) * y_46_im)));
double t_3 = cos((t_0 + (t_1 * y_46_im))) * t_2;
double tmp;
if (t_3 <= 0.2) {
tmp = t_2 * fabs(cos(t_0));
} else if (t_3 <= ((double) INFINITY)) {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * t_2;
} else {
tmp = (pow(hypot(x_46_re, x_46_im), y_46_re) / pow(exp(y_46_im), atan2(x_46_im, x_46_re))) * cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_0));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_2 = exp(Float64(Float64(y_46_re * t_1) - Float64(atan(x_46_im, x_46_re) * y_46_im))) t_3 = Float64(cos(Float64(t_0 + Float64(t_1 * y_46_im))) * t_2) tmp = 0.0 if (t_3 <= 0.2) tmp = Float64(t_2 * abs(cos(t_0))); elseif (t_3 <= Inf) tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * t_2); else tmp = Float64(Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan(x_46_im, x_46_re))) * cos(fma(log(hypot(x_46_re, x_46_im)), 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[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[(y$46$re * t$95$1), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[N[(t$95$0 + N[(t$95$1 * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision]}, If[LessEqual[t$95$3, 0.2], N[(t$95$2 * N[Abs[N[Cos[t$95$0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, Infinity], 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$2), $MachinePrecision], N[(N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im + t$95$0), $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(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_2 := e^{y.re \cdot t_1 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
t_3 := \cos \left(t_0 + t_1 \cdot y.im\right) \cdot t_2\\
\mathbf{if}\;t_3 \leq 0.2:\\
\;\;\;\;t_2 \cdot \left|\cos t_0\right|\\
\mathbf{elif}\;t_3 \leq \infty:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t_0\right)\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < 0.20000000000000001Initial program 68.8%
fma-def68.8%
hypot-udef68.8%
*-commutative68.8%
add-sqr-sqrt23.4%
sqrt-unprod86.2%
pow286.2%
fma-udef86.2%
*-commutative86.2%
*-commutative86.2%
fma-def86.2%
Applied egg-rr86.2%
unpow286.2%
rem-sqrt-square86.2%
*-commutative86.2%
hypot-def86.2%
unpow286.2%
unpow286.2%
+-commutative86.2%
fma-def86.2%
fma-def86.2%
unpow286.2%
unpow286.2%
hypot-def86.2%
Simplified86.2%
Taylor expanded in y.im around 0 86.2%
if 0.20000000000000001 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < +inf.0Initial program 75.2%
Taylor expanded in y.re around 0 81.1%
unpow281.1%
unpow281.1%
hypot-def81.1%
Simplified81.1%
if +inf.0 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) Initial program 0.0%
exp-diff0.0%
exp-to-pow0.0%
hypot-def0.0%
*-commutative0.0%
exp-prod0.0%
fma-def0.0%
hypot-def73.8%
*-commutative73.8%
Simplified73.8%
Final simplification78.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im)))
(t_1 (* y.re (atan2 x.im x.re)))
(t_2 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_3 (exp (- (* y.re t_2) (* (atan2 x.im x.re) y.im)))))
(if (<= (* (cos (+ t_1 (* t_2 y.im))) t_3) -0.5)
(* (fabs (cos (fma y.im (log (hypot x.im x.re)) t_1))) t_3)
(*
(exp (fma t_0 y.re (* (atan2 x.im x.re) (- y.im))))
(cos (fma t_0 y.im t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_re, x_46_im));
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double t_2 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_3 = exp(((y_46_re * t_2) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if ((cos((t_1 + (t_2 * y_46_im))) * t_3) <= -0.5) {
tmp = fabs(cos(fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_1))) * t_3;
} else {
tmp = exp(fma(t_0, y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos(fma(t_0, y_46_im, t_1));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_2 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_3 = exp(Float64(Float64(y_46_re * t_2) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (Float64(cos(Float64(t_1 + Float64(t_2 * y_46_im))) * t_3) <= -0.5) tmp = Float64(abs(cos(fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_1))) * t_3); else tmp = Float64(exp(fma(t_0, y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cos(fma(t_0, y_46_im, t_1))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 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[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Exp[N[(N[(y$46$re * t$95$2), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(t$95$1 + N[(t$95$2 * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$3), $MachinePrecision], -0.5], N[(N[Abs[N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * t$95$3), $MachinePrecision], 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[(t$95$0 * y$46$im + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_3 := e^{y.re \cdot t_2 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;\cos \left(t_1 + t_2 \cdot y.im\right) \cdot t_3 \leq -0.5:\\
\;\;\;\;\left|\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), t_1\right)\right)\right| \cdot t_3\\
\mathbf{else}:\\
\;\;\;\;e^{\mathsf{fma}\left(t_0, y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \cdot \cos \left(\mathsf{fma}\left(t_0, y.im, t_1\right)\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < -0.5Initial program 28.6%
fma-def28.6%
hypot-udef28.6%
*-commutative28.6%
add-sqr-sqrt0.0%
sqrt-unprod68.5%
pow268.5%
fma-udef68.5%
*-commutative68.5%
*-commutative68.5%
fma-def68.5%
Applied egg-rr68.5%
unpow268.5%
rem-sqrt-square68.5%
*-commutative68.5%
hypot-def68.5%
unpow268.5%
unpow268.5%
+-commutative68.5%
fma-def68.5%
fma-def68.5%
unpow268.5%
unpow268.5%
hypot-def68.5%
Simplified68.5%
if -0.5 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) Initial program 38.2%
fma-neg38.2%
hypot-def38.2%
distribute-rgt-neg-out38.2%
fma-def38.2%
hypot-def80.6%
*-commutative80.6%
Simplified80.6%
Final simplification79.3%
(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 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_3 (exp (- (* y.re t_2) (* (atan2 x.im x.re) y.im)))))
(if (<= (* (cos (+ t_0 (* t_2 y.im))) t_3) -0.5)
t_3
(*
(exp (fma t_1 y.re (* (atan2 x.im x.re) (- y.im))))
(cos (fma t_1 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 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = log(hypot(x_46_re, x_46_im));
double t_2 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_3 = exp(((y_46_re * t_2) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if ((cos((t_0 + (t_2 * y_46_im))) * t_3) <= -0.5) {
tmp = t_3;
} else {
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));
}
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 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_3 = exp(Float64(Float64(y_46_re * t_2) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (Float64(cos(Float64(t_0 + Float64(t_2 * y_46_im))) * t_3) <= -0.5) tmp = t_3; else 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))); 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[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Exp[N[(N[(y$46$re * t$95$2), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(t$95$0 + N[(t$95$2 * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$3), $MachinePrecision], -0.5], t$95$3, 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]]]]]]
\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 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_3 := e^{y.re \cdot t_2 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;\cos \left(t_0 + t_2 \cdot y.im\right) \cdot t_3 \leq -0.5:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;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)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < -0.5Initial program 28.6%
fma-def28.6%
hypot-udef28.6%
*-commutative28.6%
add-sqr-sqrt0.0%
sqrt-unprod68.5%
pow268.5%
fma-udef68.5%
*-commutative68.5%
*-commutative68.5%
fma-def68.5%
Applied egg-rr68.5%
unpow268.5%
rem-sqrt-square68.5%
*-commutative68.5%
hypot-def68.5%
unpow268.5%
unpow268.5%
+-commutative68.5%
fma-def68.5%
fma-def68.5%
unpow268.5%
unpow268.5%
hypot-def68.5%
Simplified68.5%
Taylor expanded in y.im around 0 68.5%
Taylor expanded in y.re around 0 68.5%
if -0.5 < (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) Initial program 38.2%
fma-neg38.2%
hypot-def38.2%
distribute-rgt-neg-out38.2%
fma-def38.2%
hypot-def80.6%
*-commutative80.6%
Simplified80.6%
Final simplification79.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im)))
(t_1 (* y.re (atan2 x.im x.re)))
(t_2
(*
(exp (fma t_0 y.re (* (atan2 x.im x.re) (- y.im))))
(cos (- t_1 (* y.im (log (/ -1.0 x.im)))))))
(t_3 (* (atan2 x.im x.re) y.im))
(t_4 (exp (- (* y.re (log x.im)) t_3))))
(if (<= x.im -1e+107)
t_2
(if (<= x.im -1.4e-190)
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_3))
(if (<= x.im -2e-308)
t_2
(if (<= x.im 2.3e-43)
(*
(/ (pow (hypot x.re x.im) y.re) (pow (exp y.im) (atan2 x.im x.re)))
(cos (+ t_1 (* y.im (log x.im)))))
(if (<= x.im 4e+127)
(* t_4 (cos (+ t_1 (pow (cbrt (* y.im t_0)) 3.0))))
(* (fabs (cos t_1)) 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_re, x_46_im));
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double t_2 = exp(fma(t_0, y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos((t_1 - (y_46_im * log((-1.0 / x_46_im)))));
double t_3 = atan2(x_46_im, x_46_re) * y_46_im;
double t_4 = exp(((y_46_re * log(x_46_im)) - t_3));
double tmp;
if (x_46_im <= -1e+107) {
tmp = t_2;
} else if (x_46_im <= -1.4e-190) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_3));
} else if (x_46_im <= -2e-308) {
tmp = t_2;
} else if (x_46_im <= 2.3e-43) {
tmp = (pow(hypot(x_46_re, x_46_im), y_46_re) / pow(exp(y_46_im), atan2(x_46_im, x_46_re))) * cos((t_1 + (y_46_im * log(x_46_im))));
} else if (x_46_im <= 4e+127) {
tmp = t_4 * cos((t_1 + pow(cbrt((y_46_im * t_0)), 3.0)));
} else {
tmp = fabs(cos(t_1)) * t_4;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_2 = Float64(exp(fma(t_0, y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cos(Float64(t_1 - Float64(y_46_im * log(Float64(-1.0 / x_46_im)))))) t_3 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_4 = exp(Float64(Float64(y_46_re * log(x_46_im)) - t_3)) tmp = 0.0 if (x_46_im <= -1e+107) tmp = t_2; elseif (x_46_im <= -1.4e-190) 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_3)); elseif (x_46_im <= -2e-308) tmp = t_2; elseif (x_46_im <= 2.3e-43) tmp = Float64(Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan(x_46_im, x_46_re))) * cos(Float64(t_1 + Float64(y_46_im * log(x_46_im))))); elseif (x_46_im <= 4e+127) tmp = Float64(t_4 * cos(Float64(t_1 + (cbrt(Float64(y_46_im * t_0)) ^ 3.0)))); else tmp = Float64(abs(cos(t_1)) * 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$re ^ 2 + x$46$im ^ 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[(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[(t$95$1 - N[(y$46$im * N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $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[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -1e+107], t$95$2, If[LessEqual[x$46$im, -1.4e-190], 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$im, -2e-308], t$95$2, If[LessEqual[x$46$im, 2.3e-43], N[(N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(t$95$1 + N[(y$46$im * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 4e+127], N[(t$95$4 * N[Cos[N[(t$95$1 + N[Power[N[Power[N[(y$46$im * t$95$0), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[Cos[t$95$1], $MachinePrecision]], $MachinePrecision] * t$95$4), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := e^{\mathsf{fma}\left(t_0, y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)} \cdot \cos \left(t_1 - y.im \cdot \log \left(\frac{-1}{x.im}\right)\right)\\
t_3 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_4 := e^{y.re \cdot \log x.im - t_3}\\
\mathbf{if}\;x.im \leq -1 \cdot 10^{+107}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x.im \leq -1.4 \cdot 10^{-190}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_3}\\
\mathbf{elif}\;x.im \leq -2 \cdot 10^{-308}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x.im \leq 2.3 \cdot 10^{-43}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(t_1 + y.im \cdot \log x.im\right)\\
\mathbf{elif}\;x.im \leq 4 \cdot 10^{+127}:\\
\;\;\;\;t_4 \cdot \cos \left(t_1 + {\left(\sqrt[3]{y.im \cdot t_0}\right)}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\cos t_1\right| \cdot t_4\\
\end{array}
\end{array}
if x.im < -9.9999999999999997e106 or -1.40000000000000003e-190 < x.im < -1.9999999999999998e-308Initial program 26.2%
fma-neg26.2%
hypot-def26.2%
distribute-rgt-neg-out26.2%
fma-def26.2%
hypot-def84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in x.im around -inf 84.9%
+-commutative84.9%
mul-1-neg84.9%
unsub-neg84.9%
Simplified84.9%
if -9.9999999999999997e106 < x.im < -1.40000000000000003e-190Initial program 49.3%
fma-def49.3%
hypot-udef62.9%
*-commutative62.9%
add-sqr-sqrt51.0%
sqrt-unprod76.4%
pow276.4%
fma-udef76.4%
*-commutative76.4%
*-commutative76.4%
fma-def76.4%
Applied egg-rr76.4%
unpow276.4%
rem-sqrt-square76.4%
*-commutative76.4%
hypot-def62.7%
unpow262.7%
unpow262.7%
+-commutative62.7%
fma-def62.7%
fma-def62.7%
unpow262.7%
unpow262.7%
hypot-def76.4%
Simplified76.4%
Taylor expanded in y.im around 0 76.4%
Taylor expanded in y.re around 0 76.4%
if -1.9999999999999998e-308 < x.im < 2.2999999999999999e-43Initial program 44.9%
exp-diff43.1%
exp-to-pow43.2%
hypot-def43.2%
*-commutative43.2%
exp-prod43.0%
fma-def43.0%
hypot-def66.8%
*-commutative66.8%
Simplified66.8%
Taylor expanded in x.re around 0 74.4%
if 2.2999999999999999e-43 < x.im < 3.99999999999999982e127Initial program 50.0%
add-cube-cbrt58.8%
pow361.8%
*-commutative61.8%
hypot-udef73.9%
Applied egg-rr73.9%
Taylor expanded in x.re around 0 85.3%
if 3.99999999999999982e127 < x.im Initial program 8.8%
fma-def8.8%
hypot-udef33.6%
*-commutative33.6%
add-sqr-sqrt15.9%
sqrt-unprod48.3%
pow248.3%
fma-udef48.3%
*-commutative48.3%
*-commutative48.3%
fma-def48.3%
Applied egg-rr48.3%
unpow248.3%
rem-sqrt-square48.3%
*-commutative48.3%
hypot-def11.8%
unpow211.8%
unpow211.8%
+-commutative11.8%
fma-def11.8%
fma-def11.8%
unpow211.8%
unpow211.8%
hypot-def48.3%
Simplified48.3%
Taylor expanded in y.im around 0 48.3%
Taylor expanded in x.re around 0 90.3%
Final simplification81.1%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1
(*
(exp
(fma (log (hypot x.re x.im)) y.re (* (atan2 x.im x.re) (- y.im))))
(cos (- t_0 (* y.im (log (/ -1.0 x.im)))))))
(t_2 (* (atan2 x.im x.re) y.im)))
(if (<= x.im -1.5e+110)
t_1
(if (<= x.im -1.45e-190)
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_2))
(if (<= x.im -2e-308)
t_1
(if (<= x.im 9.2e+111)
(*
(/ (pow (hypot x.re x.im) y.re) (pow (exp y.im) (atan2 x.im x.re)))
(cos (+ t_0 (* y.im (log x.im)))))
(* (fabs (cos t_0)) (exp (- (* y.re (log x.im)) 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 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im))) * cos((t_0 - (y_46_im * log((-1.0 / x_46_im)))));
double t_2 = atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_im <= -1.5e+110) {
tmp = t_1;
} else if (x_46_im <= -1.45e-190) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_2));
} else if (x_46_im <= -2e-308) {
tmp = t_1;
} else if (x_46_im <= 9.2e+111) {
tmp = (pow(hypot(x_46_re, x_46_im), y_46_re) / pow(exp(y_46_im), atan2(x_46_im, x_46_re))) * cos((t_0 + (y_46_im * log(x_46_im))));
} else {
tmp = fabs(cos(t_0)) * exp(((y_46_re * log(x_46_im)) - 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 = Float64(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)))) * cos(Float64(t_0 - Float64(y_46_im * log(Float64(-1.0 / x_46_im)))))) t_2 = Float64(atan(x_46_im, x_46_re) * y_46_im) tmp = 0.0 if (x_46_im <= -1.5e+110) tmp = t_1; elseif (x_46_im <= -1.45e-190) 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)); elseif (x_46_im <= -2e-308) tmp = t_1; elseif (x_46_im <= 9.2e+111) tmp = Float64(Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / (exp(y_46_im) ^ atan(x_46_im, x_46_re))) * cos(Float64(t_0 + Float64(y_46_im * log(x_46_im))))); else tmp = Float64(abs(cos(t_0)) * exp(Float64(Float64(y_46_re * log(x_46_im)) - 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[(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] * N[Cos[N[(t$95$0 - N[(y$46$im * N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, If[LessEqual[x$46$im, -1.5e+110], t$95$1, If[LessEqual[x$46$im, -1.45e-190], 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], If[LessEqual[x$46$im, -2e-308], t$95$1, If[LessEqual[x$46$im, 9.2e+111], N[(N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[Power[N[Exp[y$46$im], $MachinePrecision], N[ArcTan[x$46$im / x$46$re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(t$95$0 + N[(y$46$im * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Abs[N[Cos[t$95$0], $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $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 := 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)} \cdot \cos \left(t_0 - y.im \cdot \log \left(\frac{-1}{x.im}\right)\right)\\
t_2 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.im \leq -1.5 \cdot 10^{+110}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x.im \leq -1.45 \cdot 10^{-190}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_2}\\
\mathbf{elif}\;x.im \leq -2 \cdot 10^{-308}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x.im \leq 9.2 \cdot 10^{+111}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left(t_0 + y.im \cdot \log x.im\right)\\
\mathbf{else}:\\
\;\;\;\;\left|\cos t_0\right| \cdot e^{y.re \cdot \log x.im - t_2}\\
\end{array}
\end{array}
if x.im < -1.50000000000000004e110 or -1.4500000000000001e-190 < x.im < -1.9999999999999998e-308Initial program 26.2%
fma-neg26.2%
hypot-def26.2%
distribute-rgt-neg-out26.2%
fma-def26.2%
hypot-def84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in x.im around -inf 84.9%
+-commutative84.9%
mul-1-neg84.9%
unsub-neg84.9%
Simplified84.9%
if -1.50000000000000004e110 < x.im < -1.4500000000000001e-190Initial program 49.3%
fma-def49.3%
hypot-udef62.9%
*-commutative62.9%
add-sqr-sqrt51.0%
sqrt-unprod76.4%
pow276.4%
fma-udef76.4%
*-commutative76.4%
*-commutative76.4%
fma-def76.4%
Applied egg-rr76.4%
unpow276.4%
rem-sqrt-square76.4%
*-commutative76.4%
hypot-def62.7%
unpow262.7%
unpow262.7%
+-commutative62.7%
fma-def62.7%
fma-def62.7%
unpow262.7%
unpow262.7%
hypot-def76.4%
Simplified76.4%
Taylor expanded in y.im around 0 76.4%
Taylor expanded in y.re around 0 76.4%
if -1.9999999999999998e-308 < x.im < 9.20000000000000008e111Initial program 47.2%
exp-diff42.4%
exp-to-pow42.4%
hypot-def42.4%
*-commutative42.4%
exp-prod42.2%
fma-def42.2%
hypot-def66.8%
*-commutative66.8%
Simplified66.8%
Taylor expanded in x.re around 0 74.3%
if 9.20000000000000008e111 < x.im Initial program 14.6%
fma-def14.6%
hypot-udef35.3%
*-commutative35.3%
add-sqr-sqrt18.1%
sqrt-unprod49.9%
pow249.9%
fma-udef49.9%
*-commutative49.9%
*-commutative49.9%
fma-def49.9%
Applied egg-rr49.9%
unpow249.9%
rem-sqrt-square49.9%
*-commutative49.9%
hypot-def19.5%
unpow219.5%
unpow219.5%
+-commutative19.5%
fma-def19.5%
fma-def19.5%
unpow219.5%
unpow219.5%
hypot-def49.9%
Simplified49.9%
Taylor expanded in y.im around 0 49.9%
Taylor expanded in x.re around 0 87.1%
Final simplification79.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im))))
(t_1 (* y.re (atan2 x.im x.re))))
(if (<= y.im -17500000000.0)
t_0
(if (<= y.im 1.2e+15)
(fabs
(*
(cos (fma y.im (log (hypot x.im x.re)) t_1))
(pow (hypot x.im x.re) y.re)))
(* t_0 (cos t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = 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 t_1 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_im <= -17500000000.0) {
tmp = t_0;
} else if (y_46_im <= 1.2e+15) {
tmp = fabs((cos(fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_1)) * pow(hypot(x_46_im, x_46_re), y_46_re)));
} else {
tmp = t_0 * cos(t_1);
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = 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))) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_im <= -17500000000.0) tmp = t_0; elseif (y_46_im <= 1.2e+15) tmp = abs(Float64(cos(fma(y_46_im, log(hypot(x_46_im, x_46_re)), t_1)) * (hypot(x_46_im, x_46_re) ^ y_46_re))); else tmp = Float64(t_0 * cos(t_1)); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Exp[N[(N[(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]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -17500000000.0], t$95$0, If[LessEqual[y$46$im, 1.2e+15], N[Abs[N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(t$95$0 * N[Cos[t$95$1], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 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}\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.im \leq -17500000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y.im \leq 1.2 \cdot 10^{+15}:\\
\;\;\;\;\left|\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), t_1\right)\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\right|\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \cos t_1\\
\end{array}
\end{array}
if y.im < -1.75e10Initial program 28.0%
fma-def28.0%
hypot-udef54.6%
*-commutative54.6%
add-sqr-sqrt22.6%
sqrt-unprod65.7%
pow265.7%
fma-udef65.7%
*-commutative65.7%
*-commutative65.7%
fma-def65.7%
Applied egg-rr65.7%
unpow265.7%
rem-sqrt-square65.7%
*-commutative65.7%
hypot-def34.9%
unpow234.9%
unpow234.9%
+-commutative34.9%
fma-def34.9%
fma-def34.9%
unpow234.9%
unpow234.9%
hypot-def65.7%
Simplified65.7%
Taylor expanded in y.im around 0 65.7%
Taylor expanded in y.re around 0 65.7%
if -1.75e10 < y.im < 1.2e15Initial program 45.7%
exp-diff45.7%
exp-to-pow45.7%
hypot-def45.7%
*-commutative45.7%
exp-prod45.7%
fma-def45.7%
hypot-def91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in y.im around 0 90.7%
add-sqr-sqrt86.0%
sqrt-unprod92.2%
pow292.2%
Applied egg-rr92.2%
unpow292.2%
rem-sqrt-square92.2%
*-commutative92.2%
fma-udef92.2%
*-commutative92.2%
fma-udef92.2%
Simplified92.2%
if 1.2e15 < y.im Initial program 29.1%
Taylor expanded in y.im around 0 55.3%
Final simplification76.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))))
(if (<= y.im -94000000000.0)
t_0
(if (<= y.im 1.2e+15)
(*
(pow (hypot x.re x.im) y.re)
(cos (pow (cbrt (* y.im (log (hypot x.im x.re)))) 3.0)))
(* t_0 (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) {
double t_0 = 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_im <= -94000000000.0) {
tmp = t_0;
} else if (y_46_im <= 1.2e+15) {
tmp = pow(hypot(x_46_re, x_46_im), y_46_re) * cos(pow(cbrt((y_46_im * log(hypot(x_46_im, x_46_re)))), 3.0));
} else {
tmp = t_0 * cos((y_46_re * atan2(x_46_im, x_46_re)));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = 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)));
double tmp;
if (y_46_im <= -94000000000.0) {
tmp = t_0;
} else if (y_46_im <= 1.2e+15) {
tmp = Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re) * Math.cos(Math.pow(Math.cbrt((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))), 3.0));
} else {
tmp = t_0 * Math.cos((y_46_re * Math.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 = 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_im <= -94000000000.0) tmp = t_0; elseif (y_46_im <= 1.2e+15) tmp = Float64((hypot(x_46_re, x_46_im) ^ y_46_re) * cos((cbrt(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) ^ 3.0))); else tmp = Float64(t_0 * cos(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[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$im, -94000000000.0], t$95$0, If[LessEqual[y$46$im, 1.2e+15], N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[Cos[N[Power[N[Power[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 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.im \leq -94000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y.im \leq 1.2 \cdot 10^{+15}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \cos \left({\left(\sqrt[3]{y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}\right)}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\end{array}
\end{array}
if y.im < -9.4e10Initial program 28.0%
fma-def28.0%
hypot-udef54.6%
*-commutative54.6%
add-sqr-sqrt22.6%
sqrt-unprod65.7%
pow265.7%
fma-udef65.7%
*-commutative65.7%
*-commutative65.7%
fma-def65.7%
Applied egg-rr65.7%
unpow265.7%
rem-sqrt-square65.7%
*-commutative65.7%
hypot-def34.9%
unpow234.9%
unpow234.9%
+-commutative34.9%
fma-def34.9%
fma-def34.9%
unpow234.9%
unpow234.9%
hypot-def65.7%
Simplified65.7%
Taylor expanded in y.im around 0 65.7%
Taylor expanded in y.re around 0 65.7%
if -9.4e10 < y.im < 1.2e15Initial program 45.7%
exp-diff45.7%
exp-to-pow45.7%
hypot-def45.7%
*-commutative45.7%
exp-prod45.7%
fma-def45.7%
hypot-def91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in y.im around 0 90.7%
add-cube-cbrt90.7%
pow390.7%
fma-udef90.7%
*-commutative90.7%
*-commutative90.7%
fma-def90.7%
Applied egg-rr89.9%
Taylor expanded in y.re around 0 23.5%
unpow1/343.7%
*-commutative43.7%
+-commutative43.7%
unpow243.7%
unpow243.7%
hypot-def91.7%
hypot-def43.7%
unpow243.7%
unpow243.7%
+-commutative43.7%
unpow243.7%
unpow243.7%
hypot-def91.7%
Simplified91.7%
if 1.2e15 < y.im Initial program 29.1%
Taylor expanded in y.im around 0 55.3%
Final simplification76.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))))
(if (<= y.im -6100000000000.0)
t_0
(if (<= y.im 7.2e+14)
(* (cos (* y.im (log (hypot x.im x.re)))) (pow (hypot x.re x.im) y.re))
(* t_0 (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) {
double t_0 = 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_im <= -6100000000000.0) {
tmp = t_0;
} else if (y_46_im <= 7.2e+14) {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * pow(hypot(x_46_re, x_46_im), y_46_re);
} else {
tmp = t_0 * cos((y_46_re * atan2(x_46_im, x_46_re)));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = 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)));
double tmp;
if (y_46_im <= -6100000000000.0) {
tmp = t_0;
} else if (y_46_im <= 7.2e+14) {
tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) * Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re);
} else {
tmp = t_0 * Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = 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))) tmp = 0 if y_46_im <= -6100000000000.0: tmp = t_0 elif y_46_im <= 7.2e+14: tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) * math.pow(math.hypot(x_46_re, x_46_im), y_46_re) else: tmp = t_0 * math.cos((y_46_re * math.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 = 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_im <= -6100000000000.0) tmp = t_0; elseif (y_46_im <= 7.2e+14) tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * (hypot(x_46_re, x_46_im) ^ y_46_re)); else tmp = Float64(t_0 * cos(Float64(y_46_re * atan(x_46_im, x_46_re)))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = 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))); tmp = 0.0; if (y_46_im <= -6100000000000.0) tmp = t_0; elseif (y_46_im <= 7.2e+14) tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * (hypot(x_46_re, x_46_im) ^ y_46_re); else tmp = t_0 * cos((y_46_re * atan2(x_46_im, x_46_re))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = 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$im, -6100000000000.0], t$95$0, If[LessEqual[y$46$im, 7.2e+14], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 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.im \leq -6100000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y.im \leq 7.2 \cdot 10^{+14}:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\end{array}
\end{array}
if y.im < -6.1e12Initial program 28.0%
fma-def28.0%
hypot-udef54.6%
*-commutative54.6%
add-sqr-sqrt22.6%
sqrt-unprod65.7%
pow265.7%
fma-udef65.7%
*-commutative65.7%
*-commutative65.7%
fma-def65.7%
Applied egg-rr65.7%
unpow265.7%
rem-sqrt-square65.7%
*-commutative65.7%
hypot-def34.9%
unpow234.9%
unpow234.9%
+-commutative34.9%
fma-def34.9%
fma-def34.9%
unpow234.9%
unpow234.9%
hypot-def65.7%
Simplified65.7%
Taylor expanded in y.im around 0 65.7%
Taylor expanded in y.re around 0 65.7%
if -6.1e12 < y.im < 7.2e14Initial program 45.7%
exp-diff45.7%
exp-to-pow45.7%
hypot-def45.7%
*-commutative45.7%
exp-prod45.7%
fma-def45.7%
hypot-def91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in y.im around 0 90.7%
add-cube-cbrt90.7%
pow390.7%
fma-udef90.7%
*-commutative90.7%
*-commutative90.7%
fma-def90.7%
Applied egg-rr89.9%
Taylor expanded in y.re around 0 43.7%
pow-base-143.7%
*-lft-identity43.7%
*-commutative43.7%
+-commutative43.7%
unpow243.7%
unpow243.7%
hypot-def91.7%
hypot-def43.7%
unpow243.7%
unpow243.7%
+-commutative43.7%
unpow243.7%
unpow243.7%
hypot-def91.7%
Simplified91.7%
if 7.2e14 < y.im Initial program 29.1%
Taylor expanded in y.im around 0 55.3%
Final simplification76.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (or (<= y.im -55000000000000.0) (not (<= y.im 6.6e+15)))
(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)))) (pow (hypot x.re x.im) y.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -55000000000000.0) || !(y_46_im <= 6.6e+15)) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im)));
} else {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * pow(hypot(x_46_re, x_46_im), y_46_re);
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_im <= -55000000000000.0) || !(y_46_im <= 6.6e+15)) {
tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
} else {
tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) * Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_im <= -55000000000000.0) or not (y_46_im <= 6.6e+15): tmp = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (math.atan2(x_46_im, x_46_re) * y_46_im))) else: tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) * math.pow(math.hypot(x_46_re, x_46_im), y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_im <= -55000000000000.0) || !(y_46_im <= 6.6e+15)) tmp = exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - Float64(atan(x_46_im, x_46_re) * y_46_im))); else tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * (hypot(x_46_re, x_46_im) ^ y_46_re)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_im <= -55000000000000.0) || ~((y_46_im <= 6.6e+15))) tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im))); else tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * (hypot(x_46_re, x_46_im) ^ y_46_re); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -55000000000000.0], N[Not[LessEqual[y$46$im, 6.6e+15]], $MachinePrecision]], N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.im \leq -55000000000000 \lor \neg \left(y.im \leq 6.6 \cdot 10^{+15}\right):\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.im < -5.5e13 or 6.6e15 < y.im Initial program 28.5%
fma-def28.5%
hypot-udef49.3%
*-commutative49.3%
add-sqr-sqrt22.4%
sqrt-unprod60.4%
pow260.4%
fma-udef60.4%
*-commutative60.4%
*-commutative60.4%
fma-def60.4%
Applied egg-rr60.4%
unpow260.4%
rem-sqrt-square60.4%
*-commutative60.4%
hypot-def38.9%
unpow238.9%
unpow238.9%
+-commutative38.9%
fma-def38.9%
fma-def38.9%
unpow238.9%
unpow238.9%
hypot-def60.4%
Simplified60.4%
Taylor expanded in y.im around 0 60.4%
Taylor expanded in y.re around 0 60.4%
if -5.5e13 < y.im < 6.6e15Initial program 45.7%
exp-diff45.7%
exp-to-pow45.7%
hypot-def45.7%
*-commutative45.7%
exp-prod45.7%
fma-def45.7%
hypot-def91.5%
*-commutative91.5%
Simplified91.5%
Taylor expanded in y.im around 0 90.7%
add-cube-cbrt90.7%
pow390.7%
fma-udef90.7%
*-commutative90.7%
*-commutative90.7%
fma-def90.7%
Applied egg-rr89.9%
Taylor expanded in y.re around 0 43.7%
pow-base-143.7%
*-lft-identity43.7%
*-commutative43.7%
+-commutative43.7%
unpow243.7%
unpow243.7%
hypot-def91.7%
hypot-def43.7%
unpow243.7%
unpow243.7%
+-commutative43.7%
unpow243.7%
unpow243.7%
hypot-def91.7%
Simplified91.7%
Final simplification76.2%
(FPCore (x.re x.im y.re y.im) :precision binary64 (let* ((t_0 (pow (hypot x.im x.re) y.re))) (if (<= y.im -5e-291) t_0 (* (cos (* y.re (atan2 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 tmp;
if (y_46_im <= -5e-291) {
tmp = t_0;
} else {
tmp = cos((y_46_re * atan2(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 tmp;
if (y_46_im <= -5e-291) {
tmp = t_0;
} else {
tmp = Math.cos((y_46_re * Math.atan2(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) tmp = 0 if y_46_im <= -5e-291: tmp = t_0 else: tmp = math.cos((y_46_re * math.atan2(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 tmp = 0.0 if (y_46_im <= -5e-291) tmp = t_0; else tmp = Float64(cos(Float64(y_46_re * atan(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; tmp = 0.0; if (y_46_im <= -5e-291) tmp = t_0; else tmp = cos((y_46_re * atan2(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]}, If[LessEqual[y$46$im, -5e-291], t$95$0, N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $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}\\
\mathbf{if}\;y.im \leq -5 \cdot 10^{-291}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot t_0\\
\end{array}
\end{array}
if y.im < -5.0000000000000003e-291Initial program 34.2%
exp-diff28.0%
exp-to-pow28.0%
hypot-def28.0%
*-commutative28.0%
exp-prod27.9%
fma-def27.9%
hypot-def64.4%
*-commutative64.4%
Simplified64.4%
Taylor expanded in y.im around 0 53.5%
Taylor expanded in y.im around 0 52.0%
unpow252.0%
unpow252.0%
hypot-def53.6%
Simplified53.6%
Taylor expanded in y.re around 0 59.8%
if -5.0000000000000003e-291 < y.im Initial program 40.2%
exp-diff38.6%
exp-to-pow38.6%
hypot-def38.6%
*-commutative38.6%
exp-prod38.6%
fma-def38.6%
hypot-def73.7%
*-commutative73.7%
Simplified73.7%
Taylor expanded in y.im around 0 61.6%
Taylor expanded in y.im around 0 49.3%
unpow249.3%
unpow249.3%
hypot-def64.6%
Simplified64.6%
Final simplification62.2%
(FPCore (x.re x.im y.re y.im) :precision binary64 (pow (hypot x.im x.re) y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return pow(hypot(x_46_im, x_46_re), y_46_re);
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.pow(math.hypot(x_46_im, x_46_re), y_46_re)
function code(x_46_re, x_46_im, y_46_re, y_46_im) return hypot(x_46_im, x_46_re) ^ y_46_re end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]
\begin{array}{l}
\\
{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}
\end{array}
Initial program 37.2%
exp-diff33.3%
exp-to-pow33.3%
hypot-def33.3%
*-commutative33.3%
exp-prod33.2%
fma-def33.2%
hypot-def69.0%
*-commutative69.0%
Simplified69.0%
Taylor expanded in y.im around 0 57.5%
Taylor expanded in y.im around 0 50.7%
unpow250.7%
unpow250.7%
hypot-def59.1%
Simplified59.1%
Taylor expanded in y.re around 0 60.0%
Final simplification60.0%
herbie shell --seed 2023320
(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)))))