
(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 13 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.re x.im)))
(t_1 (exp (fma t_0 y.re (* y.im (- (atan2 x.im x.re))))))
(t_2 (cbrt (fma y.im t_0 (* y.re (atan2 x.im x.re))))))
(if (<= y.im 3.9e+25)
(* t_1 (cos (* y.im (log (hypot x.im x.re)))))
(* t_1 (cos (* t_2 (pow t_2 2.0)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = log(hypot(x_46_re, x_46_im));
double t_1 = exp(fma(t_0, y_46_re, (y_46_im * -atan2(x_46_im, x_46_re))));
double t_2 = cbrt(fma(y_46_im, t_0, (y_46_re * atan2(x_46_im, x_46_re))));
double tmp;
if (y_46_im <= 3.9e+25) {
tmp = t_1 * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
} else {
tmp = t_1 * cos((t_2 * pow(t_2, 2.0)));
}
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 = exp(fma(t_0, y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))) t_2 = cbrt(fma(y_46_im, t_0, Float64(y_46_re * atan(x_46_im, x_46_re)))) tmp = 0.0 if (y_46_im <= 3.9e+25) tmp = Float64(t_1 * cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re))))); else tmp = Float64(t_1 * cos(Float64(t_2 * (t_2 ^ 2.0)))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(t$95$0 * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(y$46$im * t$95$0 + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[y$46$im, 3.9e+25], N[(t$95$1 * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Cos[N[(t$95$2 * N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_1 := e^{\mathsf{fma}\left(t_0, y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\\
t_2 := \sqrt[3]{\mathsf{fma}\left(y.im, t_0, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}\\
\mathbf{if}\;y.im \leq 3.9 \cdot 10^{+25}:\\
\;\;\;\;t_1 \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \cos \left(t_2 \cdot {t_2}^{2}\right)\\
\end{array}
\end{array}
if y.im < 3.9000000000000002e25Initial program 43.6%
cancel-sign-sub-inv43.6%
fma-def43.6%
hypot-def43.6%
distribute-lft-neg-in43.6%
distribute-rgt-neg-out43.6%
fma-def43.6%
hypot-def83.0%
*-commutative83.0%
Simplified83.0%
add-cube-cbrt83.5%
pow283.5%
fma-udef83.5%
*-commutative83.5%
*-commutative83.5%
fma-def83.5%
fma-udef83.5%
*-commutative83.5%
*-commutative83.5%
fma-def83.5%
Applied egg-rr83.5%
Taylor expanded in y.re around 0 44.7%
unpow244.7%
unpow244.7%
hypot-def86.7%
Simplified86.7%
if 3.9000000000000002e25 < y.im Initial program 40.0%
cancel-sign-sub-inv40.0%
fma-def40.0%
hypot-def40.0%
distribute-lft-neg-in40.0%
distribute-rgt-neg-out40.0%
fma-def40.0%
hypot-def61.3%
*-commutative61.3%
Simplified61.3%
add-cube-cbrt80.0%
pow280.0%
fma-udef80.0%
*-commutative80.0%
*-commutative80.0%
fma-def80.0%
fma-udef80.0%
*-commutative80.0%
*-commutative80.0%
fma-def80.0%
Applied egg-rr80.0%
Final simplification85.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (log (hypot x.re x.im)))
(t_2 (exp (fma t_1 y.re (* y.im (- (atan2 x.im x.re)))))))
(if (<= x.im -3.9e-56)
(*
t_2
(cos
(*
(cbrt (fma y.im t_1 t_0))
(pow (cbrt (- t_0 (* y.im (log (/ -1.0 x.im))))) 2.0))))
(* t_2 (cos (* y.im (log (hypot x.im x.re))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = log(hypot(x_46_re, x_46_im));
double t_2 = exp(fma(t_1, y_46_re, (y_46_im * -atan2(x_46_im, x_46_re))));
double tmp;
if (x_46_im <= -3.9e-56) {
tmp = t_2 * cos((cbrt(fma(y_46_im, t_1, t_0)) * pow(cbrt((t_0 - (y_46_im * log((-1.0 / x_46_im))))), 2.0)));
} else {
tmp = t_2 * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = log(hypot(x_46_re, x_46_im)) t_2 = exp(fma(t_1, y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))) tmp = 0.0 if (x_46_im <= -3.9e-56) tmp = Float64(t_2 * cos(Float64(cbrt(fma(y_46_im, t_1, t_0)) * (cbrt(Float64(t_0 - Float64(y_46_im * log(Float64(-1.0 / x_46_im))))) ^ 2.0)))); else tmp = Float64(t_2 * cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re))))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(t$95$1 * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -3.9e-56], N[(t$95$2 * N[Cos[N[(N[Power[N[(y$46$im * t$95$1 + t$95$0), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[Power[N[(t$95$0 - N[(y$46$im * N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_2 := e^{\mathsf{fma}\left(t_1, y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\\
\mathbf{if}\;x.im \leq -3.9 \cdot 10^{-56}:\\
\;\;\;\;t_2 \cdot \cos \left(\sqrt[3]{\mathsf{fma}\left(y.im, t_1, t_0\right)} \cdot {\left(\sqrt[3]{t_0 - y.im \cdot \log \left(\frac{-1}{x.im}\right)}\right)}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\end{array}
\end{array}
if x.im < -3.9e-56Initial program 21.6%
cancel-sign-sub-inv21.6%
fma-def21.6%
hypot-def21.6%
distribute-lft-neg-in21.6%
distribute-rgt-neg-out21.6%
fma-def21.6%
hypot-def68.9%
*-commutative68.9%
Simplified68.9%
add-cube-cbrt84.0%
pow284.0%
fma-udef84.0%
*-commutative84.0%
*-commutative84.0%
fma-def84.0%
fma-udef84.0%
*-commutative84.0%
*-commutative84.0%
fma-def84.0%
Applied egg-rr84.0%
Taylor expanded in x.im around -inf 33.8%
unpow1/385.4%
+-commutative85.4%
mul-1-neg85.4%
unsub-neg85.4%
Simplified85.4%
if -3.9e-56 < x.im Initial program 51.3%
cancel-sign-sub-inv51.3%
fma-def51.3%
hypot-def51.3%
distribute-lft-neg-in51.3%
distribute-rgt-neg-out51.3%
fma-def51.3%
hypot-def81.2%
*-commutative81.2%
Simplified81.2%
add-cube-cbrt82.1%
pow282.1%
fma-udef82.1%
*-commutative82.1%
*-commutative82.1%
fma-def82.1%
fma-udef82.1%
*-commutative82.1%
*-commutative82.1%
fma-def82.1%
Applied egg-rr82.1%
Taylor expanded in y.re around 0 51.9%
unpow251.9%
unpow251.9%
hypot-def82.9%
Simplified82.9%
Final simplification83.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (log (hypot x.re x.im)))
(t_2 (exp (fma t_1 y.re (* y.im (- (atan2 x.im x.re)))))))
(if (<= x.im -6e-308)
(*
t_2
(cos
(*
(pow (cbrt (fma y.im t_1 t_0)) 2.0)
(cbrt (- t_0 (* y.im (log (/ -1.0 x.im))))))))
(* t_2 (cos (* y.im (log (hypot x.im x.re))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = log(hypot(x_46_re, x_46_im));
double t_2 = exp(fma(t_1, y_46_re, (y_46_im * -atan2(x_46_im, x_46_re))));
double tmp;
if (x_46_im <= -6e-308) {
tmp = t_2 * cos((pow(cbrt(fma(y_46_im, t_1, t_0)), 2.0) * cbrt((t_0 - (y_46_im * log((-1.0 / x_46_im)))))));
} else {
tmp = t_2 * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = log(hypot(x_46_re, x_46_im)) t_2 = exp(fma(t_1, y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))) tmp = 0.0 if (x_46_im <= -6e-308) tmp = Float64(t_2 * cos(Float64((cbrt(fma(y_46_im, t_1, t_0)) ^ 2.0) * cbrt(Float64(t_0 - Float64(y_46_im * log(Float64(-1.0 / x_46_im)))))))); else tmp = Float64(t_2 * cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re))))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(t$95$1 * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x$46$im, -6e-308], N[(t$95$2 * N[Cos[N[(N[Power[N[Power[N[(y$46$im * t$95$1 + t$95$0), $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision] * N[Power[N[(t$95$0 - N[(y$46$im * N[Log[N[(-1.0 / x$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
t_2 := e^{\mathsf{fma}\left(t_1, y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\\
\mathbf{if}\;x.im \leq -6 \cdot 10^{-308}:\\
\;\;\;\;t_2 \cdot \cos \left({\left(\sqrt[3]{\mathsf{fma}\left(y.im, t_1, t_0\right)}\right)}^{2} \cdot \sqrt[3]{t_0 - y.im \cdot \log \left(\frac{-1}{x.im}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\
\end{array}
\end{array}
if x.im < -6.00000000000000044e-308Initial program 33.0%
cancel-sign-sub-inv33.0%
fma-def33.0%
hypot-def33.0%
distribute-lft-neg-in33.0%
distribute-rgt-neg-out33.0%
fma-def33.0%
hypot-def73.0%
*-commutative73.0%
Simplified73.0%
add-cube-cbrt83.5%
pow283.5%
fma-udef83.5%
*-commutative83.5%
*-commutative83.5%
fma-def83.5%
fma-udef83.5%
*-commutative83.5%
*-commutative83.5%
fma-def83.5%
Applied egg-rr83.5%
Taylor expanded in x.im around -inf 38.4%
unpow1/381.3%
+-commutative81.3%
mul-1-neg81.3%
unsub-neg81.3%
Simplified84.5%
if -6.00000000000000044e-308 < x.im Initial program 52.1%
cancel-sign-sub-inv52.1%
fma-def52.1%
hypot-def52.1%
distribute-lft-neg-in52.1%
distribute-rgt-neg-out52.1%
fma-def52.1%
hypot-def82.2%
*-commutative82.2%
Simplified82.2%
add-cube-cbrt81.8%
pow281.8%
fma-udef81.8%
*-commutative81.8%
*-commutative81.8%
fma-def81.8%
fma-udef81.8%
*-commutative81.8%
*-commutative81.8%
fma-def81.8%
Applied egg-rr81.8%
Taylor expanded in y.re around 0 52.8%
unpow252.8%
unpow252.8%
hypot-def84.4%
Simplified84.4%
Final simplification84.5%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (exp (fma (log (hypot x.re x.im)) y.re (* y.im (- (atan2 x.im x.re))))) (fabs (cos (fma y.im (log (hypot x.im x.re)) (* y.re (atan2 x.im x.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (y_46_im * -atan2(x_46_im, x_46_re)))) * fabs(cos(fma(y_46_im, log(hypot(x_46_im, x_46_re)), (y_46_re * atan2(x_46_im, x_46_re)))));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))) * abs(cos(fma(y_46_im, log(hypot(x_46_im, x_46_re)), 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_] := N[(N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Abs[N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision] + N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \cdot \left|\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right|
\end{array}
Initial program 42.7%
cancel-sign-sub-inv42.7%
fma-def42.7%
hypot-def42.7%
distribute-lft-neg-in42.7%
distribute-rgt-neg-out42.7%
fma-def42.7%
hypot-def77.7%
*-commutative77.7%
Simplified77.7%
add-cube-cbrt82.7%
pow282.7%
fma-udef82.7%
*-commutative82.7%
*-commutative82.7%
fma-def82.7%
fma-udef82.7%
*-commutative82.7%
*-commutative82.7%
fma-def82.7%
Applied egg-rr82.7%
unpow282.7%
add-cube-cbrt77.7%
add-sqr-sqrt53.7%
sqrt-unprod81.2%
pow281.2%
Applied egg-rr81.2%
unpow281.2%
rem-sqrt-square81.2%
*-commutative81.2%
hypot-def43.5%
unpow243.5%
unpow243.5%
+-commutative43.5%
unpow243.5%
unpow243.5%
hypot-def81.2%
Simplified81.2%
Final simplification81.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))) (t_1 (log (hypot x.im x.re))))
(if (<= y.im 1e+98)
(*
(exp (fma (log (hypot x.re x.im)) y.re (* y.im (- (atan2 x.im x.re)))))
(cos (* y.im t_1)))
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* y.im (atan2 x.im x.re))))
(- (cos t_0) (* t_1 (* y.im (sin t_0))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = log(hypot(x_46_im, x_46_re));
double tmp;
if (y_46_im <= 1e+98) {
tmp = exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (y_46_im * -atan2(x_46_im, x_46_re)))) * cos((y_46_im * t_1));
} else {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (y_46_im * atan2(x_46_im, x_46_re)))) * (cos(t_0) - (t_1 * (y_46_im * sin(t_0))));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = log(hypot(x_46_im, x_46_re)) tmp = 0.0 if (y_46_im <= 1e+98) tmp = Float64(exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))) * cos(Float64(y_46_im * t_1))); else tmp = Float64(exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - Float64(y_46_im * atan(x_46_im, x_46_re)))) * Float64(cos(t_0) - Float64(t_1 * Float64(y_46_im * sin(t_0))))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$im, 1e+98], N[(N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t$95$0], $MachinePrecision] - N[(t$95$1 * N[(y$46$im * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
\mathbf{if}\;y.im \leq 10^{+98}:\\
\;\;\;\;e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \cdot \cos \left(y.im \cdot t_1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \left(\cos t_0 - t_1 \cdot \left(y.im \cdot \sin t_0\right)\right)\\
\end{array}
\end{array}
if y.im < 9.99999999999999998e97Initial program 42.1%
cancel-sign-sub-inv42.1%
fma-def42.1%
hypot-def42.1%
distribute-lft-neg-in42.1%
distribute-rgt-neg-out42.1%
fma-def42.1%
hypot-def81.0%
*-commutative81.0%
Simplified81.0%
add-cube-cbrt82.9%
pow282.9%
fma-udef82.9%
*-commutative82.9%
*-commutative82.9%
fma-def82.9%
fma-udef82.9%
*-commutative82.9%
*-commutative82.9%
fma-def82.9%
Applied egg-rr82.9%
Taylor expanded in y.re around 0 43.1%
unpow243.1%
unpow243.1%
hypot-def84.4%
Simplified84.4%
if 9.99999999999999998e97 < y.im Initial program 45.3%
Taylor expanded in y.im around 0 59.2%
*-commutative59.2%
mul-1-neg59.2%
unsub-neg59.2%
*-commutative59.2%
associate-*r*59.2%
*-commutative59.2%
*-commutative59.2%
associate-*l*59.2%
unpow259.2%
unpow259.2%
hypot-def71.7%
Simplified71.7%
Final simplification82.0%
(FPCore (x.re x.im y.re y.im) :precision binary64 (* (exp (fma (log (hypot x.re x.im)) y.re (* y.im (- (atan2 x.im x.re))))) (cos (* y.im (log (hypot x.im x.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, (y_46_im * -atan2(x_46_im, x_46_re)))) * cos((y_46_im * log(hypot(x_46_im, x_46_re))));
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(exp(fma(log(hypot(x_46_re, x_46_im)), y_46_re, Float64(y_46_im * Float64(-atan(x_46_im, x_46_re))))) * cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re))))) end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Exp[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$re + N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re, y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \cdot \cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)
\end{array}
Initial program 42.7%
cancel-sign-sub-inv42.7%
fma-def42.7%
hypot-def42.7%
distribute-lft-neg-in42.7%
distribute-rgt-neg-out42.7%
fma-def42.7%
hypot-def77.7%
*-commutative77.7%
Simplified77.7%
add-cube-cbrt82.7%
pow282.7%
fma-udef82.7%
*-commutative82.7%
*-commutative82.7%
fma-def82.7%
fma-udef82.7%
*-commutative82.7%
*-commutative82.7%
fma-def82.7%
Applied egg-rr82.7%
Taylor expanded in y.re around 0 43.1%
unpow243.1%
unpow243.1%
hypot-def80.0%
Simplified80.0%
Final simplification80.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (atan2 x.im x.re))))
(if (<= y.im 3.5e+164)
(exp (- (log (pow (hypot x.re x.im) y.re)) t_0))
(*
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_0))
(cos (* y.re (atan2 x.im x.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_im <= 3.5e+164) {
tmp = exp((log(pow(hypot(x_46_re, x_46_im), y_46_re)) - t_0));
} else {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)) * cos((y_46_re * atan2(x_46_im, x_46_re)));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * Math.atan2(x_46_im, x_46_re);
double tmp;
if (y_46_im <= 3.5e+164) {
tmp = Math.exp((Math.log(Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re)) - t_0));
} else {
tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)) * Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_im * math.atan2(x_46_im, x_46_re) tmp = 0 if y_46_im <= 3.5e+164: tmp = math.exp((math.log(math.pow(math.hypot(x_46_re, x_46_im), y_46_re)) - t_0)) else: tmp = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)) * math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_im * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_im <= 3.5e+164) tmp = exp(Float64(log((hypot(x_46_re, x_46_im) ^ y_46_re)) - t_0)); else tmp = Float64(exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - t_0)) * cos(Float64(y_46_re * atan(x_46_im, x_46_re)))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_im * atan2(x_46_im, x_46_re); tmp = 0.0; if (y_46_im <= 3.5e+164) tmp = exp((log((hypot(x_46_re, x_46_im) ^ y_46_re)) - t_0)); else tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)) * cos((y_46_re * atan2(x_46_im, x_46_re))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, 3.5e+164], N[Exp[N[(N[Log[N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.im \leq 3.5 \cdot 10^{+164}:\\
\;\;\;\;e^{\log \left({\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\right) - t_0}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_0} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\end{array}
\end{array}
if y.im < 3.4999999999999998e164Initial program 40.5%
Taylor expanded in y.im around 0 60.3%
Taylor expanded in y.re around 0 64.7%
add-log-exp63.8%
hypot-udef79.7%
exp-to-pow79.7%
Applied egg-rr79.7%
if 3.4999999999999998e164 < y.im Initial program 60.0%
Taylor expanded in y.im around 0 73.5%
Final simplification79.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (atan2 x.im x.re))))
(if (<= x.im 1.65e-97)
(exp (- (log (pow (hypot x.re x.im) y.re)) t_0))
(* (cos (* y.re (atan2 x.im x.re))) (exp (- (* y.re (log x.im)) t_0))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_im <= 1.65e-97) {
tmp = exp((log(pow(hypot(x_46_re, x_46_im), y_46_re)) - t_0));
} else {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * exp(((y_46_re * log(x_46_im)) - t_0));
}
return tmp;
}
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_im * Math.atan2(x_46_im, x_46_re);
double tmp;
if (x_46_im <= 1.65e-97) {
tmp = Math.exp((Math.log(Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re)) - t_0));
} else {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.exp(((y_46_re * Math.log(x_46_im)) - t_0));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_im * math.atan2(x_46_im, x_46_re) tmp = 0 if x_46_im <= 1.65e-97: tmp = math.exp((math.log(math.pow(math.hypot(x_46_re, x_46_im), y_46_re)) - t_0)) else: tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.exp(((y_46_re * math.log(x_46_im)) - t_0)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_im * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_im <= 1.65e-97) tmp = exp(Float64(log((hypot(x_46_re, x_46_im) ^ y_46_re)) - t_0)); else tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * exp(Float64(Float64(y_46_re * log(x_46_im)) - t_0))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_im * atan2(x_46_im, x_46_re); tmp = 0.0; if (x_46_im <= 1.65e-97) tmp = exp((log((hypot(x_46_re, x_46_im) ^ y_46_re)) - t_0)); else tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * exp(((y_46_re * log(x_46_im)) - t_0)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, 1.65e-97], N[Exp[N[(N[Log[N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]], $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.im \leq 1.65 \cdot 10^{-97}:\\
\;\;\;\;e^{\log \left({\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\right) - t_0}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log x.im - t_0}\\
\end{array}
\end{array}
if x.im < 1.6500000000000001e-97Initial program 37.4%
Taylor expanded in y.im around 0 56.3%
Taylor expanded in y.re around 0 62.3%
add-log-exp59.9%
hypot-udef75.5%
exp-to-pow75.5%
Applied egg-rr75.5%
if 1.6500000000000001e-97 < x.im Initial program 52.8%
Taylor expanded in y.im around 0 72.2%
Taylor expanded in x.re around 0 83.5%
Final simplification78.3%
(FPCore (x.re x.im y.re y.im) :precision binary64 (exp (- (log (pow (hypot x.re x.im) y.re)) (* y.im (atan2 x.im x.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return exp((log(pow(hypot(x_46_re, x_46_im), y_46_re)) - (y_46_im * atan2(x_46_im, x_46_re))));
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.exp((Math.log(Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re)) - (y_46_im * Math.atan2(x_46_im, x_46_re))));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.exp((math.log(math.pow(math.hypot(x_46_re, x_46_im), y_46_re)) - (y_46_im * math.atan2(x_46_im, x_46_re))))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return exp(Float64(log((hypot(x_46_re, x_46_im) ^ y_46_re)) - Float64(y_46_im * atan(x_46_im, x_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = exp((log((hypot(x_46_re, x_46_im) ^ y_46_re)) - (y_46_im * atan2(x_46_im, x_46_re)))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Exp[N[(N[Log[N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]], $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\log \left({\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\right) - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}
\end{array}
Initial program 42.7%
Taylor expanded in y.im around 0 61.8%
Taylor expanded in y.re around 0 65.0%
add-log-exp62.3%
hypot-udef76.7%
exp-to-pow76.7%
Applied egg-rr76.7%
Final simplification76.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (atan2 x.im x.re))))
(if (<= x.re -2e+118)
(exp (- (* y.re (log (- x.re))) t_0))
(if (<= x.re 2.7e-56)
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_0))
(exp (- (* y.re (log x.re)) t_0))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -2e+118) {
tmp = exp(((y_46_re * log(-x_46_re)) - t_0));
} else if (x_46_re <= 2.7e-56) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
} else {
tmp = exp(((y_46_re * log(x_46_re)) - t_0));
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: tmp
t_0 = y_46im * atan2(x_46im, x_46re)
if (x_46re <= (-2d+118)) then
tmp = exp(((y_46re * log(-x_46re)) - t_0))
else if (x_46re <= 2.7d-56) then
tmp = exp(((y_46re * log(sqrt(((x_46re * x_46re) + (x_46im * x_46im))))) - t_0))
else
tmp = exp(((y_46re * log(x_46re)) - t_0))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * Math.atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= -2e+118) {
tmp = Math.exp(((y_46_re * Math.log(-x_46_re)) - t_0));
} else if (x_46_re <= 2.7e-56) {
tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
} else {
tmp = Math.exp(((y_46_re * Math.log(x_46_re)) - t_0));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_im * math.atan2(x_46_im, x_46_re) tmp = 0 if x_46_re <= -2e+118: tmp = math.exp(((y_46_re * math.log(-x_46_re)) - t_0)) elif x_46_re <= 2.7e-56: tmp = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)) else: tmp = math.exp(((y_46_re * math.log(x_46_re)) - t_0)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_im * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_re <= -2e+118) tmp = exp(Float64(Float64(y_46_re * log(Float64(-x_46_re))) - t_0)); elseif (x_46_re <= 2.7e-56) tmp = exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - t_0)); else tmp = exp(Float64(Float64(y_46_re * log(x_46_re)) - t_0)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_im * atan2(x_46_im, x_46_re); tmp = 0.0; if (x_46_re <= -2e+118) tmp = exp(((y_46_re * log(-x_46_re)) - t_0)); elseif (x_46_re <= 2.7e-56) tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)); else tmp = exp(((y_46_re * log(x_46_re)) - t_0)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -2e+118], N[Exp[N[(N[(y$46$re * N[Log[(-x$46$re)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], If[LessEqual[x$46$re, 2.7e-56], N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.re \leq -2 \cdot 10^{+118}:\\
\;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - t_0}\\
\mathbf{elif}\;x.re \leq 2.7 \cdot 10^{-56}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_0}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - t_0}\\
\end{array}
\end{array}
if x.re < -1.99999999999999993e118Initial program 11.1%
Taylor expanded in y.im around 0 53.6%
Taylor expanded in y.re around 0 53.6%
Taylor expanded in x.re around -inf 88.9%
mul-1-neg88.9%
Simplified88.9%
if -1.99999999999999993e118 < x.re < 2.69999999999999995e-56Initial program 58.1%
Taylor expanded in y.im around 0 71.1%
Taylor expanded in y.re around 0 75.1%
if 2.69999999999999995e-56 < x.re Initial program 27.0%
Taylor expanded in y.im around 0 47.0%
Taylor expanded in y.re around 0 49.7%
Taylor expanded in x.re around inf 77.3%
Final simplification77.7%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (atan2 x.im x.re))))
(if (<= x.im -5e-310)
(exp (- (* y.re (log (- x.im))) t_0))
(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 = y_46_im * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_im <= -5e-310) {
tmp = exp(((y_46_re * log(-x_46_im)) - t_0));
} else {
tmp = exp(((y_46_re * log(x_46_im)) - t_0));
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: tmp
t_0 = y_46im * atan2(x_46im, x_46re)
if (x_46im <= (-5d-310)) then
tmp = exp(((y_46re * log(-x_46im)) - t_0))
else
tmp = exp(((y_46re * log(x_46im)) - t_0))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * Math.atan2(x_46_im, x_46_re);
double tmp;
if (x_46_im <= -5e-310) {
tmp = Math.exp(((y_46_re * Math.log(-x_46_im)) - t_0));
} else {
tmp = 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 = y_46_im * math.atan2(x_46_im, x_46_re) tmp = 0 if x_46_im <= -5e-310: tmp = math.exp(((y_46_re * math.log(-x_46_im)) - t_0)) else: tmp = 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(y_46_im * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_im <= -5e-310) tmp = exp(Float64(Float64(y_46_re * log(Float64(-x_46_im))) - t_0)); else tmp = 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 = y_46_im * atan2(x_46_im, x_46_re); tmp = 0.0; if (x_46_im <= -5e-310) tmp = exp(((y_46_re * log(-x_46_im)) - t_0)); else tmp = 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[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$im, -5e-310], N[Exp[N[(N[(y$46$re * N[Log[(-x$46$im)], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.im \leq -5 \cdot 10^{-310}:\\
\;\;\;\;e^{y.re \cdot \log \left(-x.im\right) - t_0}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.im - t_0}\\
\end{array}
\end{array}
if x.im < -4.999999999999985e-310Initial program 33.0%
Taylor expanded in y.im around 0 55.2%
Taylor expanded in y.re around 0 60.0%
Taylor expanded in x.im around -inf 74.3%
mul-1-neg74.3%
Simplified74.3%
if -4.999999999999985e-310 < x.im Initial program 52.1%
Taylor expanded in y.im around 0 68.2%
Taylor expanded in y.re around 0 69.7%
Taylor expanded in x.re around 0 74.4%
Final simplification74.3%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (atan2 x.im x.re))))
(if (<= x.re 3.15e-254)
(exp (- (* y.re (log x.im)) t_0))
(exp (- (* y.re (log x.re)) t_0)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= 3.15e-254) {
tmp = exp(((y_46_re * log(x_46_im)) - t_0));
} else {
tmp = exp(((y_46_re * log(x_46_re)) - t_0));
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: t_0
real(8) :: tmp
t_0 = y_46im * atan2(x_46im, x_46re)
if (x_46re <= 3.15d-254) then
tmp = exp(((y_46re * log(x_46im)) - t_0))
else
tmp = exp(((y_46re * log(x_46re)) - t_0))
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * Math.atan2(x_46_im, x_46_re);
double tmp;
if (x_46_re <= 3.15e-254) {
tmp = Math.exp(((y_46_re * Math.log(x_46_im)) - t_0));
} else {
tmp = Math.exp(((y_46_re * Math.log(x_46_re)) - t_0));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_im * math.atan2(x_46_im, x_46_re) tmp = 0 if x_46_re <= 3.15e-254: tmp = math.exp(((y_46_re * math.log(x_46_im)) - t_0)) else: tmp = math.exp(((y_46_re * math.log(x_46_re)) - t_0)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_im * atan(x_46_im, x_46_re)) tmp = 0.0 if (x_46_re <= 3.15e-254) tmp = exp(Float64(Float64(y_46_re * log(x_46_im)) - t_0)); else tmp = exp(Float64(Float64(y_46_re * log(x_46_re)) - t_0)); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_im * atan2(x_46_im, x_46_re); tmp = 0.0; if (x_46_re <= 3.15e-254) tmp = exp(((y_46_re * log(x_46_im)) - t_0)); else tmp = exp(((y_46_re * log(x_46_re)) - t_0)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, 3.15e-254], N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(y$46$re * N[Log[x$46$re], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;x.re \leq 3.15 \cdot 10^{-254}:\\
\;\;\;\;e^{y.re \cdot \log x.im - t_0}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log x.re - t_0}\\
\end{array}
\end{array}
if x.re < 3.1500000000000001e-254Initial program 48.6%
Taylor expanded in y.im around 0 68.3%
Taylor expanded in y.re around 0 71.1%
Taylor expanded in x.re around 0 41.6%
if 3.1500000000000001e-254 < x.re Initial program 35.2%
Taylor expanded in y.im around 0 53.5%
Taylor expanded in y.re around 0 57.0%
Taylor expanded in x.re around inf 71.0%
Final simplification54.5%
(FPCore (x.re x.im y.re y.im) :precision binary64 (exp (- (* y.re (log x.im)) (* y.im (atan2 x.im x.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return exp(((y_46_re * log(x_46_im)) - (y_46_im * atan2(x_46_im, x_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 = exp(((y_46re * log(x_46im)) - (y_46im * atan2(x_46im, x_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.exp(((y_46_re * Math.log(x_46_im)) - (y_46_im * Math.atan2(x_46_im, x_46_re))));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.exp(((y_46_re * math.log(x_46_im)) - (y_46_im * math.atan2(x_46_im, x_46_re))))
function code(x_46_re, x_46_im, y_46_re, y_46_im) return exp(Float64(Float64(y_46_re * log(x_46_im)) - Float64(y_46_im * atan(x_46_im, x_46_re)))) end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = exp(((y_46_re * log(x_46_im)) - (y_46_im * atan2(x_46_im, x_46_re)))); end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Exp[N[(N[(y$46$re * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision] - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{y.re \cdot \log x.im - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}
\end{array}
Initial program 42.7%
Taylor expanded in y.im around 0 61.8%
Taylor expanded in y.re around 0 65.0%
Taylor expanded in x.re around 0 38.1%
Final simplification38.1%
herbie shell --seed 2024019
(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)))))