
(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 14 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 (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_2 (* (atan2 x.im x.re) y.im))
(t_3 (exp (- (* t_1 y.re) t_2)))
(t_4 (log (hypot x.re x.im)))
(t_5 (cbrt (* y.im t_4))))
(if (<= (* t_3 (cos (+ (* t_1 y.im) t_0))) INFINITY)
(* t_3 (cos (+ t_0 (pow (* (cbrt t_5) (cbrt (pow t_5 2.0))) 3.0))))
(* (exp (- (* y.re t_4) t_2)) (cos (fma t_4 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 = atan2(x_46_im, x_46_re) * y_46_im;
double t_3 = exp(((t_1 * y_46_re) - t_2));
double t_4 = log(hypot(x_46_re, x_46_im));
double t_5 = cbrt((y_46_im * t_4));
double tmp;
if ((t_3 * cos(((t_1 * y_46_im) + t_0))) <= ((double) INFINITY)) {
tmp = t_3 * cos((t_0 + pow((cbrt(t_5) * cbrt(pow(t_5, 2.0))), 3.0)));
} else {
tmp = exp(((y_46_re * t_4) - t_2)) * cos(fma(t_4, 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 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_3 = exp(Float64(Float64(t_1 * y_46_re) - t_2)) t_4 = log(hypot(x_46_re, x_46_im)) t_5 = cbrt(Float64(y_46_im * t_4)) tmp = 0.0 if (Float64(t_3 * cos(Float64(Float64(t_1 * y_46_im) + t_0))) <= Inf) tmp = Float64(t_3 * cos(Float64(t_0 + (Float64(cbrt(t_5) * cbrt((t_5 ^ 2.0))) ^ 3.0)))); else tmp = Float64(exp(Float64(Float64(y_46_re * t_4) - t_2)) * cos(fma(t_4, 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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$3 = N[Exp[N[(N[(t$95$1 * y$46$re), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[Power[N[(y$46$im * t$95$4), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[N[(t$95$3 * N[Cos[N[(N[(t$95$1 * y$46$im), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$3 * N[Cos[N[(t$95$0 + N[Power[N[(N[Power[t$95$5, 1/3], $MachinePrecision] * N[Power[N[Power[t$95$5, 2.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * t$95$4), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$4 * 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 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_3 := e^{t_1 \cdot y.re - t_2}\\
t_4 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_5 := \sqrt[3]{y.im \cdot t_4}\\
\mathbf{if}\;t_3 \cdot \cos \left(t_1 \cdot y.im + t_0\right) \leq \infty:\\
\;\;\;\;t_3 \cdot \cos \left(t_0 + {\left(\sqrt[3]{t_5} \cdot \sqrt[3]{{t_5}^{2}}\right)}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot t_4 - t_2} \cdot \cos \left(\mathsf{fma}\left(t_4, 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)))) < +inf.0Initial program 83.6%
add-cube-cbrt87.3%
pow385.9%
*-commutative85.9%
hypot-udef85.9%
Applied egg-rr85.9%
rem-cbrt-cube84.4%
pow1/345.5%
cube-mult45.5%
unpow-prod-down45.5%
pow1/383.1%
pow283.1%
Applied egg-rr83.1%
unpow1/387.1%
Simplified87.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%
Simplified78.2%
Final simplification82.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (log (hypot x.re x.im)))
(t_2 (* y.re (atan2 x.im x.re)))
(t_3 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_4 (exp (- (* t_3 y.re) t_0))))
(if (<= (* t_4 (cos (+ (* t_3 y.im) t_2))) INFINITY)
(* t_4 (- (cos t_2) (* (* y.im (log (hypot x.im x.re))) (sin t_2))))
(* (exp (- (* y.re t_1) t_0)) (cos (fma t_1 y.im t_2))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = log(hypot(x_46_re, x_46_im));
double t_2 = y_46_re * atan2(x_46_im, x_46_re);
double t_3 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_4 = exp(((t_3 * y_46_re) - t_0));
double tmp;
if ((t_4 * cos(((t_3 * y_46_im) + t_2))) <= ((double) INFINITY)) {
tmp = t_4 * (cos(t_2) - ((y_46_im * log(hypot(x_46_im, x_46_re))) * sin(t_2)));
} else {
tmp = exp(((y_46_re * t_1) - t_0)) * cos(fma(t_1, y_46_im, t_2));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_1 = log(hypot(x_46_re, x_46_im)) t_2 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_3 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_4 = exp(Float64(Float64(t_3 * y_46_re) - t_0)) tmp = 0.0 if (Float64(t_4 * cos(Float64(Float64(t_3 * y_46_im) + t_2))) <= Inf) tmp = Float64(t_4 * Float64(cos(t_2) - Float64(Float64(y_46_im * log(hypot(x_46_im, x_46_re))) * sin(t_2)))); else tmp = Float64(exp(Float64(Float64(y_46_re * t_1) - t_0)) * cos(fma(t_1, y_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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $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]}, Block[{t$95$3 = 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$4 = N[Exp[N[(N[(t$95$3 * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$4 * N[Cos[N[(N[(t$95$3 * y$46$im), $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$4 * N[(N[Cos[t$95$2], $MachinePrecision] - N[(N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * t$95$1), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$1 * y$46$im + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
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}\\
t_3 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_4 := e^{t_3 \cdot y.re - t_0}\\
\mathbf{if}\;t_4 \cdot \cos \left(t_3 \cdot y.im + t_2\right) \leq \infty:\\
\;\;\;\;t_4 \cdot \left(\cos t_2 - \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot \sin t_2\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot t_1 - t_0} \cdot \cos \left(\mathsf{fma}\left(t_1, y.im, t_2\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)))) < +inf.0Initial program 83.6%
Taylor expanded in y.im around 0 86.0%
+-commutative86.0%
*-commutative86.0%
mul-1-neg86.0%
unsub-neg86.0%
*-commutative86.0%
*-commutative86.0%
unpow286.0%
unpow286.0%
hypot-def86.0%
Simplified86.0%
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%
Simplified78.2%
Final simplification82.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im)))
(t_1 (* (atan2 x.im x.re) y.im))
(t_2 (* y.re (atan2 x.im x.re)))
(t_3 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_4 (exp (- (* t_3 y.re) t_1))))
(if (<= (* t_4 (cos (+ (* t_3 y.im) t_2))) INFINITY)
(* t_4 (cos (+ t_2 (pow (cbrt (* y.im t_0)) 3.0))))
(* (exp (- (* y.re t_0) t_1)) (cos (fma t_0 y.im 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_re, x_46_im));
double t_1 = atan2(x_46_im, x_46_re) * y_46_im;
double t_2 = y_46_re * atan2(x_46_im, x_46_re);
double t_3 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_4 = exp(((t_3 * y_46_re) - t_1));
double tmp;
if ((t_4 * cos(((t_3 * y_46_im) + t_2))) <= ((double) INFINITY)) {
tmp = t_4 * cos((t_2 + pow(cbrt((y_46_im * t_0)), 3.0)));
} else {
tmp = exp(((y_46_re * t_0) - t_1)) * cos(fma(t_0, y_46_im, t_2));
}
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(atan(x_46_im, x_46_re) * y_46_im) t_2 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_3 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_4 = exp(Float64(Float64(t_3 * y_46_re) - t_1)) tmp = 0.0 if (Float64(t_4 * cos(Float64(Float64(t_3 * y_46_im) + t_2))) <= Inf) tmp = Float64(t_4 * cos(Float64(t_2 + (cbrt(Float64(y_46_im * t_0)) ^ 3.0)))); else tmp = Float64(exp(Float64(Float64(y_46_re * t_0) - t_1)) * cos(fma(t_0, y_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[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$2 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = 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$4 = N[Exp[N[(N[(t$95$3 * y$46$re), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$4 * N[Cos[N[(N[(t$95$3 * y$46$im), $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$4 * N[Cos[N[(t$95$2 + N[Power[N[Power[N[(y$46$im * t$95$0), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * t$95$0), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$0 * y$46$im + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_3 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_4 := e^{t_3 \cdot y.re - t_1}\\
\mathbf{if}\;t_4 \cdot \cos \left(t_3 \cdot y.im + t_2\right) \leq \infty:\\
\;\;\;\;t_4 \cdot \cos \left(t_2 + {\left(\sqrt[3]{y.im \cdot t_0}\right)}^{3}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot t_0 - t_1} \cdot \cos \left(\mathsf{fma}\left(t_0, y.im, t_2\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)))) < +inf.0Initial program 83.6%
add-cube-cbrt87.3%
pow385.9%
*-commutative85.9%
hypot-udef85.9%
Applied egg-rr85.9%
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%
Simplified78.2%
Final simplification82.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (hypot x.re x.im))))
(*
(exp (- (* y.re t_0) (* (atan2 x.im x.re) y.im)))
(cos (fma t_0 y.im (* y.re (atan2 x.im x.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_re, x_46_im));
return exp(((y_46_re * t_0) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(fma(t_0, y_46_im, (y_46_re * atan2(x_46_im, x_46_re))));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_re, x_46_im)) return Float64(exp(Float64(Float64(y_46_re * t_0) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(fma(t_0, y_46_im, Float64(y_46_re * atan(x_46_im, x_46_re))))) 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]}, N[(N[Exp[N[(N[(y$46$re * t$95$0), $MachinePrecision] - 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 + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
e^{y.re \cdot t_0 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)
\end{array}
\end{array}
Initial program 44.1%
Simplified80.7%
Final simplification80.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (cos t_0))
(t_2 (* (atan2 x.im x.re) y.im)))
(if (<= x.re -5.2e-36)
(*
(exp (- (* y.re (log (- x.re))) t_2))
(cos (* y.im (log (hypot x.im x.re)))))
(if (<= x.re 2.8e-301)
(*
(exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) t_2))
t_1)
(if (<= x.re 5.7e+214)
(*
(exp (- (* y.re (log (hypot x.re x.im))) t_2))
(cos (+ t_0 (* y.im (log x.re)))))
(* t_1 (exp (- (* y.re (log x.re)) t_2))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = cos(t_0);
double t_2 = atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_re <= -5.2e-36) {
tmp = exp(((y_46_re * log(-x_46_re)) - t_2)) * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
} else if (x_46_re <= 2.8e-301) {
tmp = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_2)) * t_1;
} else if (x_46_re <= 5.7e+214) {
tmp = exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - t_2)) * cos((t_0 + (y_46_im * log(x_46_re))));
} else {
tmp = t_1 * exp(((y_46_re * log(x_46_re)) - t_2));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.cos(t_0);
double t_2 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_re <= -5.2e-36) {
tmp = Math.exp(((y_46_re * Math.log(-x_46_re)) - t_2)) * Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))));
} else if (x_46_re <= 2.8e-301) {
tmp = Math.exp(((Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_2)) * t_1;
} else if (x_46_re <= 5.7e+214) {
tmp = Math.exp(((y_46_re * Math.log(Math.hypot(x_46_re, x_46_im))) - t_2)) * Math.cos((t_0 + (y_46_im * Math.log(x_46_re))));
} else {
tmp = t_1 * Math.exp(((y_46_re * Math.log(x_46_re)) - t_2));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) t_1 = math.cos(t_0) t_2 = math.atan2(x_46_im, x_46_re) * y_46_im tmp = 0 if x_46_re <= -5.2e-36: tmp = math.exp(((y_46_re * math.log(-x_46_re)) - t_2)) * math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) elif x_46_re <= 2.8e-301: tmp = math.exp(((math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_2)) * t_1 elif x_46_re <= 5.7e+214: tmp = math.exp(((y_46_re * math.log(math.hypot(x_46_re, x_46_im))) - t_2)) * math.cos((t_0 + (y_46_im * math.log(x_46_re)))) else: tmp = t_1 * math.exp(((y_46_re * math.log(x_46_re)) - t_2)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = cos(t_0) t_2 = Float64(atan(x_46_im, x_46_re) * y_46_im) tmp = 0.0 if (x_46_re <= -5.2e-36) tmp = Float64(exp(Float64(Float64(y_46_re * log(Float64(-x_46_re))) - t_2)) * cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re))))); elseif (x_46_re <= 2.8e-301) tmp = Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - t_2)) * t_1); elseif (x_46_re <= 5.7e+214) tmp = Float64(exp(Float64(Float64(y_46_re * log(hypot(x_46_re, x_46_im))) - t_2)) * cos(Float64(t_0 + Float64(y_46_im * log(x_46_re))))); else tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(x_46_re)) - t_2))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); t_1 = cos(t_0); t_2 = atan2(x_46_im, x_46_re) * y_46_im; tmp = 0.0; if (x_46_re <= -5.2e-36) tmp = exp(((y_46_re * log(-x_46_re)) - t_2)) * cos((y_46_im * log(hypot(x_46_im, x_46_re)))); elseif (x_46_re <= 2.8e-301) tmp = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_2)) * t_1; elseif (x_46_re <= 5.7e+214) tmp = exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - t_2)) * cos((t_0 + (y_46_im * log(x_46_re)))); else tmp = t_1 * exp(((y_46_re * log(x_46_re)) - t_2)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, If[LessEqual[x$46$re, -5.2e-36], N[(N[Exp[N[(N[(y$46$re * N[Log[(-x$46$re)], $MachinePrecision]), $MachinePrecision] - t$95$2), $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], If[LessEqual[x$46$re, 2.8e-301], N[(N[Exp[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[x$46$re, 5.7e+214], N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$0 + N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \cos t_0\\
t_2 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.re \leq -5.2 \cdot 10^{-36}:\\
\;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - t_2} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{elif}\;x.re \leq 2.8 \cdot 10^{-301}:\\
\;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - t_2} \cdot t_1\\
\mathbf{elif}\;x.re \leq 5.7 \cdot 10^{+214}:\\
\;\;\;\;e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - t_2} \cdot \cos \left(t_0 + y.im \cdot \log x.re\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot e^{y.re \cdot \log x.re - t_2}\\
\end{array}
\end{array}
if x.re < -5.2000000000000001e-36Initial program 29.6%
Taylor expanded in y.re around 0 31.3%
unpow231.3%
unpow231.3%
hypot-def60.4%
Simplified60.4%
Taylor expanded in x.re around -inf 88.0%
mul-1-neg83.2%
Simplified88.0%
if -5.2000000000000001e-36 < x.re < 2.8000000000000001e-301Initial program 57.1%
Taylor expanded in y.im around 0 74.2%
if 2.8000000000000001e-301 < x.re < 5.69999999999999972e214Initial program 52.8%
Simplified80.8%
Taylor expanded in x.im around 0 81.6%
if 5.69999999999999972e214 < x.re Initial program 0.0%
Taylor expanded in y.im around 0 44.2%
Taylor expanded in x.re around inf 84.2%
Final simplification81.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (cos (* y.im (log (hypot x.im x.re)))))
(t_1 (* y.re (atan2 x.im x.re)))
(t_2 (* (atan2 x.im x.re) y.im)))
(if (<= x.re -2e-102)
(* (exp (- (* y.re (log (- x.re))) t_2)) t_0)
(if (<= x.re 7.2e-216)
(*
(exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) t_2))
t_0)
(if (<= x.re 1.22e+212)
(*
(exp (- (* y.re (log (hypot x.re x.im))) t_2))
(cos (+ t_1 (* y.im (log x.re)))))
(* (cos t_1) (exp (- (* y.re (log x.re)) t_2))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = cos((y_46_im * log(hypot(x_46_im, x_46_re))));
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double t_2 = atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_re <= -2e-102) {
tmp = exp(((y_46_re * log(-x_46_re)) - t_2)) * t_0;
} else if (x_46_re <= 7.2e-216) {
tmp = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_2)) * t_0;
} else if (x_46_re <= 1.22e+212) {
tmp = exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - t_2)) * cos((t_1 + (y_46_im * log(x_46_re))));
} else {
tmp = cos(t_1) * exp(((y_46_re * log(x_46_re)) - t_2));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))));
double t_1 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_2 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if (x_46_re <= -2e-102) {
tmp = Math.exp(((y_46_re * Math.log(-x_46_re)) - t_2)) * t_0;
} else if (x_46_re <= 7.2e-216) {
tmp = Math.exp(((Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_2)) * t_0;
} else if (x_46_re <= 1.22e+212) {
tmp = Math.exp(((y_46_re * Math.log(Math.hypot(x_46_re, x_46_im))) - t_2)) * Math.cos((t_1 + (y_46_im * Math.log(x_46_re))));
} else {
tmp = Math.cos(t_1) * Math.exp(((y_46_re * Math.log(x_46_re)) - t_2));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) t_1 = y_46_re * math.atan2(x_46_im, x_46_re) t_2 = math.atan2(x_46_im, x_46_re) * y_46_im tmp = 0 if x_46_re <= -2e-102: tmp = math.exp(((y_46_re * math.log(-x_46_re)) - t_2)) * t_0 elif x_46_re <= 7.2e-216: tmp = math.exp(((math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_2)) * t_0 elif x_46_re <= 1.22e+212: tmp = math.exp(((y_46_re * math.log(math.hypot(x_46_re, x_46_im))) - t_2)) * math.cos((t_1 + (y_46_im * math.log(x_46_re)))) else: tmp = math.cos(t_1) * math.exp(((y_46_re * math.log(x_46_re)) - t_2)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_2 = Float64(atan(x_46_im, x_46_re) * y_46_im) tmp = 0.0 if (x_46_re <= -2e-102) tmp = Float64(exp(Float64(Float64(y_46_re * log(Float64(-x_46_re))) - t_2)) * t_0); elseif (x_46_re <= 7.2e-216) tmp = Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - t_2)) * t_0); elseif (x_46_re <= 1.22e+212) tmp = Float64(exp(Float64(Float64(y_46_re * log(hypot(x_46_re, x_46_im))) - t_2)) * cos(Float64(t_1 + Float64(y_46_im * log(x_46_re))))); else tmp = Float64(cos(t_1) * exp(Float64(Float64(y_46_re * log(x_46_re)) - t_2))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos((y_46_im * log(hypot(x_46_im, x_46_re)))); t_1 = y_46_re * atan2(x_46_im, x_46_re); t_2 = atan2(x_46_im, x_46_re) * y_46_im; tmp = 0.0; if (x_46_re <= -2e-102) tmp = exp(((y_46_re * log(-x_46_re)) - t_2)) * t_0; elseif (x_46_re <= 7.2e-216) tmp = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_2)) * t_0; elseif (x_46_re <= 1.22e+212) tmp = exp(((y_46_re * log(hypot(x_46_re, x_46_im))) - t_2)) * cos((t_1 + (y_46_im * log(x_46_re)))); else tmp = cos(t_1) * exp(((y_46_re * log(x_46_re)) - t_2)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $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[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, If[LessEqual[x$46$re, -2e-102], N[(N[Exp[N[(N[(y$46$re * N[Log[(-x$46$re)], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[x$46$re, 7.2e-216], N[(N[Exp[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[x$46$re, 1.22e+212], N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$1 + N[(y$46$im * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[t$95$1], $MachinePrecision] * N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;x.re \leq -2 \cdot 10^{-102}:\\
\;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - t_2} \cdot t_0\\
\mathbf{elif}\;x.re \leq 7.2 \cdot 10^{-216}:\\
\;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - t_2} \cdot t_0\\
\mathbf{elif}\;x.re \leq 1.22 \cdot 10^{+212}:\\
\;\;\;\;e^{y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) - t_2} \cdot \cos \left(t_1 + y.im \cdot \log x.re\right)\\
\mathbf{else}:\\
\;\;\;\;\cos t_1 \cdot e^{y.re \cdot \log x.re - t_2}\\
\end{array}
\end{array}
if x.re < -1.99999999999999987e-102Initial program 33.5%
Taylor expanded in y.re around 0 34.8%
unpow234.8%
unpow234.8%
hypot-def59.9%
Simplified59.9%
Taylor expanded in x.re around -inf 83.5%
mul-1-neg80.0%
Simplified83.5%
if -1.99999999999999987e-102 < x.re < 7.1999999999999998e-216Initial program 53.6%
Taylor expanded in y.re around 0 52.2%
unpow252.2%
unpow252.2%
hypot-def81.4%
Simplified81.4%
if 7.1999999999999998e-216 < x.re < 1.22000000000000005e212Initial program 55.5%
Simplified78.8%
Taylor expanded in x.im around 0 82.0%
if 1.22000000000000005e212 < x.re Initial program 0.0%
Taylor expanded in y.im around 0 44.2%
Taylor expanded in x.re around inf 84.2%
Final simplification82.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im)))
(if (or (<= y.re -7.5e-30) (not (<= y.re 1.7e-21)))
(*
(exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) t_0))
(cos (* y.re (atan2 x.im x.re))))
(*
(exp (- t_0))
(cos (fma y.re (atan2 x.im x.re) (* y.im (log (hypot x.re x.im)))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
double tmp;
if ((y_46_re <= -7.5e-30) || !(y_46_re <= 1.7e-21)) {
tmp = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * cos((y_46_re * atan2(x_46_im, x_46_re)));
} else {
tmp = exp(-t_0) * cos(fma(y_46_re, atan2(x_46_im, x_46_re), (y_46_im * log(hypot(x_46_re, x_46_im)))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im) tmp = 0.0 if ((y_46_re <= -7.5e-30) || !(y_46_re <= 1.7e-21)) tmp = Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - t_0)) * cos(Float64(y_46_re * atan(x_46_im, x_46_re)))); else tmp = Float64(exp(Float64(-t_0)) * cos(fma(y_46_re, atan(x_46_im, x_46_re), Float64(y_46_im * log(hypot(x_46_re, x_46_im)))))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, If[Or[LessEqual[y$46$re, -7.5e-30], N[Not[LessEqual[y$46$re, 1.7e-21]], $MachinePrecision]], N[(N[Exp[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[(-t$95$0)], $MachinePrecision] * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(y$46$im * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
\mathbf{if}\;y.re \leq -7.5 \cdot 10^{-30} \lor \neg \left(y.re \leq 1.7 \cdot 10^{-21}\right):\\
\;\;\;\;e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - t_0} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{-t_0} \cdot \cos \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right)\right)\\
\end{array}
\end{array}
if y.re < -7.5000000000000006e-30 or 1.7e-21 < y.re Initial program 43.6%
Taylor expanded in y.im around 0 74.4%
if -7.5000000000000006e-30 < y.re < 1.7e-21Initial program 44.7%
exp-diff44.7%
exp-to-pow44.7%
hypot-def44.7%
*-commutative44.7%
exp-prod43.9%
+-commutative43.9%
*-commutative43.9%
fma-def43.9%
hypot-def82.4%
Simplified82.4%
Taylor expanded in y.re around 0 83.2%
rec-exp83.2%
distribute-rgt-neg-in83.2%
Simplified83.2%
Final simplification78.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (cos (* y.im (log (hypot x.im x.re)))))
(t_2 (* t_1 (exp (- (* y.re (log (- x.im))) t_0))))
(t_3
(*
(exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) t_0))
(cos (* y.re (atan2 x.im x.re))))))
(if (<= x.im -1.46e+150)
t_2
(if (<= x.im -4.4e-82)
t_3
(if (<= x.im -6.8e-276)
t_2
(if (<= x.im 3e-52)
t_3
(* t_1 (exp (- (* y.re (log x.im)) t_0)))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = cos((y_46_im * log(hypot(x_46_im, x_46_re))));
double t_2 = t_1 * exp(((y_46_re * log(-x_46_im)) - t_0));
double t_3 = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * cos((y_46_re * atan2(x_46_im, x_46_re)));
double tmp;
if (x_46_im <= -1.46e+150) {
tmp = t_2;
} else if (x_46_im <= -4.4e-82) {
tmp = t_3;
} else if (x_46_im <= -6.8e-276) {
tmp = t_2;
} else if (x_46_im <= 3e-52) {
tmp = t_3;
} else {
tmp = t_1 * exp(((y_46_re * log(x_46_im)) - 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.atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))));
double t_2 = t_1 * Math.exp(((y_46_re * Math.log(-x_46_im)) - t_0));
double t_3 = Math.exp(((Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
double tmp;
if (x_46_im <= -1.46e+150) {
tmp = t_2;
} else if (x_46_im <= -4.4e-82) {
tmp = t_3;
} else if (x_46_im <= -6.8e-276) {
tmp = t_2;
} else if (x_46_im <= 3e-52) {
tmp = t_3;
} else {
tmp = t_1 * Math.exp(((y_46_re * Math.log(x_46_im)) - t_0));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.atan2(x_46_im, x_46_re) * y_46_im t_1 = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) t_2 = t_1 * math.exp(((y_46_re * math.log(-x_46_im)) - t_0)) t_3 = math.exp(((math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) tmp = 0 if x_46_im <= -1.46e+150: tmp = t_2 elif x_46_im <= -4.4e-82: tmp = t_3 elif x_46_im <= -6.8e-276: tmp = t_2 elif x_46_im <= 3e-52: tmp = t_3 else: tmp = t_1 * math.exp(((y_46_re * math.log(x_46_im)) - t_0)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_1 = cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) t_2 = Float64(t_1 * exp(Float64(Float64(y_46_re * log(Float64(-x_46_im))) - t_0))) t_3 = Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - t_0)) * cos(Float64(y_46_re * atan(x_46_im, x_46_re)))) tmp = 0.0 if (x_46_im <= -1.46e+150) tmp = t_2; elseif (x_46_im <= -4.4e-82) tmp = t_3; elseif (x_46_im <= -6.8e-276) tmp = t_2; elseif (x_46_im <= 3e-52) tmp = t_3; else tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(x_46_im)) - t_0))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = atan2(x_46_im, x_46_re) * y_46_im; t_1 = cos((y_46_im * log(hypot(x_46_im, x_46_re)))); t_2 = t_1 * exp(((y_46_re * log(-x_46_im)) - t_0)); t_3 = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - t_0)) * cos((y_46_re * atan2(x_46_im, x_46_re))); tmp = 0.0; if (x_46_im <= -1.46e+150) tmp = t_2; elseif (x_46_im <= -4.4e-82) tmp = t_3; elseif (x_46_im <= -6.8e-276) tmp = t_2; elseif (x_46_im <= 3e-52) tmp = t_3; else tmp = t_1 * exp(((y_46_re * log(x_46_im)) - t_0)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[(-x$46$im)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Exp[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, -1.46e+150], t$95$2, If[LessEqual[x$46$im, -4.4e-82], t$95$3, If[LessEqual[x$46$im, -6.8e-276], t$95$2, If[LessEqual[x$46$im, 3e-52], t$95$3, N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
t_2 := t_1 \cdot e^{y.re \cdot \log \left(-x.im\right) - t_0}\\
t_3 := e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - t_0} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;x.im \leq -1.46 \cdot 10^{+150}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x.im \leq -4.4 \cdot 10^{-82}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x.im \leq -6.8 \cdot 10^{-276}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x.im \leq 3 \cdot 10^{-52}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot e^{y.re \cdot \log x.im - t_0}\\
\end{array}
\end{array}
if x.im < -1.4599999999999999e150 or -4.39999999999999971e-82 < x.im < -6.79999999999999984e-276Initial program 27.6%
Taylor expanded in y.re around 0 26.4%
unpow226.4%
unpow226.4%
hypot-def58.9%
Simplified58.9%
Taylor expanded in x.im around -inf 76.1%
mul-1-neg76.1%
Simplified76.1%
if -1.4599999999999999e150 < x.im < -4.39999999999999971e-82 or -6.79999999999999984e-276 < x.im < 3e-52Initial program 62.0%
Taylor expanded in y.im around 0 79.7%
if 3e-52 < x.im Initial program 38.9%
Taylor expanded in y.re around 0 40.3%
unpow240.3%
unpow240.3%
hypot-def67.3%
Simplified67.3%
Taylor expanded in x.re around 0 87.5%
Final simplification80.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (exp (- (* y.re (log x.re)) t_0)))
(t_2 (cos (* y.re (atan2 x.im x.re))))
(t_3 (* (cos (* y.im (log (hypot x.im x.re)))) t_1)))
(if (<= x.re -2.35e-90)
(* t_2 (exp (- (* y.re (log (- x.re))) t_0)))
(if (<= x.re 3.5e-304)
(* t_2 (pow (hypot x.im x.re) y.re))
(if (<= x.re 2.3e-124)
t_3
(if (<= x.re 21.5)
(* t_2 (pow (sqrt (+ (* x.re x.re) (* x.im x.im))) y.re))
(if (<= x.re 3.3e+212) t_3 (* t_2 t_1))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = exp(((y_46_re * log(x_46_re)) - t_0));
double t_2 = cos((y_46_re * atan2(x_46_im, x_46_re)));
double t_3 = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * t_1;
double tmp;
if (x_46_re <= -2.35e-90) {
tmp = t_2 * exp(((y_46_re * log(-x_46_re)) - t_0));
} else if (x_46_re <= 3.5e-304) {
tmp = t_2 * pow(hypot(x_46_im, x_46_re), y_46_re);
} else if (x_46_re <= 2.3e-124) {
tmp = t_3;
} else if (x_46_re <= 21.5) {
tmp = t_2 * pow(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re);
} else if (x_46_re <= 3.3e+212) {
tmp = t_3;
} else {
tmp = t_2 * t_1;
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = Math.exp(((y_46_re * Math.log(x_46_re)) - t_0));
double t_2 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
double t_3 = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) * t_1;
double tmp;
if (x_46_re <= -2.35e-90) {
tmp = t_2 * Math.exp(((y_46_re * Math.log(-x_46_re)) - t_0));
} else if (x_46_re <= 3.5e-304) {
tmp = t_2 * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else if (x_46_re <= 2.3e-124) {
tmp = t_3;
} else if (x_46_re <= 21.5) {
tmp = t_2 * Math.pow(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re);
} else if (x_46_re <= 3.3e+212) {
tmp = t_3;
} else {
tmp = t_2 * t_1;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.atan2(x_46_im, x_46_re) * y_46_im t_1 = math.exp(((y_46_re * math.log(x_46_re)) - t_0)) t_2 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) t_3 = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) * t_1 tmp = 0 if x_46_re <= -2.35e-90: tmp = t_2 * math.exp(((y_46_re * math.log(-x_46_re)) - t_0)) elif x_46_re <= 3.5e-304: tmp = t_2 * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) elif x_46_re <= 2.3e-124: tmp = t_3 elif x_46_re <= 21.5: tmp = t_2 * math.pow(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re) elif x_46_re <= 3.3e+212: tmp = t_3 else: tmp = t_2 * t_1 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_1 = exp(Float64(Float64(y_46_re * log(x_46_re)) - t_0)) t_2 = cos(Float64(y_46_re * atan(x_46_im, x_46_re))) t_3 = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * t_1) tmp = 0.0 if (x_46_re <= -2.35e-90) tmp = Float64(t_2 * exp(Float64(Float64(y_46_re * log(Float64(-x_46_re))) - t_0))); elseif (x_46_re <= 3.5e-304) tmp = Float64(t_2 * (hypot(x_46_im, x_46_re) ^ y_46_re)); elseif (x_46_re <= 2.3e-124) tmp = t_3; elseif (x_46_re <= 21.5) tmp = Float64(t_2 * (sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))) ^ y_46_re)); elseif (x_46_re <= 3.3e+212) tmp = t_3; else tmp = Float64(t_2 * t_1); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = atan2(x_46_im, x_46_re) * y_46_im; t_1 = exp(((y_46_re * log(x_46_re)) - t_0)); t_2 = cos((y_46_re * atan2(x_46_im, x_46_re))); t_3 = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * t_1; tmp = 0.0; if (x_46_re <= -2.35e-90) tmp = t_2 * exp(((y_46_re * log(-x_46_re)) - t_0)); elseif (x_46_re <= 3.5e-304) tmp = t_2 * (hypot(x_46_im, x_46_re) ^ y_46_re); elseif (x_46_re <= 2.3e-124) tmp = t_3; elseif (x_46_re <= 21.5) tmp = t_2 * (sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))) ^ y_46_re); elseif (x_46_re <= 3.3e+212) tmp = t_3; else tmp = t_2 * t_1; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = 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$1), $MachinePrecision]}, If[LessEqual[x$46$re, -2.35e-90], N[(t$95$2 * N[Exp[N[(N[(y$46$re * N[Log[(-x$46$re)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 3.5e-304], N[(t$95$2 * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 2.3e-124], t$95$3, If[LessEqual[x$46$re, 21.5], N[(t$95$2 * N[Power[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 3.3e+212], t$95$3, N[(t$95$2 * t$95$1), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := e^{y.re \cdot \log x.re - t_0}\\
t_2 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
t_3 := \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot t_1\\
\mathbf{if}\;x.re \leq -2.35 \cdot 10^{-90}:\\
\;\;\;\;t_2 \cdot e^{y.re \cdot \log \left(-x.re\right) - t_0}\\
\mathbf{elif}\;x.re \leq 3.5 \cdot 10^{-304}:\\
\;\;\;\;t_2 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{elif}\;x.re \leq 2.3 \cdot 10^{-124}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x.re \leq 21.5:\\
\;\;\;\;t_2 \cdot {\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}\\
\mathbf{elif}\;x.re \leq 3.3 \cdot 10^{+212}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot t_1\\
\end{array}
\end{array}
if x.re < -2.35e-90Initial program 33.5%
Taylor expanded in y.im around 0 54.1%
Taylor expanded in x.re around -inf 80.6%
mul-1-neg80.6%
Simplified80.6%
if -2.35e-90 < x.re < 3.5e-304Initial program 60.0%
exp-diff50.0%
exp-to-pow50.0%
hypot-def50.0%
*-commutative50.0%
exp-prod50.0%
+-commutative50.0%
*-commutative50.0%
fma-def50.0%
hypot-def76.0%
Simplified76.0%
Taylor expanded in y.im around 0 72.1%
Taylor expanded in y.im around 0 65.6%
unpow265.6%
unpow265.6%
hypot-def75.4%
*-commutative75.4%
Simplified75.4%
if 3.5e-304 < x.re < 2.30000000000000012e-124 or 21.5 < x.re < 3.3e212Initial program 46.1%
Taylor expanded in y.re around 0 48.6%
unpow248.6%
unpow248.6%
hypot-def78.9%
Simplified78.9%
Taylor expanded in x.re around inf 81.7%
if 2.30000000000000012e-124 < x.re < 21.5Initial program 65.4%
exp-diff56.6%
exp-to-pow56.6%
hypot-def56.6%
*-commutative56.6%
exp-prod56.1%
+-commutative56.1%
*-commutative56.1%
fma-def56.1%
hypot-def62.0%
Simplified62.0%
Taylor expanded in y.im around 0 68.9%
Taylor expanded in y.im around 0 71.0%
unpow271.0%
unpow271.0%
*-commutative71.0%
Simplified71.0%
if 3.3e212 < x.re Initial program 0.0%
Taylor expanded in y.im around 0 44.2%
Taylor expanded in x.re around inf 84.2%
Final simplification78.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (cos (* y.im (log (hypot x.im x.re))))))
(if (<= x.im -9.5e-266)
(* t_1 (exp (- (* y.re (log (- x.im))) t_0)))
(if (<= x.im 8.8e-21)
(* (cos (* y.re (atan2 x.im x.re))) (pow (hypot x.im x.re) y.re))
(* t_1 (exp (- (* y.re (log x.im)) t_0)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = cos((y_46_im * log(hypot(x_46_im, x_46_re))));
double tmp;
if (x_46_im <= -9.5e-266) {
tmp = t_1 * exp(((y_46_re * log(-x_46_im)) - t_0));
} else if (x_46_im <= 8.8e-21) {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = t_1 * exp(((y_46_re * log(x_46_im)) - 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.atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re))));
double tmp;
if (x_46_im <= -9.5e-266) {
tmp = t_1 * Math.exp(((y_46_re * Math.log(-x_46_im)) - t_0));
} else if (x_46_im <= 8.8e-21) {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = t_1 * Math.exp(((y_46_re * Math.log(x_46_im)) - t_0));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.atan2(x_46_im, x_46_re) * y_46_im t_1 = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) tmp = 0 if x_46_im <= -9.5e-266: tmp = t_1 * math.exp(((y_46_re * math.log(-x_46_im)) - t_0)) elif x_46_im <= 8.8e-21: tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = t_1 * math.exp(((y_46_re * math.log(x_46_im)) - t_0)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_1 = cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) tmp = 0.0 if (x_46_im <= -9.5e-266) tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(Float64(-x_46_im))) - t_0))); elseif (x_46_im <= 8.8e-21) tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * (hypot(x_46_im, x_46_re) ^ y_46_re)); else tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(x_46_im)) - t_0))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = atan2(x_46_im, x_46_re) * y_46_im; t_1 = cos((y_46_im * log(hypot(x_46_im, x_46_re)))); tmp = 0.0; if (x_46_im <= -9.5e-266) tmp = t_1 * exp(((y_46_re * log(-x_46_im)) - t_0)); elseif (x_46_im <= 8.8e-21) tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * (hypot(x_46_im, x_46_re) ^ y_46_re); else tmp = t_1 * exp(((y_46_re * log(x_46_im)) - t_0)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -9.5e-266], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[(-x$46$im)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 8.8e-21], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{if}\;x.im \leq -9.5 \cdot 10^{-266}:\\
\;\;\;\;t_1 \cdot e^{y.re \cdot \log \left(-x.im\right) - t_0}\\
\mathbf{elif}\;x.im \leq 8.8 \cdot 10^{-21}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot e^{y.re \cdot \log x.im - t_0}\\
\end{array}
\end{array}
if x.im < -9.49999999999999951e-266Initial program 40.7%
Taylor expanded in y.re around 0 39.9%
unpow239.9%
unpow239.9%
hypot-def63.6%
Simplified63.6%
Taylor expanded in x.im around -inf 75.0%
mul-1-neg75.0%
Simplified75.0%
if -9.49999999999999951e-266 < x.im < 8.8000000000000002e-21Initial program 59.0%
exp-diff52.4%
exp-to-pow52.4%
hypot-def52.4%
*-commutative52.4%
exp-prod50.1%
+-commutative50.1%
*-commutative50.1%
fma-def50.1%
hypot-def72.6%
Simplified72.6%
Taylor expanded in y.im around 0 74.8%
Taylor expanded in y.im around 0 65.1%
unpow265.1%
unpow265.1%
hypot-def72.3%
*-commutative72.3%
Simplified72.3%
if 8.8000000000000002e-21 < x.im Initial program 37.3%
Taylor expanded in y.re around 0 38.8%
unpow238.8%
unpow238.8%
hypot-def67.7%
Simplified67.7%
Taylor expanded in x.re around 0 88.1%
Final simplification77.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (cos (* y.re (atan2 x.im x.re)))))
(if (<= x.re -2.4e-89)
(* t_1 (exp (- (* y.re (log (- x.re))) t_0)))
(if (<= x.re 5.3e-303)
(* t_1 (pow (hypot x.im x.re) y.re))
(if (or (<= x.re 4.9e-144) (not (<= x.re 21.5)))
(* t_1 (exp (- (* y.re (log x.re)) t_0)))
(* t_1 (pow (sqrt (+ (* x.re x.re) (* x.im x.im))) y.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = cos((y_46_re * atan2(x_46_im, x_46_re)));
double tmp;
if (x_46_re <= -2.4e-89) {
tmp = t_1 * exp(((y_46_re * log(-x_46_re)) - t_0));
} else if (x_46_re <= 5.3e-303) {
tmp = t_1 * pow(hypot(x_46_im, x_46_re), y_46_re);
} else if ((x_46_re <= 4.9e-144) || !(x_46_re <= 21.5)) {
tmp = t_1 * exp(((y_46_re * log(x_46_re)) - t_0));
} else {
tmp = t_1 * pow(sqrt(((x_46_re * x_46_re) + (x_46_im * 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 t_0 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
double tmp;
if (x_46_re <= -2.4e-89) {
tmp = t_1 * Math.exp(((y_46_re * Math.log(-x_46_re)) - t_0));
} else if (x_46_re <= 5.3e-303) {
tmp = t_1 * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else if ((x_46_re <= 4.9e-144) || !(x_46_re <= 21.5)) {
tmp = t_1 * Math.exp(((y_46_re * Math.log(x_46_re)) - t_0));
} else {
tmp = t_1 * Math.pow(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.atan2(x_46_im, x_46_re) * y_46_im t_1 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) tmp = 0 if x_46_re <= -2.4e-89: tmp = t_1 * math.exp(((y_46_re * math.log(-x_46_re)) - t_0)) elif x_46_re <= 5.3e-303: tmp = t_1 * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) elif (x_46_re <= 4.9e-144) or not (x_46_re <= 21.5): tmp = t_1 * math.exp(((y_46_re * math.log(x_46_re)) - t_0)) else: tmp = t_1 * math.pow(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_1 = cos(Float64(y_46_re * atan(x_46_im, x_46_re))) tmp = 0.0 if (x_46_re <= -2.4e-89) tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(Float64(-x_46_re))) - t_0))); elseif (x_46_re <= 5.3e-303) tmp = Float64(t_1 * (hypot(x_46_im, x_46_re) ^ y_46_re)); elseif ((x_46_re <= 4.9e-144) || !(x_46_re <= 21.5)) tmp = Float64(t_1 * exp(Float64(Float64(y_46_re * log(x_46_re)) - t_0))); else tmp = Float64(t_1 * (sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * 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) t_0 = atan2(x_46_im, x_46_re) * y_46_im; t_1 = cos((y_46_re * atan2(x_46_im, x_46_re))); tmp = 0.0; if (x_46_re <= -2.4e-89) tmp = t_1 * exp(((y_46_re * log(-x_46_re)) - t_0)); elseif (x_46_re <= 5.3e-303) tmp = t_1 * (hypot(x_46_im, x_46_re) ^ y_46_re); elseif ((x_46_re <= 4.9e-144) || ~((x_46_re <= 21.5))) tmp = t_1 * exp(((y_46_re * log(x_46_re)) - t_0)); else tmp = t_1 * (sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))) ^ y_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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -2.4e-89], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[(-x$46$re)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, 5.3e-303], N[(t$95$1 * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x$46$re, 4.9e-144], N[Not[LessEqual[x$46$re, 21.5]], $MachinePrecision]], N[(t$95$1 * N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Power[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;x.re \leq -2.4 \cdot 10^{-89}:\\
\;\;\;\;t_1 \cdot e^{y.re \cdot \log \left(-x.re\right) - t_0}\\
\mathbf{elif}\;x.re \leq 5.3 \cdot 10^{-303}:\\
\;\;\;\;t_1 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{elif}\;x.re \leq 4.9 \cdot 10^{-144} \lor \neg \left(x.re \leq 21.5\right):\\
\;\;\;\;t_1 \cdot e^{y.re \cdot \log x.re - t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot {\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}\\
\end{array}
\end{array}
if x.re < -2.40000000000000016e-89Initial program 33.5%
Taylor expanded in y.im around 0 54.1%
Taylor expanded in x.re around -inf 80.6%
mul-1-neg80.6%
Simplified80.6%
if -2.40000000000000016e-89 < x.re < 5.2999999999999999e-303Initial program 60.0%
exp-diff50.0%
exp-to-pow50.0%
hypot-def50.0%
*-commutative50.0%
exp-prod50.0%
+-commutative50.0%
*-commutative50.0%
fma-def50.0%
hypot-def76.0%
Simplified76.0%
Taylor expanded in y.im around 0 72.1%
Taylor expanded in y.im around 0 65.6%
unpow265.6%
unpow265.6%
hypot-def75.4%
*-commutative75.4%
Simplified75.4%
if 5.2999999999999999e-303 < x.re < 4.9000000000000001e-144 or 21.5 < x.re Initial program 37.0%
Taylor expanded in y.im around 0 63.1%
Taylor expanded in x.re around inf 76.7%
if 4.9000000000000001e-144 < x.re < 21.5Initial program 61.1%
exp-diff53.3%
exp-to-pow53.3%
hypot-def53.3%
*-commutative53.3%
exp-prod52.8%
+-commutative52.8%
*-commutative52.8%
fma-def52.8%
hypot-def63.3%
Simplified63.3%
Taylor expanded in y.im around 0 67.0%
Taylor expanded in y.im around 0 68.7%
unpow268.7%
unpow268.7%
*-commutative68.7%
Simplified68.7%
Final simplification76.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (cos (* y.re (atan2 x.im x.re))))
(t_1 (* t_0 (pow (hypot x.im x.re) y.re))))
(if (<= x.im -4.5e+190)
t_1
(if (<= x.im -3.8e+15)
(* t_0 (pow (sqrt (+ (* x.re x.re) (* x.im x.im))) y.re))
(if (<= x.im 1.05e-14)
t_1
(* t_0 (exp (- (* y.re (log x.im)) (* (atan2 x.im x.re) y.im)))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = cos((y_46_re * atan2(x_46_im, x_46_re)));
double t_1 = t_0 * pow(hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if (x_46_im <= -4.5e+190) {
tmp = t_1;
} else if (x_46_im <= -3.8e+15) {
tmp = t_0 * pow(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re);
} else if (x_46_im <= 1.05e-14) {
tmp = t_1;
} else {
tmp = t_0 * exp(((y_46_re * log(x_46_im)) - (atan2(x_46_im, x_46_re) * y_46_im)));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
double t_1 = t_0 * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if (x_46_im <= -4.5e+190) {
tmp = t_1;
} else if (x_46_im <= -3.8e+15) {
tmp = t_0 * Math.pow(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re);
} else if (x_46_im <= 1.05e-14) {
tmp = t_1;
} else {
tmp = t_0 * Math.exp(((y_46_re * Math.log(x_46_im)) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) t_1 = t_0 * math.pow(math.hypot(x_46_im, x_46_re), y_46_re) tmp = 0 if x_46_im <= -4.5e+190: tmp = t_1 elif x_46_im <= -3.8e+15: tmp = t_0 * math.pow(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re) elif x_46_im <= 1.05e-14: tmp = t_1 else: tmp = t_0 * math.exp(((y_46_re * math.log(x_46_im)) - (math.atan2(x_46_im, x_46_re) * y_46_im))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos(Float64(y_46_re * atan(x_46_im, x_46_re))) t_1 = Float64(t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re)) tmp = 0.0 if (x_46_im <= -4.5e+190) tmp = t_1; elseif (x_46_im <= -3.8e+15) tmp = Float64(t_0 * (sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))) ^ y_46_re)); elseif (x_46_im <= 1.05e-14) tmp = t_1; else tmp = Float64(t_0 * exp(Float64(Float64(y_46_re * log(x_46_im)) - Float64(atan(x_46_im, x_46_re) * y_46_im)))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos((y_46_re * atan2(x_46_im, x_46_re))); t_1 = t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re); tmp = 0.0; if (x_46_im <= -4.5e+190) tmp = t_1; elseif (x_46_im <= -3.8e+15) tmp = t_0 * (sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))) ^ y_46_re); elseif (x_46_im <= 1.05e-14) tmp = t_1; else tmp = t_0 * exp(((y_46_re * log(x_46_im)) - (atan2(x_46_im, x_46_re) * y_46_im))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, -4.5e+190], t$95$1, If[LessEqual[x$46$im, -3.8e+15], N[(t$95$0 * N[Power[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 1.05e-14], t$95$1, N[(t$95$0 * N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
t_1 := t_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{if}\;x.im \leq -4.5 \cdot 10^{+190}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x.im \leq -3.8 \cdot 10^{+15}:\\
\;\;\;\;t_0 \cdot {\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}\\
\mathbf{elif}\;x.im \leq 1.05 \cdot 10^{-14}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot e^{y.re \cdot \log x.im - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\end{array}
\end{array}
if x.im < -4.4999999999999999e190 or -3.8e15 < x.im < 1.0499999999999999e-14Initial program 46.7%
exp-diff39.0%
exp-to-pow39.0%
hypot-def39.0%
*-commutative39.0%
exp-prod37.8%
+-commutative37.8%
*-commutative37.8%
fma-def37.8%
hypot-def70.9%
Simplified70.9%
Taylor expanded in y.im around 0 69.9%
Taylor expanded in y.im around 0 59.0%
unpow259.0%
unpow259.0%
hypot-def67.5%
*-commutative67.5%
Simplified67.5%
if -4.4999999999999999e190 < x.im < -3.8e15Initial program 44.1%
exp-diff38.2%
exp-to-pow38.2%
hypot-def38.2%
*-commutative38.2%
exp-prod38.2%
+-commutative38.2%
*-commutative38.2%
fma-def38.2%
hypot-def61.8%
Simplified61.8%
Taylor expanded in y.im around 0 42.2%
Taylor expanded in y.im around 0 64.1%
unpow264.1%
unpow264.1%
*-commutative64.1%
Simplified64.1%
if 1.0499999999999999e-14 < x.im Initial program 37.9%
Taylor expanded in y.im around 0 57.8%
Taylor expanded in x.re around 0 80.2%
Final simplification70.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (cos (* y.re (atan2 x.im x.re)))))
(if (or (<= y.im -110000.0) (not (<= y.im 1.4e+103)))
(* t_0 (pow (sqrt (+ (* x.re x.re) (* x.im x.im))) y.re))
(* t_0 (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 = cos((y_46_re * atan2(x_46_im, x_46_re)));
double tmp;
if ((y_46_im <= -110000.0) || !(y_46_im <= 1.4e+103)) {
tmp = t_0 * pow(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re);
} else {
tmp = t_0 * pow(hypot(x_46_im, x_46_re), 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 t_0 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
double tmp;
if ((y_46_im <= -110000.0) || !(y_46_im <= 1.4e+103)) {
tmp = t_0 * Math.pow(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re);
} else {
tmp = t_0 * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) tmp = 0 if (y_46_im <= -110000.0) or not (y_46_im <= 1.4e+103): tmp = t_0 * math.pow(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))), y_46_re) else: tmp = t_0 * math.pow(math.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 = cos(Float64(y_46_re * atan(x_46_im, x_46_re))) tmp = 0.0 if ((y_46_im <= -110000.0) || !(y_46_im <= 1.4e+103)) tmp = Float64(t_0 * (sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))) ^ y_46_re)); else tmp = Float64(t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = cos((y_46_re * atan2(x_46_im, x_46_re))); tmp = 0.0; if ((y_46_im <= -110000.0) || ~((y_46_im <= 1.4e+103))) tmp = t_0 * (sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))) ^ y_46_re); else tmp = t_0 * (hypot(x_46_im, x_46_re) ^ y_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[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[y$46$im, -110000.0], N[Not[LessEqual[y$46$im, 1.4e+103]], $MachinePrecision]], N[(t$95$0 * N[Power[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * 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 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;y.im \leq -110000 \lor \neg \left(y.im \leq 1.4 \cdot 10^{+103}\right):\\
\;\;\;\;t_0 \cdot {\left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.im < -1.1e5 or 1.40000000000000004e103 < y.im Initial program 32.2%
exp-diff20.3%
exp-to-pow20.3%
hypot-def20.3%
*-commutative20.3%
exp-prod18.5%
+-commutative18.5%
*-commutative18.5%
fma-def18.5%
hypot-def46.7%
Simplified46.7%
Taylor expanded in y.im around 0 30.8%
Taylor expanded in y.im around 0 41.9%
unpow241.9%
unpow241.9%
*-commutative41.9%
Simplified41.9%
if -1.1e5 < y.im < 1.40000000000000004e103Initial program 52.9%
exp-diff51.5%
exp-to-pow51.5%
hypot-def51.5%
*-commutative51.5%
exp-prod51.5%
+-commutative51.5%
*-commutative51.5%
fma-def51.5%
hypot-def87.6%
Simplified87.6%
Taylor expanded in y.im around 0 84.7%
Taylor expanded in y.im around 0 66.9%
unpow266.9%
unpow266.9%
hypot-def83.6%
*-commutative83.6%
Simplified83.6%
Final simplification65.8%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (cos (* y.re (atan2 x.im x.re))) (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 cos((y_46_re * atan2(x_46_im, x_46_re))) * 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.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * 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.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * 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 Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * (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 = cos((y_46_re * atan2(x_46_im, x_46_re))) * (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[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}
\end{array}
Initial program 44.1%
exp-diff38.2%
exp-to-pow38.2%
hypot-def38.2%
*-commutative38.2%
exp-prod37.5%
+-commutative37.5%
*-commutative37.5%
fma-def37.5%
hypot-def70.2%
Simplified70.2%
Taylor expanded in y.im around 0 61.7%
Taylor expanded in y.im around 0 56.2%
unpow256.2%
unpow256.2%
hypot-def61.2%
*-commutative61.2%
Simplified61.2%
Final simplification61.2%
herbie shell --seed 2023178
(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)))))