
(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 10 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 (* (exp (fma (log (hypot x.re x.im)) y.re (* (atan2 x.im x.re) (- y.im)))) (cbrt (pow (cos (* y.im (log (hypot x.im x.re)))) 3.0))))
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))) * cbrt(pow(cos((y_46_im * log(hypot(x_46_im, x_46_re)))), 3.0));
}
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(atan(x_46_im, x_46_re) * Float64(-y_46_im)))) * cbrt((cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) ^ 3.0))) 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[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Power[N[Power[N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision], 1/3], $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)} \cdot \sqrt[3]{{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}^{3}}
\end{array}
Initial program 38.7%
cancel-sign-sub-inv38.7%
fma-define38.7%
hypot-define38.7%
distribute-lft-neg-in38.7%
distribute-rgt-neg-out38.7%
fma-define38.7%
hypot-define81.7%
*-commutative81.7%
Simplified81.7%
Taylor expanded in y.re around inf 35.6%
+-commutative35.6%
associate-/l*35.8%
unpow235.8%
unpow235.8%
hypot-undefine72.0%
Simplified72.0%
add-cbrt-cube72.0%
pow372.0%
+-commutative72.0%
fma-define72.0%
hypot-undefine35.8%
+-commutative35.8%
hypot-define72.0%
Applied egg-rr72.0%
Taylor expanded in y.re around 0 40.6%
unpow240.6%
unpow240.6%
hypot-undefine84.0%
Simplified84.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* (atan2 x.im x.re) y.im))
(t_1 (* y.re (atan2 x.im x.re)))
(t_2 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_3 (exp (- (* y.re t_2) t_0)))
(t_4 (log (hypot x.im x.re))))
(if (<= (* t_3 (cos (+ (* y.im t_2) t_1))) (- INFINITY))
(* (cos (* y.im t_4)) t_3)
(*
(exp (* y.re (- t_4 (/ t_0 y.re))))
(cos (fma (log (hypot x.re x.im)) y.im t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = atan2(x_46_im, x_46_re) * y_46_im;
double t_1 = y_46_re * atan2(x_46_im, x_46_re);
double t_2 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_3 = exp(((y_46_re * t_2) - t_0));
double t_4 = log(hypot(x_46_im, x_46_re));
double tmp;
if ((t_3 * cos(((y_46_im * t_2) + t_1))) <= -((double) INFINITY)) {
tmp = cos((y_46_im * t_4)) * t_3;
} else {
tmp = exp((y_46_re * (t_4 - (t_0 / y_46_re)))) * cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_1));
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_1 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_2 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_3 = exp(Float64(Float64(y_46_re * t_2) - t_0)) t_4 = log(hypot(x_46_im, x_46_re)) tmp = 0.0 if (Float64(t_3 * cos(Float64(Float64(y_46_im * t_2) + t_1))) <= Float64(-Inf)) tmp = Float64(cos(Float64(y_46_im * t_4)) * t_3); else tmp = Float64(exp(Float64(y_46_re * Float64(t_4 - Float64(t_0 / y_46_re)))) * cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_1))); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$1 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Exp[N[(N[(y$46$re * t$95$2), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$3 * N[Cos[N[(N[(y$46$im * t$95$2), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(N[Cos[N[(y$46$im * t$95$4), $MachinePrecision]], $MachinePrecision] * t$95$3), $MachinePrecision], N[(N[Exp[N[(y$46$re * N[(t$95$4 - N[(t$95$0 / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im + t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_2 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_3 := e^{y.re \cdot t\_2 - t\_0}\\
t_4 := \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
\mathbf{if}\;t\_3 \cdot \cos \left(y.im \cdot t\_2 + t\_1\right) \leq -\infty:\\
\;\;\;\;\cos \left(y.im \cdot t\_4\right) \cdot t\_3\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \left(t\_4 - \frac{t\_0}{y.re}\right)} \cdot \cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t\_1\right)\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (*.f64 (atan2.f64 x.im x.re) y.im))) (cos.f64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im) (*.f64 (atan2.f64 x.im x.re) y.re)))) < -inf.0Initial program 34.6%
Taylor expanded in y.re around 0 53.8%
unpow253.8%
unpow253.8%
hypot-undefine53.8%
Simplified53.8%
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 39.2%
cancel-sign-sub-inv39.2%
fma-define39.2%
hypot-define39.2%
distribute-lft-neg-in39.2%
distribute-rgt-neg-out39.2%
fma-define39.2%
hypot-define87.0%
*-commutative87.0%
Simplified87.0%
Taylor expanded in y.re around inf 64.5%
unpow264.5%
unpow264.5%
hypot-undefine87.0%
associate-*r/87.0%
neg-mul-187.0%
distribute-lft-neg-in87.0%
Simplified87.0%
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
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))))
(if (<= y.re -4.4e-12)
(* t_1 (cos t_0))
(if (<= y.re 5500000.0)
(*
(cos (fma (log (hypot x.re x.im)) y.im t_0))
(exp (* (atan2 x.im x.re) (- y.im))))
(* (cos (* 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 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im)));
double tmp;
if (y_46_re <= -4.4e-12) {
tmp = t_1 * cos(t_0);
} else if (y_46_re <= 5500000.0) {
tmp = cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_0)) * exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) * t_1;
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - Float64(atan(x_46_im, x_46_re) * y_46_im))) tmp = 0.0 if (y_46_re <= -4.4e-12) tmp = Float64(t_1 * cos(t_0)); elseif (y_46_re <= 5500000.0) tmp = Float64(cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_0)) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))); else tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) * t_1); end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -4.4e-12], N[(t$95$1 * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 5500000.0], N[(N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im + t$95$0), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{if}\;y.re \leq -4.4 \cdot 10^{-12}:\\
\;\;\;\;t\_1 \cdot \cos t\_0\\
\mathbf{elif}\;y.re \leq 5500000:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t\_0\right)\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right) \cdot t\_1\\
\end{array}
\end{array}
if y.re < -4.39999999999999983e-12Initial program 42.1%
Taylor expanded in y.im around 0 86.3%
if -4.39999999999999983e-12 < y.re < 5.5e6Initial program 38.8%
exp-diff38.8%
exp-to-pow38.8%
hypot-define38.8%
*-commutative38.8%
exp-prod38.8%
fma-define38.8%
hypot-define88.0%
*-commutative88.0%
Simplified88.0%
Taylor expanded in y.re around 0 87.9%
rec-exp87.9%
distribute-lft-neg-in87.9%
Simplified87.9%
if 5.5e6 < y.re Initial program 35.4%
Taylor expanded in y.re around 0 43.1%
unpow243.1%
unpow243.1%
hypot-undefine73.9%
Simplified73.9%
Final simplification84.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re))))
(if (<= y.re -4.4e-12)
(*
(exp
(-
(* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(* (atan2 x.im x.re) y.im)))
(cos t_0))
(if (<= y.re 3900000.0)
(*
(cos (fma (log (hypot x.re x.im)) y.im t_0))
(exp (* (atan2 x.im x.re) (- y.im))))
(pow (hypot x.im x.re) y.re)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double tmp;
if (y_46_re <= -4.4e-12) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(t_0);
} else if (y_46_re <= 3900000.0) {
tmp = cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_0)) * exp((atan2(x_46_im, x_46_re) * -y_46_im));
} else {
tmp = pow(hypot(x_46_im, x_46_re), y_46_re);
}
return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) tmp = 0.0 if (y_46_re <= -4.4e-12) tmp = Float64(exp(Float64(Float64(y_46_re * log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im))))) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(t_0)); elseif (y_46_re <= 3900000.0) tmp = Float64(cos(fma(log(hypot(x_46_re, x_46_im)), y_46_im, t_0)) * exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)))); else tmp = hypot(x_46_im, x_46_re) ^ y_46_re; end return tmp end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -4.4e-12], N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 3900000.0], N[(N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im + t$95$0), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{if}\;y.re \leq -4.4 \cdot 10^{-12}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos t\_0\\
\mathbf{elif}\;y.re \leq 3900000:\\
\;\;\;\;\cos \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t\_0\right)\right) \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.re < -4.39999999999999983e-12Initial program 42.1%
Taylor expanded in y.im around 0 86.3%
if -4.39999999999999983e-12 < y.re < 3.9e6Initial program 38.8%
exp-diff38.8%
exp-to-pow38.8%
hypot-define38.8%
*-commutative38.8%
exp-prod38.8%
fma-define38.8%
hypot-define88.0%
*-commutative88.0%
Simplified88.0%
Taylor expanded in y.re around 0 87.9%
rec-exp87.9%
distribute-lft-neg-in87.9%
Simplified87.9%
if 3.9e6 < y.re Initial program 35.4%
exp-diff29.2%
exp-to-pow29.2%
hypot-define29.2%
*-commutative29.2%
exp-prod27.7%
fma-define27.7%
hypot-define52.3%
*-commutative52.3%
Simplified52.3%
Taylor expanded in y.im around 0 60.2%
unpow260.2%
unpow260.2%
hypot-undefine60.2%
Simplified60.2%
Taylor expanded in y.im around 0 61.7%
Taylor expanded in y.re around 0 69.4%
Final simplification82.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (cos t_0))
(t_2 (pow (hypot x.im x.re) y.re))
(t_3 (log (- x.re)))
(t_4 (* (atan2 x.im x.re) y.im))
(t_5 (* (exp (- (* y.re t_3) t_4)) (cos (+ t_0 (* y.im t_3))))))
(if (<= x.re -3.2e-18)
t_5
(if (<= x.re -1.5e-65)
(* t_2 (cos (* (log (hypot x.re x.im)) y.im)))
(if (<= x.re -1.9e-276)
t_5
(if (<= x.re 2.8e+117)
(*
(exp (- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_4))
t_1)
(* t_1 t_2)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = cos(t_0);
double t_2 = pow(hypot(x_46_im, x_46_re), y_46_re);
double t_3 = log(-x_46_re);
double t_4 = atan2(x_46_im, x_46_re) * y_46_im;
double t_5 = exp(((y_46_re * t_3) - t_4)) * cos((t_0 + (y_46_im * t_3)));
double tmp;
if (x_46_re <= -3.2e-18) {
tmp = t_5;
} else if (x_46_re <= -1.5e-65) {
tmp = t_2 * cos((log(hypot(x_46_re, x_46_im)) * y_46_im));
} else if (x_46_re <= -1.9e-276) {
tmp = t_5;
} else if (x_46_re <= 2.8e+117) {
tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_4)) * t_1;
} else {
tmp = t_1 * t_2;
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.cos(t_0);
double t_2 = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
double t_3 = Math.log(-x_46_re);
double t_4 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double t_5 = Math.exp(((y_46_re * t_3) - t_4)) * Math.cos((t_0 + (y_46_im * t_3)));
double tmp;
if (x_46_re <= -3.2e-18) {
tmp = t_5;
} else if (x_46_re <= -1.5e-65) {
tmp = t_2 * Math.cos((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_im));
} else if (x_46_re <= -1.9e-276) {
tmp = t_5;
} else if (x_46_re <= 2.8e+117) {
tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_4)) * t_1;
} else {
tmp = t_1 * t_2;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) t_1 = math.cos(t_0) t_2 = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) t_3 = math.log(-x_46_re) t_4 = math.atan2(x_46_im, x_46_re) * y_46_im t_5 = math.exp(((y_46_re * t_3) - t_4)) * math.cos((t_0 + (y_46_im * t_3))) tmp = 0 if x_46_re <= -3.2e-18: tmp = t_5 elif x_46_re <= -1.5e-65: tmp = t_2 * math.cos((math.log(math.hypot(x_46_re, x_46_im)) * y_46_im)) elif x_46_re <= -1.9e-276: tmp = t_5 elif x_46_re <= 2.8e+117: tmp = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_4)) * t_1 else: tmp = t_1 * t_2 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = cos(t_0) t_2 = hypot(x_46_im, x_46_re) ^ y_46_re t_3 = log(Float64(-x_46_re)) t_4 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_5 = Float64(exp(Float64(Float64(y_46_re * t_3) - t_4)) * cos(Float64(t_0 + Float64(y_46_im * t_3)))) tmp = 0.0 if (x_46_re <= -3.2e-18) tmp = t_5; elseif (x_46_re <= -1.5e-65) tmp = Float64(t_2 * cos(Float64(log(hypot(x_46_re, x_46_im)) * y_46_im))); elseif (x_46_re <= -1.9e-276) tmp = t_5; elseif (x_46_re <= 2.8e+117) 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_4)) * t_1); else tmp = Float64(t_1 * t_2); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); t_1 = cos(t_0); t_2 = hypot(x_46_im, x_46_re) ^ y_46_re; t_3 = log(-x_46_re); t_4 = atan2(x_46_im, x_46_re) * y_46_im; t_5 = exp(((y_46_re * t_3) - t_4)) * cos((t_0 + (y_46_im * t_3))); tmp = 0.0; if (x_46_re <= -3.2e-18) tmp = t_5; elseif (x_46_re <= -1.5e-65) tmp = t_2 * cos((log(hypot(x_46_re, x_46_im)) * y_46_im)); elseif (x_46_re <= -1.9e-276) tmp = t_5; elseif (x_46_re <= 2.8e+117) tmp = exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_4)) * t_1; else tmp = t_1 * t_2; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[t$95$0], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, Block[{t$95$3 = N[Log[(-x$46$re)], $MachinePrecision]}, Block[{t$95$4 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$5 = N[(N[Exp[N[(N[(y$46$re * t$95$3), $MachinePrecision] - t$95$4), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$0 + N[(y$46$im * t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -3.2e-18], t$95$5, If[LessEqual[x$46$re, -1.5e-65], N[(t$95$2 * N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, -1.9e-276], t$95$5, If[LessEqual[x$46$re, 2.8e+117], 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$4), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], N[(t$95$1 * t$95$2), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \cos t\_0\\
t_2 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
t_3 := \log \left(-x.re\right)\\
t_4 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_5 := e^{y.re \cdot t\_3 - t\_4} \cdot \cos \left(t\_0 + y.im \cdot t\_3\right)\\
\mathbf{if}\;x.re \leq -3.2 \cdot 10^{-18}:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;x.re \leq -1.5 \cdot 10^{-65}:\\
\;\;\;\;t\_2 \cdot \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\\
\mathbf{elif}\;x.re \leq -1.9 \cdot 10^{-276}:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;x.re \leq 2.8 \cdot 10^{+117}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t\_4} \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot t\_2\\
\end{array}
\end{array}
if x.re < -3.1999999999999999e-18 or -1.49999999999999999e-65 < x.re < -1.9e-276Initial program 39.1%
Taylor expanded in x.re around -inf 63.3%
mul-1-neg63.3%
Simplified63.3%
Taylor expanded in x.re around -inf 87.0%
mul-1-neg63.3%
Simplified87.0%
if -3.1999999999999999e-18 < x.re < -1.49999999999999999e-65Initial program 18.2%
exp-diff18.2%
exp-to-pow18.2%
hypot-define18.2%
*-commutative18.2%
exp-prod18.2%
fma-define18.2%
hypot-define36.4%
*-commutative36.4%
Simplified36.4%
Taylor expanded in y.im around 0 19.0%
unpow219.0%
unpow219.0%
hypot-undefine36.6%
Simplified36.6%
Taylor expanded in y.re around 0 45.7%
+-commutative45.7%
unpow245.7%
unpow245.7%
hypot-undefine82.0%
Simplified82.0%
if -1.9e-276 < x.re < 2.79999999999999997e117Initial program 49.0%
Taylor expanded in y.im around 0 74.2%
if 2.79999999999999997e117 < x.re Initial program 12.5%
exp-diff12.5%
exp-to-pow12.5%
hypot-define12.5%
*-commutative12.5%
exp-prod9.4%
fma-define9.4%
hypot-define69.0%
*-commutative69.0%
Simplified69.0%
Taylor expanded in y.im around 0 54.2%
unpow254.2%
unpow254.2%
hypot-undefine75.9%
Simplified75.9%
Taylor expanded in y.im around 0 76.8%
Final simplification80.6%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (pow (hypot x.im x.re) y.re))
(t_2 (log (- x.re)))
(t_3
(*
(exp (- (* y.re t_2) (* (atan2 x.im x.re) y.im)))
(cos (+ t_0 (* y.im t_2))))))
(if (<= x.re -1.65e-18)
t_3
(if (<= x.re -1.2e-65)
(* t_1 (cos (* (log (hypot x.re x.im)) y.im)))
(if (<= x.re -1.8e-263) t_3 (* (cos t_0) t_1))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = pow(hypot(x_46_im, x_46_re), y_46_re);
double t_2 = log(-x_46_re);
double t_3 = exp(((y_46_re * t_2) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos((t_0 + (y_46_im * t_2)));
double tmp;
if (x_46_re <= -1.65e-18) {
tmp = t_3;
} else if (x_46_re <= -1.2e-65) {
tmp = t_1 * cos((log(hypot(x_46_re, x_46_im)) * y_46_im));
} else if (x_46_re <= -1.8e-263) {
tmp = t_3;
} else {
tmp = cos(t_0) * t_1;
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
double t_2 = Math.log(-x_46_re);
double t_3 = Math.exp(((y_46_re * t_2) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos((t_0 + (y_46_im * t_2)));
double tmp;
if (x_46_re <= -1.65e-18) {
tmp = t_3;
} else if (x_46_re <= -1.2e-65) {
tmp = t_1 * Math.cos((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_im));
} else if (x_46_re <= -1.8e-263) {
tmp = t_3;
} else {
tmp = Math.cos(t_0) * t_1;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_re * math.atan2(x_46_im, x_46_re) t_1 = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) t_2 = math.log(-x_46_re) t_3 = math.exp(((y_46_re * t_2) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos((t_0 + (y_46_im * t_2))) tmp = 0 if x_46_re <= -1.65e-18: tmp = t_3 elif x_46_re <= -1.2e-65: tmp = t_1 * math.cos((math.log(math.hypot(x_46_re, x_46_im)) * y_46_im)) elif x_46_re <= -1.8e-263: tmp = t_3 else: tmp = math.cos(t_0) * t_1 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = hypot(x_46_im, x_46_re) ^ y_46_re t_2 = log(Float64(-x_46_re)) t_3 = Float64(exp(Float64(Float64(y_46_re * t_2) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(t_0 + Float64(y_46_im * t_2)))) tmp = 0.0 if (x_46_re <= -1.65e-18) tmp = t_3; elseif (x_46_re <= -1.2e-65) tmp = Float64(t_1 * cos(Float64(log(hypot(x_46_re, x_46_im)) * y_46_im))); elseif (x_46_re <= -1.8e-263) tmp = t_3; else tmp = Float64(cos(t_0) * t_1); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_re * atan2(x_46_im, x_46_re); t_1 = hypot(x_46_im, x_46_re) ^ y_46_re; t_2 = log(-x_46_re); t_3 = exp(((y_46_re * t_2) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos((t_0 + (y_46_im * t_2))); tmp = 0.0; if (x_46_re <= -1.65e-18) tmp = t_3; elseif (x_46_re <= -1.2e-65) tmp = t_1 * cos((log(hypot(x_46_re, x_46_im)) * y_46_im)); elseif (x_46_re <= -1.8e-263) tmp = t_3; else tmp = cos(t_0) * t_1; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, Block[{t$95$2 = N[Log[(-x$46$re)], $MachinePrecision]}, Block[{t$95$3 = N[(N[Exp[N[(N[(y$46$re * t$95$2), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(t$95$0 + N[(y$46$im * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x$46$re, -1.65e-18], t$95$3, If[LessEqual[x$46$re, -1.2e-65], N[(t$95$1 * N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$re, -1.8e-263], t$95$3, N[(N[Cos[t$95$0], $MachinePrecision] * t$95$1), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
t_2 := \log \left(-x.re\right)\\
t_3 := e^{y.re \cdot t\_2 - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(t\_0 + y.im \cdot t\_2\right)\\
\mathbf{if}\;x.re \leq -1.65 \cdot 10^{-18}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;x.re \leq -1.2 \cdot 10^{-65}:\\
\;\;\;\;t\_1 \cdot \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\\
\mathbf{elif}\;x.re \leq -1.8 \cdot 10^{-263}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;\cos t\_0 \cdot t\_1\\
\end{array}
\end{array}
if x.re < -1.6500000000000001e-18 or -1.2000000000000001e-65 < x.re < -1.8e-263Initial program 40.2%
Taylor expanded in x.re around -inf 64.0%
mul-1-neg64.0%
Simplified64.0%
Taylor expanded in x.re around -inf 87.5%
mul-1-neg64.0%
Simplified87.5%
if -1.6500000000000001e-18 < x.re < -1.2000000000000001e-65Initial program 18.2%
exp-diff18.2%
exp-to-pow18.2%
hypot-define18.2%
*-commutative18.2%
exp-prod18.2%
fma-define18.2%
hypot-define36.4%
*-commutative36.4%
Simplified36.4%
Taylor expanded in y.im around 0 19.0%
unpow219.0%
unpow219.0%
hypot-undefine36.6%
Simplified36.6%
Taylor expanded in y.re around 0 45.7%
+-commutative45.7%
unpow245.7%
unpow245.7%
hypot-undefine82.0%
Simplified82.0%
if -1.8e-263 < x.re Initial program 39.1%
exp-diff36.1%
exp-to-pow36.1%
hypot-define36.1%
*-commutative36.1%
exp-prod33.9%
fma-define33.9%
hypot-define71.4%
*-commutative71.4%
Simplified71.4%
Taylor expanded in y.im around 0 60.9%
unpow260.9%
unpow260.9%
hypot-undefine67.6%
Simplified67.6%
Taylor expanded in y.im around 0 69.6%
Final simplification78.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot x.im x.re) y.re)))
(if (<= x.im 5e-251)
t_0
(if (<= x.im 1.2e-111)
(*
(cos (+ (* y.re (atan2 x.im x.re)) (* y.im (log (- x.re)))))
(exp (- (* y.re (log x.im)) (* (atan2 x.im x.re) y.im))))
(* t_0 (cos (* (log (hypot x.re x.im)) y.im)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if (x_46_im <= 5e-251) {
tmp = t_0;
} else if (x_46_im <= 1.2e-111) {
tmp = cos(((y_46_re * atan2(x_46_im, x_46_re)) + (y_46_im * log(-x_46_re)))) * exp(((y_46_re * log(x_46_im)) - (atan2(x_46_im, x_46_re) * y_46_im)));
} else {
tmp = t_0 * cos((log(hypot(x_46_re, x_46_im)) * y_46_im));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if (x_46_im <= 5e-251) {
tmp = t_0;
} else if (x_46_im <= 1.2e-111) {
tmp = Math.cos(((y_46_re * Math.atan2(x_46_im, x_46_re)) + (y_46_im * Math.log(-x_46_re)))) * Math.exp(((y_46_re * Math.log(x_46_im)) - (Math.atan2(x_46_im, x_46_re) * y_46_im)));
} else {
tmp = t_0 * Math.cos((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_im));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) tmp = 0 if x_46_im <= 5e-251: tmp = t_0 elif x_46_im <= 1.2e-111: tmp = math.cos(((y_46_re * math.atan2(x_46_im, x_46_re)) + (y_46_im * math.log(-x_46_re)))) * math.exp(((y_46_re * math.log(x_46_im)) - (math.atan2(x_46_im, x_46_re) * y_46_im))) else: tmp = t_0 * math.cos((math.log(math.hypot(x_46_re, x_46_im)) * y_46_im)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re tmp = 0.0 if (x_46_im <= 5e-251) tmp = t_0; elseif (x_46_im <= 1.2e-111) tmp = Float64(cos(Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) + Float64(y_46_im * log(Float64(-x_46_re))))) * exp(Float64(Float64(y_46_re * log(x_46_im)) - Float64(atan(x_46_im, x_46_re) * y_46_im)))); else tmp = Float64(t_0 * cos(Float64(log(hypot(x_46_re, x_46_im)) * y_46_im))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re; tmp = 0.0; if (x_46_im <= 5e-251) tmp = t_0; elseif (x_46_im <= 1.2e-111) tmp = cos(((y_46_re * atan2(x_46_im, x_46_re)) + (y_46_im * log(-x_46_re)))) * exp(((y_46_re * log(x_46_im)) - (atan2(x_46_im, x_46_re) * y_46_im))); else tmp = t_0 * cos((log(hypot(x_46_re, x_46_im)) * y_46_im)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, If[LessEqual[x$46$im, 5e-251], t$95$0, If[LessEqual[x$46$im, 1.2e-111], N[(N[Cos[N[(N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] + N[(y$46$im * N[Log[(-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]), $MachinePrecision], N[(t$95$0 * N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{if}\;x.im \leq 5 \cdot 10^{-251}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x.im \leq 1.2 \cdot 10^{-111}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log \left(-x.re\right)\right) \cdot e^{y.re \cdot \log x.im - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\\
\end{array}
\end{array}
if x.im < 5.0000000000000003e-251Initial program 41.9%
exp-diff41.2%
exp-to-pow41.2%
hypot-define41.2%
*-commutative41.2%
exp-prod39.7%
fma-define39.7%
hypot-define74.3%
*-commutative74.3%
Simplified74.3%
Taylor expanded in y.im around 0 52.7%
unpow252.7%
unpow252.7%
hypot-undefine59.5%
Simplified59.5%
Taylor expanded in y.im around 0 62.0%
Taylor expanded in y.re around 0 63.5%
if 5.0000000000000003e-251 < x.im < 1.2e-111Initial program 45.1%
Taylor expanded in x.re around -inf 55.2%
mul-1-neg55.2%
Simplified55.2%
Taylor expanded in x.re around 0 55.1%
if 1.2e-111 < x.im Initial program 33.0%
exp-diff29.0%
exp-to-pow29.0%
hypot-define29.0%
*-commutative29.0%
exp-prod28.0%
fma-define28.0%
hypot-define73.9%
*-commutative73.9%
Simplified73.9%
Taylor expanded in y.im around 0 56.8%
unpow256.8%
unpow256.8%
hypot-undefine62.3%
Simplified62.3%
Taylor expanded in y.re around 0 33.2%
+-commutative33.2%
unpow233.2%
unpow233.2%
hypot-undefine66.3%
Simplified66.3%
Final simplification63.9%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot x.im x.re) y.re)))
(if (<= x.im 5.6e-301)
t_0
(if (<= x.im 9.5e-121)
(* t_0 (cos (+ (* y.re (atan2 x.im x.re)) (* y.im (log x.im)))))
(* t_0 (cos (* (log (hypot x.re x.im)) y.im)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if (x_46_im <= 5.6e-301) {
tmp = t_0;
} else if (x_46_im <= 9.5e-121) {
tmp = t_0 * cos(((y_46_re * atan2(x_46_im, x_46_re)) + (y_46_im * log(x_46_im))));
} else {
tmp = t_0 * cos((log(hypot(x_46_re, x_46_im)) * y_46_im));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if (x_46_im <= 5.6e-301) {
tmp = t_0;
} else if (x_46_im <= 9.5e-121) {
tmp = t_0 * Math.cos(((y_46_re * Math.atan2(x_46_im, x_46_re)) + (y_46_im * Math.log(x_46_im))));
} else {
tmp = t_0 * Math.cos((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_im));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) tmp = 0 if x_46_im <= 5.6e-301: tmp = t_0 elif x_46_im <= 9.5e-121: tmp = t_0 * math.cos(((y_46_re * math.atan2(x_46_im, x_46_re)) + (y_46_im * math.log(x_46_im)))) else: tmp = t_0 * math.cos((math.log(math.hypot(x_46_re, x_46_im)) * y_46_im)) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re tmp = 0.0 if (x_46_im <= 5.6e-301) tmp = t_0; elseif (x_46_im <= 9.5e-121) tmp = Float64(t_0 * cos(Float64(Float64(y_46_re * atan(x_46_im, x_46_re)) + Float64(y_46_im * log(x_46_im))))); else tmp = Float64(t_0 * cos(Float64(log(hypot(x_46_re, x_46_im)) * y_46_im))); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re; tmp = 0.0; if (x_46_im <= 5.6e-301) tmp = t_0; elseif (x_46_im <= 9.5e-121) tmp = t_0 * cos(((y_46_re * atan2(x_46_im, x_46_re)) + (y_46_im * log(x_46_im)))); else tmp = t_0 * cos((log(hypot(x_46_re, x_46_im)) * y_46_im)); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, If[LessEqual[x$46$im, 5.6e-301], t$95$0, If[LessEqual[x$46$im, 9.5e-121], N[(t$95$0 * N[Cos[N[(N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision] + N[(y$46$im * N[Log[x$46$im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{if}\;x.im \leq 5.6 \cdot 10^{-301}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x.im \leq 9.5 \cdot 10^{-121}:\\
\;\;\;\;t\_0 \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} + y.im \cdot \log x.im\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\\
\end{array}
\end{array}
if x.im < 5.6000000000000002e-301Initial program 41.0%
exp-diff40.2%
exp-to-pow40.2%
hypot-define40.2%
*-commutative40.2%
exp-prod38.5%
fma-define38.5%
hypot-define72.9%
*-commutative72.9%
Simplified72.9%
Taylor expanded in y.im around 0 50.5%
unpow250.5%
unpow250.5%
hypot-undefine57.3%
Simplified57.3%
Taylor expanded in y.im around 0 59.9%
Taylor expanded in y.re around 0 62.3%
if 5.6000000000000002e-301 < x.im < 9.4999999999999994e-121Initial program 43.8%
exp-diff43.8%
exp-to-pow43.8%
hypot-define43.8%
*-commutative43.8%
exp-prod43.8%
fma-define43.8%
hypot-define81.4%
*-commutative81.4%
Simplified81.4%
Taylor expanded in y.im around 0 60.3%
unpow260.3%
unpow260.3%
hypot-undefine60.4%
Simplified60.4%
Taylor expanded in x.re around 0 65.4%
if 9.4999999999999994e-121 < x.im Initial program 34.3%
exp-diff29.4%
exp-to-pow29.4%
hypot-define29.4%
*-commutative29.4%
exp-prod28.4%
fma-define28.4%
hypot-define73.4%
*-commutative73.4%
Simplified73.4%
Taylor expanded in y.im around 0 55.7%
unpow255.7%
unpow255.7%
hypot-undefine61.2%
Simplified61.2%
Taylor expanded in y.re around 0 32.6%
+-commutative32.6%
unpow232.6%
unpow232.6%
hypot-undefine65.1%
Simplified65.1%
Final simplification63.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot x.im x.re) y.re)))
(if (or (<= x.im -1350000.0) (not (<= x.im 3.8e-124)))
(* t_0 (cos (* (log (hypot x.re x.im)) y.im)))
(* (cos (* y.re (atan2 x.im x.re))) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = pow(hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if ((x_46_im <= -1350000.0) || !(x_46_im <= 3.8e-124)) {
tmp = t_0 * cos((log(hypot(x_46_re, x_46_im)) * y_46_im));
} else {
tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * t_0;
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
double tmp;
if ((x_46_im <= -1350000.0) || !(x_46_im <= 3.8e-124)) {
tmp = t_0 * Math.cos((Math.log(Math.hypot(x_46_re, x_46_im)) * y_46_im));
} else {
tmp = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * t_0;
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = math.pow(math.hypot(x_46_im, x_46_re), y_46_re) tmp = 0 if (x_46_im <= -1350000.0) or not (x_46_im <= 3.8e-124): tmp = t_0 * math.cos((math.log(math.hypot(x_46_re, x_46_im)) * y_46_im)) else: tmp = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re tmp = 0.0 if ((x_46_im <= -1350000.0) || !(x_46_im <= 3.8e-124)) tmp = Float64(t_0 * cos(Float64(log(hypot(x_46_re, x_46_im)) * y_46_im))); else tmp = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * t_0); end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_im, x_46_re) ^ y_46_re; tmp = 0.0; if ((x_46_im <= -1350000.0) || ~((x_46_im <= 3.8e-124))) tmp = t_0 * cos((log(hypot(x_46_re, x_46_im)) * y_46_im)); else tmp = cos((y_46_re * atan2(x_46_im, x_46_re))) * t_0; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, If[Or[LessEqual[x$46$im, -1350000.0], N[Not[LessEqual[x$46$im, 3.8e-124]], $MachinePrecision]], N[(t$95$0 * N[Cos[N[(N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\
\mathbf{if}\;x.im \leq -1350000 \lor \neg \left(x.im \leq 3.8 \cdot 10^{-124}\right):\\
\;\;\;\;t\_0 \cdot \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot t\_0\\
\end{array}
\end{array}
if x.im < -1.35e6 or 3.80000000000000012e-124 < x.im Initial program 33.9%
exp-diff31.0%
exp-to-pow31.0%
hypot-define31.0%
*-commutative31.0%
exp-prod30.4%
fma-define30.4%
hypot-define74.9%
*-commutative74.9%
Simplified74.9%
Taylor expanded in y.im around 0 53.2%
unpow253.2%
unpow253.2%
hypot-undefine58.0%
Simplified58.0%
Taylor expanded in y.re around 0 31.2%
+-commutative31.2%
unpow231.2%
unpow231.2%
hypot-undefine63.4%
Simplified63.4%
if -1.35e6 < x.im < 3.80000000000000012e-124Initial program 47.8%
exp-diff46.6%
exp-to-pow46.6%
hypot-define46.6%
*-commutative46.6%
exp-prod44.4%
fma-define44.4%
hypot-define72.8%
*-commutative72.8%
Simplified72.8%
Taylor expanded in y.im around 0 54.9%
unpow254.9%
unpow254.9%
hypot-undefine61.6%
Simplified61.6%
Taylor expanded in y.im around 0 64.5%
Final simplification63.7%
(FPCore (x.re x.im y.re y.im) :precision binary64 (pow (hypot x.im x.re) y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return pow(hypot(x_46_im, x_46_re), y_46_re);
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.pow(math.hypot(x_46_im, x_46_re), y_46_re)
function code(x_46_re, x_46_im, y_46_re, y_46_im) return hypot(x_46_im, x_46_re) ^ y_46_re end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = hypot(x_46_im, x_46_re) ^ y_46_re; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]
\begin{array}{l}
\\
{\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}
\end{array}
Initial program 38.7%
exp-diff36.3%
exp-to-pow36.3%
hypot-define36.3%
*-commutative36.3%
exp-prod35.2%
fma-define35.2%
hypot-define74.2%
*-commutative74.2%
Simplified74.2%
Taylor expanded in y.im around 0 53.8%
unpow253.8%
unpow253.8%
hypot-undefine59.2%
Simplified59.2%
Taylor expanded in y.im around 0 60.6%
Taylor expanded in y.re around 0 61.8%
Final simplification61.8%
herbie shell --seed 2024119
(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)))))