
(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 (log (hypot x.im x.re)))
(t_1 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_2
(exp
(fma (log (hypot x.re x.im)) y.re (* (atan2 x.im x.re) (- y.im)))))
(t_3 (cbrt t_0)))
(if (<=
(*
(exp (- (* t_1 y.re) (* (atan2 x.im x.re) y.im)))
(cos (+ (* t_1 y.im) (* y.re (atan2 x.im x.re)))))
INFINITY)
(* t_2 (cos (* (pow (cbrt y.im) 2.0) (* (cbrt y.im) t_0))))
(* t_2 (cos (* (pow t_3 2.0) (* y.im t_3)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_im, x_46_re));
double t_1 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_2 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im)));
double t_3 = cbrt(t_0);
double tmp;
if ((exp(((t_1 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_1 * y_46_im) + (y_46_re * atan2(x_46_im, x_46_re))))) <= ((double) INFINITY)) {
tmp = t_2 * cos((pow(cbrt(y_46_im), 2.0) * (cbrt(y_46_im) * t_0)));
} else {
tmp = t_2 * cos((pow(t_3, 2.0) * (y_46_im * t_3)));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = log(hypot(x_46_im, x_46_re)) t_1 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_2 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) t_3 = cbrt(t_0) tmp = 0.0 if (Float64(exp(Float64(Float64(t_1 * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(t_1 * y_46_im) + Float64(y_46_re * atan(x_46_im, x_46_re))))) <= Inf) tmp = Float64(t_2 * cos(Float64((cbrt(y_46_im) ^ 2.0) * Float64(cbrt(y_46_im) * t_0)))); else tmp = Float64(t_2 * cos(Float64((t_3 ^ 2.0) * Float64(y_46_im * t_3)))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[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[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[t$95$0, 1/3], $MachinePrecision]}, If[LessEqual[N[(N[Exp[N[(N[(t$95$1 * 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$1 * y$46$im), $MachinePrecision] + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$2 * N[Cos[N[(N[Power[N[Power[y$46$im, 1/3], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[y$46$im, 1/3], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[Cos[N[(N[Power[t$95$3, 2.0], $MachinePrecision] * N[(y$46$im * t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
t_1 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_2 := e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)}\\
t_3 := \sqrt[3]{t_0}\\
\mathbf{if}\;e^{t_1 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t_1 \cdot y.im + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \leq \infty:\\
\;\;\;\;t_2 \cdot \cos \left({\left(\sqrt[3]{y.im}\right)}^{2} \cdot \left(\sqrt[3]{y.im} \cdot t_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \cos \left({t_3}^{2} \cdot \left(y.im \cdot t_3\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 77.6%
fma-neg77.6%
hypot-def77.6%
distribute-rgt-neg-out77.6%
fma-def77.6%
hypot-def76.8%
*-commutative76.8%
Simplified76.8%
Taylor expanded in y.im around inf 78.7%
unpow278.7%
unpow278.7%
hypot-def77.9%
Simplified77.9%
add-cube-cbrt78.1%
pow376.4%
Applied egg-rr76.4%
rem-cube-cbrt77.9%
hypot-udef78.7%
+-commutative78.7%
add-cube-cbrt79.7%
associate-*l*83.9%
pow283.9%
+-commutative83.9%
hypot-udef84.7%
Applied egg-rr84.7%
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%
fma-neg0.0%
hypot-def0.0%
distribute-rgt-neg-out0.0%
fma-def0.0%
hypot-def75.1%
*-commutative75.1%
Simplified75.1%
Taylor expanded in y.im around inf 0.0%
unpow20.0%
unpow20.0%
hypot-def77.4%
Simplified77.4%
add-cube-cbrt78.7%
pow378.3%
Applied egg-rr78.3%
rem-cube-cbrt77.4%
*-commutative77.4%
add-cube-cbrt80.5%
associate-*l*83.5%
pow283.5%
Applied egg-rr83.5%
Final simplification84.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_1
(exp
(fma (log (hypot x.re x.im)) y.re (* (atan2 x.im x.re) (- y.im))))))
(if (<=
(*
(exp (- (* t_0 y.re) (* (atan2 x.im x.re) y.im)))
(cos (+ (* t_0 y.im) (* y.re (atan2 x.im x.re)))))
INFINITY)
(*
t_1
(cos (* (pow (cbrt y.im) 2.0) (* (cbrt y.im) (log (hypot x.im x.re))))))
t_1)))
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))));
double t_1 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im)));
double tmp;
if ((exp(((t_0 * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((t_0 * y_46_im) + (y_46_re * atan2(x_46_im, x_46_re))))) <= ((double) INFINITY)) {
tmp = t_1 * cos((pow(cbrt(y_46_im), 2.0) * (cbrt(y_46_im) * log(hypot(x_46_im, x_46_re)))));
} else {
tmp = t_1;
}
return tmp;
}
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)))) t_1 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) tmp = 0.0 if (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(y_46_re * atan(x_46_im, x_46_re))))) <= Inf) tmp = Float64(t_1 * cos(Float64((cbrt(y_46_im) ^ 2.0) * Float64(cbrt(y_46_im) * log(hypot(x_46_im, x_46_re)))))); else tmp = 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[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[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[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], Infinity], N[(t$95$1 * N[Cos[N[(N[Power[N[Power[y$46$im, 1/3], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[y$46$im, 1/3], $MachinePrecision] * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_1 := e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)}\\
\mathbf{if}\;e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t_0 \cdot y.im + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \leq \infty:\\
\;\;\;\;t_1 \cdot \cos \left({\left(\sqrt[3]{y.im}\right)}^{2} \cdot \left(\sqrt[3]{y.im} \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\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 77.6%
fma-neg77.6%
hypot-def77.6%
distribute-rgt-neg-out77.6%
fma-def77.6%
hypot-def76.8%
*-commutative76.8%
Simplified76.8%
Taylor expanded in y.im around inf 78.7%
unpow278.7%
unpow278.7%
hypot-def77.9%
Simplified77.9%
add-cube-cbrt78.1%
pow376.4%
Applied egg-rr76.4%
rem-cube-cbrt77.9%
hypot-udef78.7%
+-commutative78.7%
add-cube-cbrt79.7%
associate-*l*83.9%
pow283.9%
+-commutative83.9%
hypot-udef84.7%
Applied egg-rr84.7%
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%
fma-neg0.0%
hypot-def0.0%
distribute-rgt-neg-out0.0%
fma-def0.0%
hypot-def75.1%
*-commutative75.1%
Simplified75.1%
Taylor expanded in y.im around inf 0.0%
unpow20.0%
unpow20.0%
hypot-def77.4%
Simplified77.4%
Taylor expanded in y.im around 0 82.9%
Final simplification83.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0
(exp
(fma (log (hypot x.re x.im)) y.re (* (atan2 x.im x.re) (- y.im))))))
(if (<= x.re -2e-158) (* t_0 (cos (* y.im (log (/ -1.0 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 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im)));
double tmp;
if (x_46_re <= -2e-158) {
tmp = t_0 * cos((y_46_im * log((-1.0 / x_46_re))));
} else {
tmp = t_0;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) tmp = 0.0 if (x_46_re <= -2e-158) tmp = Float64(t_0 * cos(Float64(y_46_im * log(Float64(-1.0 / x_46_re))))); else tmp = t_0; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$re, -2e-158], N[(t$95$0 * N[Cos[N[(y$46$im * N[Log[N[(-1.0 / x$46$re), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, \tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)\right)}\\
\mathbf{if}\;x.re \leq -2 \cdot 10^{-158}:\\
\;\;\;\;t_0 \cdot \cos \left(y.im \cdot \log \left(\frac{-1}{x.re}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x.re < -2.00000000000000013e-158Initial program 37.0%
fma-neg37.0%
hypot-def37.0%
distribute-rgt-neg-out37.0%
fma-def37.0%
hypot-def79.3%
*-commutative79.3%
Simplified79.3%
Taylor expanded in y.im around inf 34.5%
unpow234.5%
unpow234.5%
hypot-def76.8%
Simplified76.8%
Taylor expanded in x.re around -inf 85.0%
mul-1-neg85.0%
cos-neg85.0%
Simplified85.0%
if -2.00000000000000013e-158 < x.re Initial program 36.5%
fma-neg36.5%
hypot-def36.5%
distribute-rgt-neg-out36.5%
fma-def36.5%
hypot-def73.9%
*-commutative73.9%
Simplified73.9%
Taylor expanded in y.im around inf 38.9%
unpow238.9%
unpow238.9%
hypot-def78.1%
Simplified78.1%
Taylor expanded in y.im around 0 82.0%
Final simplification83.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (exp (fma (log (hypot x.re x.im)) y.re (* (atan2 x.im x.re) (- y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (atan2(x_46_im, x_46_re) * -y_46_im)));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := 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]
\begin{array}{l}
\\
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)}
\end{array}
Initial program 36.7%
fma-neg36.7%
hypot-def36.7%
distribute-rgt-neg-out36.7%
fma-def36.7%
hypot-def75.9%
*-commutative75.9%
Simplified75.9%
Taylor expanded in y.im around inf 37.2%
unpow237.2%
unpow237.2%
hypot-def77.6%
Simplified77.6%
Taylor expanded in y.im around 0 79.4%
Final simplification79.4%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= x.im -7.5e-59)
(exp (- (* (atan2 x.im x.re) (- y.im)) (* y.re (log (/ -1.0 x.im)))))
(if (<= x.im 8e-220)
(* (pow (hypot x.re x.im) y.re) (cos (* y.re (atan2 x.im x.re))))
(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 tmp;
if (x_46_im <= -7.5e-59) {
tmp = exp(((atan2(x_46_im, x_46_re) * -y_46_im) - (y_46_re * log((-1.0 / x_46_im)))));
} else if (x_46_im <= 8e-220) {
tmp = pow(hypot(x_46_re, x_46_im), y_46_re) * cos((y_46_re * atan2(x_46_im, x_46_re)));
} else {
tmp = 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 tmp;
if (x_46_im <= -7.5e-59) {
tmp = Math.exp(((Math.atan2(x_46_im, x_46_re) * -y_46_im) - (y_46_re * Math.log((-1.0 / x_46_im)))));
} else if (x_46_im <= 8e-220) {
tmp = Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re) * Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
} else {
tmp = 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): tmp = 0 if x_46_im <= -7.5e-59: tmp = math.exp(((math.atan2(x_46_im, x_46_re) * -y_46_im) - (y_46_re * math.log((-1.0 / x_46_im))))) elif x_46_im <= 8e-220: tmp = math.pow(math.hypot(x_46_re, x_46_im), y_46_re) * math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) else: tmp = 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) tmp = 0.0 if (x_46_im <= -7.5e-59) tmp = exp(Float64(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)) - Float64(y_46_re * log(Float64(-1.0 / x_46_im))))); elseif (x_46_im <= 8e-220) tmp = Float64((hypot(x_46_re, x_46_im) ^ y_46_re) * cos(Float64(y_46_re * atan(x_46_im, x_46_re)))); else tmp = 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) tmp = 0.0; if (x_46_im <= -7.5e-59) tmp = exp(((atan2(x_46_im, x_46_re) * -y_46_im) - (y_46_re * log((-1.0 / x_46_im))))); elseif (x_46_im <= 8e-220) tmp = (hypot(x_46_re, x_46_im) ^ y_46_re) * cos((y_46_re * atan2(x_46_im, x_46_re))); else tmp = 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_] := If[LessEqual[x$46$im, -7.5e-59], N[Exp[N[(N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision] - N[(y$46$re * N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x$46$im, 8e-220], N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -7.5 \cdot 10^{-59}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right) - y.re \cdot \log \left(\frac{-1}{x.im}\right)}\\
\mathbf{elif}\;x.im \leq 8 \cdot 10^{-220}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\end{array}
\end{array}
if x.im < -7.50000000000000019e-59Initial program 31.3%
fma-neg31.3%
hypot-def31.3%
distribute-rgt-neg-out31.3%
fma-def31.3%
hypot-def77.8%
*-commutative77.8%
Simplified77.8%
Taylor expanded in y.im around inf 35.0%
unpow235.0%
unpow235.0%
hypot-def80.3%
Simplified80.3%
Taylor expanded in y.im around 0 80.3%
Taylor expanded in x.im around -inf 78.4%
distribute-lft-out78.4%
Simplified78.4%
if -7.50000000000000019e-59 < x.im < 7.99999999999999994e-220Initial program 42.2%
exp-diff42.2%
exp-to-pow42.2%
hypot-def42.2%
*-commutative42.2%
exp-prod42.2%
fma-def42.2%
hypot-def68.8%
*-commutative68.8%
Simplified68.8%
add-cube-cbrt76.7%
pow373.5%
fma-udef73.5%
*-commutative73.5%
*-commutative73.5%
fma-def73.5%
Applied egg-rr73.5%
Taylor expanded in y.im around 0 72.6%
pow-base-172.6%
*-lft-identity72.6%
Simplified72.6%
Taylor expanded in y.im around 0 65.2%
if 7.99999999999999994e-220 < x.im Initial program 37.4%
fma-neg37.4%
hypot-def37.4%
distribute-rgt-neg-out37.4%
fma-def37.4%
hypot-def76.9%
*-commutative76.9%
Simplified76.9%
Taylor expanded in y.im around inf 35.7%
unpow235.7%
unpow235.7%
hypot-def78.8%
Simplified78.8%
Taylor expanded in y.im around 0 83.3%
Taylor expanded in x.re around 0 79.8%
+-commutative79.8%
neg-mul-179.8%
unsub-neg79.8%
*-commutative79.8%
Simplified79.8%
Final simplification75.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= x.im -2.9e-60)
(exp (- (* (atan2 x.im x.re) (- y.im)) (* y.re (log (/ -1.0 x.im)))))
(if (<= x.im 1.9e-218)
(pow (hypot x.im x.re) y.re)
(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 tmp;
if (x_46_im <= -2.9e-60) {
tmp = exp(((atan2(x_46_im, x_46_re) * -y_46_im) - (y_46_re * log((-1.0 / x_46_im)))));
} else if (x_46_im <= 1.9e-218) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = 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 tmp;
if (x_46_im <= -2.9e-60) {
tmp = Math.exp(((Math.atan2(x_46_im, x_46_re) * -y_46_im) - (y_46_re * Math.log((-1.0 / x_46_im)))));
} else if (x_46_im <= 1.9e-218) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = 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): tmp = 0 if x_46_im <= -2.9e-60: tmp = math.exp(((math.atan2(x_46_im, x_46_re) * -y_46_im) - (y_46_re * math.log((-1.0 / x_46_im))))) elif x_46_im <= 1.9e-218: tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = 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) tmp = 0.0 if (x_46_im <= -2.9e-60) tmp = exp(Float64(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)) - Float64(y_46_re * log(Float64(-1.0 / x_46_im))))); elseif (x_46_im <= 1.9e-218) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = 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) tmp = 0.0; if (x_46_im <= -2.9e-60) tmp = exp(((atan2(x_46_im, x_46_re) * -y_46_im) - (y_46_re * log((-1.0 / x_46_im))))); elseif (x_46_im <= 1.9e-218) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = 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_] := If[LessEqual[x$46$im, -2.9e-60], N[Exp[N[(N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision] - N[(y$46$re * N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[x$46$im, 1.9e-218], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -2.9 \cdot 10^{-60}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right) - y.re \cdot \log \left(\frac{-1}{x.im}\right)}\\
\mathbf{elif}\;x.im \leq 1.9 \cdot 10^{-218}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\end{array}
\end{array}
if x.im < -2.8999999999999999e-60Initial program 31.3%
fma-neg31.3%
hypot-def31.3%
distribute-rgt-neg-out31.3%
fma-def31.3%
hypot-def77.8%
*-commutative77.8%
Simplified77.8%
Taylor expanded in y.im around inf 35.0%
unpow235.0%
unpow235.0%
hypot-def80.3%
Simplified80.3%
Taylor expanded in y.im around 0 80.3%
Taylor expanded in x.im around -inf 78.4%
distribute-lft-out78.4%
Simplified78.4%
if -2.8999999999999999e-60 < x.im < 1.8999999999999999e-218Initial program 42.2%
fma-neg42.2%
hypot-def42.2%
distribute-rgt-neg-out42.2%
fma-def42.2%
hypot-def71.9%
*-commutative71.9%
Simplified71.9%
Taylor expanded in y.im around inf 42.5%
unpow242.5%
unpow242.5%
hypot-def72.3%
Simplified72.3%
Taylor expanded in y.im around 0 71.4%
Taylor expanded in y.im around 0 57.0%
unpow257.0%
unpow257.0%
hypot-def60.9%
Simplified60.9%
if 1.8999999999999999e-218 < x.im Initial program 37.4%
fma-neg37.4%
hypot-def37.4%
distribute-rgt-neg-out37.4%
fma-def37.4%
hypot-def76.9%
*-commutative76.9%
Simplified76.9%
Taylor expanded in y.im around inf 35.7%
unpow235.7%
unpow235.7%
hypot-def78.8%
Simplified78.8%
Taylor expanded in y.im around 0 83.3%
Taylor expanded in x.re around 0 79.8%
+-commutative79.8%
neg-mul-179.8%
unsub-neg79.8%
*-commutative79.8%
Simplified79.8%
Final simplification74.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (or (<= y.re -6.3e-12) (not (<= y.re 200.0))) (pow (hypot x.im x.re) y.re) (exp (* (atan2 x.im x.re) (- y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_re <= -6.3e-12) || !(y_46_re <= 200.0)) {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if ((y_46_re <= -6.3e-12) || !(y_46_re <= 200.0)) {
tmp = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
} else {
tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if (y_46_re <= -6.3e-12) or not (y_46_re <= 200.0): tmp = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) else: tmp = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if ((y_46_re <= -6.3e-12) || !(y_46_re <= 200.0)) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if ((y_46_re <= -6.3e-12) || ~((y_46_re <= 200.0))) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; else tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$re, -6.3e-12], N[Not[LessEqual[y$46$re, 200.0]], $MachinePrecision]], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -6.3 \cdot 10^{-12} \lor \neg \left(y.re \leq 200\right):\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\end{array}
\end{array}
if y.re < -6.3000000000000002e-12 or 200 < y.re Initial program 37.3%
fma-neg37.3%
hypot-def37.3%
distribute-rgt-neg-out37.3%
fma-def37.3%
hypot-def71.5%
*-commutative71.5%
Simplified71.5%
Taylor expanded in y.im around inf 38.4%
unpow238.4%
unpow238.4%
hypot-def75.0%
Simplified75.0%
Taylor expanded in y.im around 0 76.6%
Taylor expanded in y.im around 0 69.5%
unpow269.5%
unpow269.5%
hypot-def70.3%
Simplified70.3%
if -6.3000000000000002e-12 < y.re < 200Initial program 36.1%
Taylor expanded in y.im around 0 47.0%
Taylor expanded in x.re around 0 44.7%
Taylor expanded in y.re around 0 44.7%
unpow244.7%
unpow244.7%
swap-sqr44.7%
unpow244.7%
Simplified44.7%
Taylor expanded in y.re around 0 81.9%
distribute-rgt-neg-in81.9%
Simplified81.9%
Final simplification76.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -1.6)
(pow x.im y.re)
(if (<= y.re 1.6e+14)
(exp (* (atan2 x.im x.re) (- y.im)))
(pow (- 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_re <= -1.6) {
tmp = pow(x_46_im, y_46_re);
} else if (y_46_re <= 1.6e+14) {
tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = pow(-x_46_im, y_46_re);
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-1.6d0)) then
tmp = x_46im ** y_46re
else if (y_46re <= 1.6d+14) then
tmp = exp((atan2(x_46im, x_46re) * -y_46im))
else
tmp = -x_46im ** y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -1.6) {
tmp = Math.pow(x_46_im, y_46_re);
} else if (y_46_re <= 1.6e+14) {
tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = Math.pow(-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_re <= -1.6: tmp = math.pow(x_46_im, y_46_re) elif y_46_re <= 1.6e+14: tmp = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im)) else: tmp = math.pow(-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_re <= -1.6) tmp = x_46_im ^ y_46_re; elseif (y_46_re <= 1.6e+14) tmp = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im))); else tmp = Float64(-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_re <= -1.6) tmp = x_46_im ^ y_46_re; elseif (y_46_re <= 1.6e+14) tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im)); else tmp = -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[LessEqual[y$46$re, -1.6], N[Power[x$46$im, y$46$re], $MachinePrecision], If[LessEqual[y$46$re, 1.6e+14], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision], N[Power[(-x$46$im), y$46$re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -1.6:\\
\;\;\;\;{x.im}^{y.re}\\
\mathbf{elif}\;y.re \leq 1.6 \cdot 10^{+14}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(-x.im\right)}^{y.re}\\
\end{array}
\end{array}
if y.re < -1.6000000000000001Initial program 34.3%
fma-neg34.3%
hypot-def34.3%
distribute-rgt-neg-out34.3%
fma-def34.3%
hypot-def79.6%
*-commutative79.6%
Simplified79.6%
Taylor expanded in y.im around inf 37.5%
unpow237.5%
unpow237.5%
hypot-def82.8%
Simplified82.8%
Taylor expanded in y.im around 0 82.8%
Taylor expanded in y.im around 0 79.8%
+-commutative79.8%
Simplified79.8%
Taylor expanded in x.re around 0 65.9%
if -1.6000000000000001 < y.re < 1.6e14Initial program 36.8%
Taylor expanded in y.im around 0 47.5%
Taylor expanded in x.re around 0 43.8%
Taylor expanded in y.re around 0 43.8%
unpow243.8%
unpow243.8%
swap-sqr43.8%
unpow243.8%
Simplified43.8%
Taylor expanded in y.re around 0 80.8%
distribute-rgt-neg-in80.8%
Simplified80.8%
if 1.6e14 < y.re Initial program 39.3%
fma-neg39.3%
hypot-def39.3%
distribute-rgt-neg-out39.3%
fma-def39.3%
hypot-def60.7%
*-commutative60.7%
Simplified60.7%
Taylor expanded in y.im around inf 39.3%
unpow239.3%
unpow239.3%
hypot-def66.1%
Simplified66.1%
Taylor expanded in y.im around 0 69.6%
Taylor expanded in y.im around 0 59.1%
+-commutative59.1%
Simplified59.1%
Taylor expanded in x.im around -inf 48.7%
mul-1-neg48.7%
Simplified48.7%
Final simplification70.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.im -1.35e-97) (pow (- x.im) y.re) (if (<= x.im 6e-220) (pow (- x.re) y.re) (pow 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 (x_46_im <= -1.35e-97) {
tmp = pow(-x_46_im, y_46_re);
} else if (x_46_im <= 6e-220) {
tmp = pow(-x_46_re, y_46_re);
} else {
tmp = pow(x_46_im, y_46_re);
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (x_46im <= (-1.35d-97)) then
tmp = -x_46im ** y_46re
else if (x_46im <= 6d-220) then
tmp = -x_46re ** y_46re
else
tmp = x_46im ** y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_im <= -1.35e-97) {
tmp = Math.pow(-x_46_im, y_46_re);
} else if (x_46_im <= 6e-220) {
tmp = Math.pow(-x_46_re, y_46_re);
} else {
tmp = Math.pow(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 x_46_im <= -1.35e-97: tmp = math.pow(-x_46_im, y_46_re) elif x_46_im <= 6e-220: tmp = math.pow(-x_46_re, y_46_re) else: tmp = math.pow(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 (x_46_im <= -1.35e-97) tmp = Float64(-x_46_im) ^ y_46_re; elseif (x_46_im <= 6e-220) tmp = Float64(-x_46_re) ^ y_46_re; else tmp = 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 (x_46_im <= -1.35e-97) tmp = -x_46_im ^ y_46_re; elseif (x_46_im <= 6e-220) tmp = -x_46_re ^ y_46_re; else tmp = 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[LessEqual[x$46$im, -1.35e-97], N[Power[(-x$46$im), y$46$re], $MachinePrecision], If[LessEqual[x$46$im, 6e-220], N[Power[(-x$46$re), y$46$re], $MachinePrecision], N[Power[x$46$im, y$46$re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.35 \cdot 10^{-97}:\\
\;\;\;\;{\left(-x.im\right)}^{y.re}\\
\mathbf{elif}\;x.im \leq 6 \cdot 10^{-220}:\\
\;\;\;\;{\left(-x.re\right)}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;{x.im}^{y.re}\\
\end{array}
\end{array}
if x.im < -1.34999999999999993e-97Initial program 32.6%
fma-neg32.6%
hypot-def32.6%
distribute-rgt-neg-out32.6%
fma-def32.6%
hypot-def75.5%
*-commutative75.5%
Simplified75.5%
Taylor expanded in y.im around inf 36.8%
unpow236.8%
unpow236.8%
hypot-def78.6%
Simplified78.6%
Taylor expanded in y.im around 0 79.8%
Taylor expanded in y.im around 0 49.2%
+-commutative49.2%
Simplified49.2%
Taylor expanded in x.im around -inf 55.2%
mul-1-neg55.2%
Simplified55.2%
if -1.34999999999999993e-97 < x.im < 6.00000000000000035e-220Initial program 42.6%
fma-neg42.6%
hypot-def42.6%
distribute-rgt-neg-out42.6%
fma-def42.6%
hypot-def76.0%
*-commutative76.0%
Simplified76.0%
Taylor expanded in y.im around inf 39.7%
unpow239.7%
unpow239.7%
hypot-def73.2%
Simplified73.2%
Taylor expanded in y.im around 0 72.0%
Taylor expanded in y.im around 0 56.7%
+-commutative56.7%
Simplified56.7%
Taylor expanded in x.re around -inf 50.0%
mul-1-neg50.0%
Simplified50.0%
if 6.00000000000000035e-220 < x.im Initial program 37.1%
fma-neg37.1%
hypot-def37.1%
distribute-rgt-neg-out37.1%
fma-def37.1%
hypot-def76.2%
*-commutative76.2%
Simplified76.2%
Taylor expanded in y.im around inf 36.3%
unpow236.3%
unpow236.3%
hypot-def79.0%
Simplified79.0%
Taylor expanded in y.im around 0 82.5%
Taylor expanded in y.im around 0 52.3%
+-commutative52.3%
Simplified52.3%
Taylor expanded in x.re around 0 59.3%
Final simplification55.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.im -1.6e-215) (pow (- x.im) y.re) (if (<= x.im 1.9e-280) (pow x.re y.re) (pow 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 (x_46_im <= -1.6e-215) {
tmp = pow(-x_46_im, y_46_re);
} else if (x_46_im <= 1.9e-280) {
tmp = pow(x_46_re, y_46_re);
} else {
tmp = pow(x_46_im, y_46_re);
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (x_46im <= (-1.6d-215)) then
tmp = -x_46im ** y_46re
else if (x_46im <= 1.9d-280) then
tmp = x_46re ** y_46re
else
tmp = x_46im ** y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_im <= -1.6e-215) {
tmp = Math.pow(-x_46_im, y_46_re);
} else if (x_46_im <= 1.9e-280) {
tmp = Math.pow(x_46_re, y_46_re);
} else {
tmp = Math.pow(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 x_46_im <= -1.6e-215: tmp = math.pow(-x_46_im, y_46_re) elif x_46_im <= 1.9e-280: tmp = math.pow(x_46_re, y_46_re) else: tmp = math.pow(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 (x_46_im <= -1.6e-215) tmp = Float64(-x_46_im) ^ y_46_re; elseif (x_46_im <= 1.9e-280) tmp = x_46_re ^ y_46_re; else tmp = 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 (x_46_im <= -1.6e-215) tmp = -x_46_im ^ y_46_re; elseif (x_46_im <= 1.9e-280) tmp = x_46_re ^ y_46_re; else tmp = 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[LessEqual[x$46$im, -1.6e-215], N[Power[(-x$46$im), y$46$re], $MachinePrecision], If[LessEqual[x$46$im, 1.9e-280], N[Power[x$46$re, y$46$re], $MachinePrecision], N[Power[x$46$im, y$46$re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq -1.6 \cdot 10^{-215}:\\
\;\;\;\;{\left(-x.im\right)}^{y.re}\\
\mathbf{elif}\;x.im \leq 1.9 \cdot 10^{-280}:\\
\;\;\;\;{x.re}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;{x.im}^{y.re}\\
\end{array}
\end{array}
if x.im < -1.6000000000000001e-215Initial program 36.1%
fma-neg36.1%
hypot-def36.1%
distribute-rgt-neg-out36.1%
fma-def36.1%
hypot-def76.1%
*-commutative76.1%
Simplified76.1%
Taylor expanded in y.im around inf 38.7%
unpow238.7%
unpow238.7%
hypot-def77.8%
Simplified77.8%
Taylor expanded in y.im around 0 76.2%
Taylor expanded in y.im around 0 47.1%
+-commutative47.1%
Simplified47.1%
Taylor expanded in x.im around -inf 51.4%
mul-1-neg51.4%
Simplified51.4%
if -1.6000000000000001e-215 < x.im < 1.9000000000000001e-280Initial program 31.8%
fma-neg31.8%
hypot-def31.8%
distribute-rgt-neg-out31.8%
fma-def31.8%
hypot-def72.8%
*-commutative72.8%
Simplified72.8%
Taylor expanded in y.im around inf 36.4%
unpow236.4%
unpow236.4%
hypot-def77.3%
Simplified77.3%
Taylor expanded in y.im around 0 82.6%
Taylor expanded in y.im around 0 77.1%
+-commutative77.1%
Simplified77.1%
Taylor expanded in x.re around inf 64.4%
if 1.9000000000000001e-280 < x.im Initial program 38.0%
fma-neg38.0%
hypot-def38.0%
distribute-rgt-neg-out38.0%
fma-def38.0%
hypot-def76.3%
*-commutative76.3%
Simplified76.3%
Taylor expanded in y.im around inf 36.1%
unpow236.1%
unpow236.1%
hypot-def77.5%
Simplified77.5%
Taylor expanded in y.im around 0 81.5%
Taylor expanded in y.im around 0 52.1%
+-commutative52.1%
Simplified52.1%
Taylor expanded in x.re around 0 58.2%
Final simplification55.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= x.re 8.5e-34) (pow x.im y.re) (pow x.re y.re)))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_re <= 8.5e-34) {
tmp = pow(x_46_im, y_46_re);
} else {
tmp = pow(x_46_re, y_46_re);
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (x_46re <= 8.5d-34) then
tmp = x_46im ** y_46re
else
tmp = x_46re ** y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (x_46_re <= 8.5e-34) {
tmp = Math.pow(x_46_im, y_46_re);
} else {
tmp = Math.pow(x_46_re, y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if x_46_re <= 8.5e-34: tmp = math.pow(x_46_im, y_46_re) else: tmp = math.pow(x_46_re, y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (x_46_re <= 8.5e-34) tmp = x_46_im ^ y_46_re; else tmp = 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) tmp = 0.0; if (x_46_re <= 8.5e-34) tmp = x_46_im ^ y_46_re; else tmp = x_46_re ^ y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[x$46$re, 8.5e-34], N[Power[x$46$im, y$46$re], $MachinePrecision], N[Power[x$46$re, y$46$re], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x.re \leq 8.5 \cdot 10^{-34}:\\
\;\;\;\;{x.im}^{y.re}\\
\mathbf{else}:\\
\;\;\;\;{x.re}^{y.re}\\
\end{array}
\end{array}
if x.re < 8.5000000000000001e-34Initial program 40.2%
fma-neg40.2%
hypot-def40.2%
distribute-rgt-neg-out40.2%
fma-def40.2%
hypot-def77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in y.im around inf 41.4%
unpow241.4%
unpow241.4%
hypot-def79.5%
Simplified79.5%
Taylor expanded in y.im around 0 79.5%
Taylor expanded in y.im around 0 52.4%
+-commutative52.4%
Simplified52.4%
Taylor expanded in x.re around 0 43.3%
if 8.5000000000000001e-34 < x.re Initial program 25.8%
fma-neg25.8%
hypot-def25.8%
distribute-rgt-neg-out25.8%
fma-def25.8%
hypot-def71.7%
*-commutative71.7%
Simplified71.7%
Taylor expanded in y.im around inf 24.2%
unpow224.2%
unpow224.2%
hypot-def71.7%
Simplified71.7%
Taylor expanded in y.im around 0 79.1%
Taylor expanded in y.im around 0 51.3%
+-commutative51.3%
Simplified51.3%
Taylor expanded in x.re around inf 65.0%
Final simplification48.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (pow x.im y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return pow(x_46_im, 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
code = x_46im ** y_46re
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.pow(x_46_im, y_46_re);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.pow(x_46_im, y_46_re)
function code(x_46_re, x_46_im, y_46_re, y_46_im) return x_46_im ^ y_46_re end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = x_46_im ^ y_46_re; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Power[x$46$im, y$46$re], $MachinePrecision]
\begin{array}{l}
\\
{x.im}^{y.re}
\end{array}
Initial program 36.7%
fma-neg36.7%
hypot-def36.7%
distribute-rgt-neg-out36.7%
fma-def36.7%
hypot-def75.9%
*-commutative75.9%
Simplified75.9%
Taylor expanded in y.im around inf 37.2%
unpow237.2%
unpow237.2%
hypot-def77.6%
Simplified77.6%
Taylor expanded in y.im around 0 79.4%
Taylor expanded in y.im around 0 52.2%
+-commutative52.2%
Simplified52.2%
Taylor expanded in x.re around 0 42.1%
Final simplification42.1%
herbie shell --seed 2023299
(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)))))