
(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
(let* ((t_0 (* y.im (atan2 x.im x.re)))
(t_1
(/ (pow (+ (* x.re x.re) (* x.im x.im)) (/ y.re 2.0)) (+ 1.0 t_0)))
(t_2 (pow (hypot x.re x.im) y.re)))
(if (<= y.re -500.0)
t_1
(if (<= y.re 7.7e+28)
(/ 1.0 (/ (exp t_0) t_2))
(if (<= y.re 2e+231) 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_im * atan2(x_46_im, x_46_re);
double t_1 = pow(((x_46_re * x_46_re) + (x_46_im * x_46_im)), (y_46_re / 2.0)) / (1.0 + t_0);
double t_2 = pow(hypot(x_46_re, x_46_im), y_46_re);
double tmp;
if (y_46_re <= -500.0) {
tmp = t_1;
} else if (y_46_re <= 7.7e+28) {
tmp = 1.0 / (exp(t_0) / t_2);
} else if (y_46_re <= 2e+231) {
tmp = t_1;
} else {
tmp = 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_im * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.pow(((x_46_re * x_46_re) + (x_46_im * x_46_im)), (y_46_re / 2.0)) / (1.0 + t_0);
double t_2 = Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re);
double tmp;
if (y_46_re <= -500.0) {
tmp = t_1;
} else if (y_46_re <= 7.7e+28) {
tmp = 1.0 / (Math.exp(t_0) / t_2);
} else if (y_46_re <= 2e+231) {
tmp = t_1;
} else {
tmp = t_2;
}
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) t_1 = math.pow(((x_46_re * x_46_re) + (x_46_im * x_46_im)), (y_46_re / 2.0)) / (1.0 + t_0) t_2 = math.pow(math.hypot(x_46_re, x_46_im), y_46_re) tmp = 0 if y_46_re <= -500.0: tmp = t_1 elif y_46_re <= 7.7e+28: tmp = 1.0 / (math.exp(t_0) / t_2) elif y_46_re <= 2e+231: tmp = t_1 else: tmp = t_2 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)) t_1 = Float64((Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)) ^ Float64(y_46_re / 2.0)) / Float64(1.0 + t_0)) t_2 = hypot(x_46_re, x_46_im) ^ y_46_re tmp = 0.0 if (y_46_re <= -500.0) tmp = t_1; elseif (y_46_re <= 7.7e+28) tmp = Float64(1.0 / Float64(exp(t_0) / t_2)); elseif (y_46_re <= 2e+231) tmp = t_1; else tmp = 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_im * atan2(x_46_im, x_46_re); t_1 = (((x_46_re * x_46_re) + (x_46_im * x_46_im)) ^ (y_46_re / 2.0)) / (1.0 + t_0); t_2 = hypot(x_46_re, x_46_im) ^ y_46_re; tmp = 0.0; if (y_46_re <= -500.0) tmp = t_1; elseif (y_46_re <= 7.7e+28) tmp = 1.0 / (exp(t_0) / t_2); elseif (y_46_re <= 2e+231) tmp = t_1; else tmp = 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$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision], N[(y$46$re / 2.0), $MachinePrecision]], $MachinePrecision] / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, If[LessEqual[y$46$re, -500.0], t$95$1, If[LessEqual[y$46$re, 7.7e+28], N[(1.0 / N[(N[Exp[t$95$0], $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 2e+231], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \frac{{\left(x.re \cdot x.re + x.im \cdot x.im\right)}^{\left(\frac{y.re}{2}\right)}}{1 + t\_0}\\
t_2 := {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
\mathbf{if}\;y.re \leq -500:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.re \leq 7.7 \cdot 10^{+28}:\\
\;\;\;\;\frac{1}{\frac{e^{t\_0}}{t\_2}}\\
\mathbf{elif}\;y.re \leq 2 \cdot 10^{+231}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y.re < -500 or 7.6999999999999997e28 < y.re < 2.0000000000000001e231Initial program 37.1%
exp-diffN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
exp-diffN/A
Simplified62.1%
Taylor expanded in y.re around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6469.0%
Simplified69.0%
Taylor expanded in y.im around 0
Simplified64.7%
Taylor expanded in y.im around 0
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f6482.9%
Simplified82.9%
clear-numN/A
/-lowering-/.f64N/A
sqrt-pow2N/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f6482.9%
Applied egg-rr82.9%
if -500 < y.re < 7.6999999999999997e28Initial program 42.2%
exp-diffN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
exp-diffN/A
Simplified76.9%
Taylor expanded in y.re around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6476.9%
Simplified76.9%
Taylor expanded in y.im around 0
Simplified79.5%
if 2.0000000000000001e231 < y.re Initial program 23.8%
exp-diffN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
exp-diffN/A
Simplified33.3%
Taylor expanded in y.re around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6452.4%
Simplified52.4%
Taylor expanded in y.im around 0
Simplified66.7%
Taylor expanded in y.im around 0
pow-lowering-pow.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6481.0%
Simplified81.0%
Final simplification81.2%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (atan2 x.im x.re)))
(t_1 (+ (* x.re x.re) (* x.im x.im)))
(t_2 (* y.re (atan2 x.im x.re)))
(t_3 (* y.im (log (hypot x.im x.re)))))
(if (<= y.re -1.1e-37)
(/ (pow t_1 (/ y.re 2.0)) (+ 1.0 t_0))
(if (<= y.re 15.0)
(/
(- (cos t_2) (* t_3 (sin t_2)))
(/ (exp t_0) (pow (hypot x.re x.im) y.re)))
(*
(exp (- (* y.re (log (sqrt t_1))) t_0))
(- (cos t_3) (* y.re (* (atan2 x.im x.re) (sin t_3)))))))))
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 t_1 = (x_46_re * x_46_re) + (x_46_im * x_46_im);
double t_2 = y_46_re * atan2(x_46_im, x_46_re);
double t_3 = y_46_im * log(hypot(x_46_im, x_46_re));
double tmp;
if (y_46_re <= -1.1e-37) {
tmp = pow(t_1, (y_46_re / 2.0)) / (1.0 + t_0);
} else if (y_46_re <= 15.0) {
tmp = (cos(t_2) - (t_3 * sin(t_2))) / (exp(t_0) / pow(hypot(x_46_re, x_46_im), y_46_re));
} else {
tmp = exp(((y_46_re * log(sqrt(t_1))) - t_0)) * (cos(t_3) - (y_46_re * (atan2(x_46_im, x_46_re) * sin(t_3))));
}
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 t_1 = (x_46_re * x_46_re) + (x_46_im * x_46_im);
double t_2 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_3 = y_46_im * Math.log(Math.hypot(x_46_im, x_46_re));
double tmp;
if (y_46_re <= -1.1e-37) {
tmp = Math.pow(t_1, (y_46_re / 2.0)) / (1.0 + t_0);
} else if (y_46_re <= 15.0) {
tmp = (Math.cos(t_2) - (t_3 * Math.sin(t_2))) / (Math.exp(t_0) / Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re));
} else {
tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(t_1))) - t_0)) * (Math.cos(t_3) - (y_46_re * (Math.atan2(x_46_im, x_46_re) * Math.sin(t_3))));
}
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) t_1 = (x_46_re * x_46_re) + (x_46_im * x_46_im) t_2 = y_46_re * math.atan2(x_46_im, x_46_re) t_3 = y_46_im * math.log(math.hypot(x_46_im, x_46_re)) tmp = 0 if y_46_re <= -1.1e-37: tmp = math.pow(t_1, (y_46_re / 2.0)) / (1.0 + t_0) elif y_46_re <= 15.0: tmp = (math.cos(t_2) - (t_3 * math.sin(t_2))) / (math.exp(t_0) / math.pow(math.hypot(x_46_re, x_46_im), y_46_re)) else: tmp = math.exp(((y_46_re * math.log(math.sqrt(t_1))) - t_0)) * (math.cos(t_3) - (y_46_re * (math.atan2(x_46_im, x_46_re) * math.sin(t_3)))) 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)) t_1 = Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)) t_2 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_3 = Float64(y_46_im * log(hypot(x_46_im, x_46_re))) tmp = 0.0 if (y_46_re <= -1.1e-37) tmp = Float64((t_1 ^ Float64(y_46_re / 2.0)) / Float64(1.0 + t_0)); elseif (y_46_re <= 15.0) tmp = Float64(Float64(cos(t_2) - Float64(t_3 * sin(t_2))) / Float64(exp(t_0) / (hypot(x_46_re, x_46_im) ^ y_46_re))); else tmp = Float64(exp(Float64(Float64(y_46_re * log(sqrt(t_1))) - t_0)) * Float64(cos(t_3) - Float64(y_46_re * Float64(atan(x_46_im, x_46_re) * sin(t_3))))); 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); t_1 = (x_46_re * x_46_re) + (x_46_im * x_46_im); t_2 = y_46_re * atan2(x_46_im, x_46_re); t_3 = y_46_im * log(hypot(x_46_im, x_46_re)); tmp = 0.0; if (y_46_re <= -1.1e-37) tmp = (t_1 ^ (y_46_re / 2.0)) / (1.0 + t_0); elseif (y_46_re <= 15.0) tmp = (cos(t_2) - (t_3 * sin(t_2))) / (exp(t_0) / (hypot(x_46_re, x_46_im) ^ y_46_re)); else tmp = exp(((y_46_re * log(sqrt(t_1))) - t_0)) * (cos(t_3) - (y_46_re * (atan2(x_46_im, x_46_re) * sin(t_3)))); 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]}, Block[{t$95$1 = N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -1.1e-37], N[(N[Power[t$95$1, N[(y$46$re / 2.0), $MachinePrecision]], $MachinePrecision] / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 15.0], N[(N[(N[Cos[t$95$2], $MachinePrecision] - N[(t$95$3 * N[Sin[t$95$2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Exp[t$95$0], $MachinePrecision] / N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(y$46$re * N[Log[N[Sqrt[t$95$1], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * N[(N[Cos[t$95$3], $MachinePrecision] - N[(y$46$re * N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * N[Sin[t$95$3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := x.re \cdot x.re + x.im \cdot x.im\\
t_2 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_3 := y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\\
\mathbf{if}\;y.re \leq -1.1 \cdot 10^{-37}:\\
\;\;\;\;\frac{{t\_1}^{\left(\frac{y.re}{2}\right)}}{1 + t\_0}\\
\mathbf{elif}\;y.re \leq 15:\\
\;\;\;\;\frac{\cos t\_2 - t\_3 \cdot \sin t\_2}{\frac{e^{t\_0}}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\
\mathbf{else}:\\
\;\;\;\;e^{y.re \cdot \log \left(\sqrt{t\_1}\right) - t\_0} \cdot \left(\cos t\_3 - y.re \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \sin t\_3\right)\right)\\
\end{array}
\end{array}
if y.re < -1.10000000000000001e-37Initial program 37.3%
exp-diffN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
exp-diffN/A
Simplified71.1%
Taylor expanded in y.re around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6473.5%
Simplified73.5%
Taylor expanded in y.im around 0
Simplified69.9%
Taylor expanded in y.im around 0
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f6485.6%
Simplified85.6%
clear-numN/A
/-lowering-/.f64N/A
sqrt-pow2N/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f6485.6%
Applied egg-rr85.6%
if -1.10000000000000001e-37 < y.re < 15Initial program 42.5%
exp-diffN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
exp-diffN/A
Simplified77.9%
Taylor expanded in y.im around 0
+-lowering-+.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
Simplified81.6%
if 15 < y.re Initial program 32.3%
Taylor expanded in y.re around 0
+-lowering-+.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
Simplified69.5%
Final simplification80.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (atan2 x.im x.re)))
(t_1
(*
(cos (* y.re (atan2 x.im x.re)))
(exp
(- (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im))))) t_0)))))
(if (<= y.im -3800000000.0)
t_1
(if (<= y.im 14000000000000.0)
(/
(cos (* y.im (log (hypot x.im x.re))))
(/ (exp t_0) (pow (hypot x.re x.im) y.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_im * atan2(x_46_im, x_46_re);
double t_1 = cos((y_46_re * atan2(x_46_im, x_46_re))) * exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
double tmp;
if (y_46_im <= -3800000000.0) {
tmp = t_1;
} else if (y_46_im <= 14000000000000.0) {
tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) / (exp(t_0) / pow(hypot(x_46_re, x_46_im), y_46_re));
} else {
tmp = 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_im * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re))) * Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0));
double tmp;
if (y_46_im <= -3800000000.0) {
tmp = t_1;
} else if (y_46_im <= 14000000000000.0) {
tmp = Math.cos((y_46_im * Math.log(Math.hypot(x_46_im, x_46_re)))) / (Math.exp(t_0) / Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re));
} else {
tmp = t_1;
}
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) t_1 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re))) * math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)) tmp = 0 if y_46_im <= -3800000000.0: tmp = t_1 elif y_46_im <= 14000000000000.0: tmp = math.cos((y_46_im * math.log(math.hypot(x_46_im, x_46_re)))) / (math.exp(t_0) / math.pow(math.hypot(x_46_re, x_46_im), y_46_re)) else: tmp = t_1 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)) t_1 = Float64(cos(Float64(y_46_re * atan(x_46_im, x_46_re))) * 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))) tmp = 0.0 if (y_46_im <= -3800000000.0) tmp = t_1; elseif (y_46_im <= 14000000000000.0) tmp = Float64(cos(Float64(y_46_im * log(hypot(x_46_im, x_46_re)))) / Float64(exp(t_0) / (hypot(x_46_re, x_46_im) ^ y_46_re))); else tmp = 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_im * atan2(x_46_im, x_46_re); t_1 = cos((y_46_re * atan2(x_46_im, x_46_re))) * exp(((y_46_re * log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - t_0)); tmp = 0.0; if (y_46_im <= -3800000000.0) tmp = t_1; elseif (y_46_im <= 14000000000000.0) tmp = cos((y_46_im * log(hypot(x_46_im, x_46_re)))) / (exp(t_0) / (hypot(x_46_re, x_46_im) ^ y_46_re)); else tmp = 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$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = 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[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]), $MachinePrecision]}, If[LessEqual[y$46$im, -3800000000.0], t$95$1, If[LessEqual[y$46$im, 14000000000000.0], N[(N[Cos[N[(y$46$im * N[Log[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[Exp[t$95$0], $MachinePrecision] / N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t\_0}\\
\mathbf{if}\;y.im \leq -3800000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.im \leq 14000000000000:\\
\;\;\;\;\frac{\cos \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)}{\frac{e^{t\_0}}{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y.im < -3.8e9 or 1.4e13 < y.im Initial program 33.5%
Taylor expanded in y.im around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f6465.5%
Simplified65.5%
if -3.8e9 < y.im < 1.4e13Initial program 43.8%
exp-diffN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
exp-diffN/A
Simplified87.6%
Taylor expanded in y.re around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6495.8%
Simplified95.8%
Final simplification79.8%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.im (atan2 x.im x.re)))
(t_1
(/ (pow (+ (* x.re x.re) (* x.im x.im)) (/ y.re 2.0)) (+ 1.0 t_0))))
(if (<= y.re -960.0)
t_1
(if (<= y.re 8.8e+28)
(exp (- 0.0 t_0))
(if (<= y.re 1e+228) t_1 (pow (hypot x.re x.im) y.re))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * atan2(x_46_im, x_46_re);
double t_1 = pow(((x_46_re * x_46_re) + (x_46_im * x_46_im)), (y_46_re / 2.0)) / (1.0 + t_0);
double tmp;
if (y_46_re <= -960.0) {
tmp = t_1;
} else if (y_46_re <= 8.8e+28) {
tmp = exp((0.0 - t_0));
} else if (y_46_re <= 1e+228) {
tmp = t_1;
} else {
tmp = pow(hypot(x_46_re, x_46_im), y_46_re);
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_im * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.pow(((x_46_re * x_46_re) + (x_46_im * x_46_im)), (y_46_re / 2.0)) / (1.0 + t_0);
double tmp;
if (y_46_re <= -960.0) {
tmp = t_1;
} else if (y_46_re <= 8.8e+28) {
tmp = Math.exp((0.0 - t_0));
} else if (y_46_re <= 1e+228) {
tmp = t_1;
} else {
tmp = Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): t_0 = y_46_im * math.atan2(x_46_im, x_46_re) t_1 = math.pow(((x_46_re * x_46_re) + (x_46_im * x_46_im)), (y_46_re / 2.0)) / (1.0 + t_0) tmp = 0 if y_46_re <= -960.0: tmp = t_1 elif y_46_re <= 8.8e+28: tmp = math.exp((0.0 - t_0)) elif y_46_re <= 1e+228: tmp = t_1 else: tmp = math.pow(math.hypot(x_46_re, x_46_im), y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_im * atan(x_46_im, x_46_re)) t_1 = Float64((Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)) ^ Float64(y_46_re / 2.0)) / Float64(1.0 + t_0)) tmp = 0.0 if (y_46_re <= -960.0) tmp = t_1; elseif (y_46_re <= 8.8e+28) tmp = exp(Float64(0.0 - t_0)); elseif (y_46_re <= 1e+228) tmp = t_1; else tmp = hypot(x_46_re, x_46_im) ^ y_46_re; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = y_46_im * atan2(x_46_im, x_46_re); t_1 = (((x_46_re * x_46_re) + (x_46_im * x_46_im)) ^ (y_46_re / 2.0)) / (1.0 + t_0); tmp = 0.0; if (y_46_re <= -960.0) tmp = t_1; elseif (y_46_re <= 8.8e+28) tmp = exp((0.0 - t_0)); elseif (y_46_re <= 1e+228) tmp = t_1; else tmp = hypot(x_46_re, x_46_im) ^ y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision], N[(y$46$re / 2.0), $MachinePrecision]], $MachinePrecision] / N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -960.0], t$95$1, If[LessEqual[y$46$re, 8.8e+28], N[Exp[N[(0.0 - t$95$0), $MachinePrecision]], $MachinePrecision], If[LessEqual[y$46$re, 1e+228], t$95$1, N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \frac{{\left(x.re \cdot x.re + x.im \cdot x.im\right)}^{\left(\frac{y.re}{2}\right)}}{1 + t\_0}\\
\mathbf{if}\;y.re \leq -960:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y.re \leq 8.8 \cdot 10^{+28}:\\
\;\;\;\;e^{0 - t\_0}\\
\mathbf{elif}\;y.re \leq 10^{+228}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
\end{array}
\end{array}
if y.re < -960 or 8.79999999999999946e28 < y.re < 9.9999999999999992e227Initial program 37.4%
exp-diffN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
exp-diffN/A
Simplified62.6%
Taylor expanded in y.re around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6469.6%
Simplified69.6%
Taylor expanded in y.im around 0
Simplified65.2%
Taylor expanded in y.im around 0
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f6483.6%
Simplified83.6%
clear-numN/A
/-lowering-/.f64N/A
sqrt-pow2N/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f6483.6%
Applied egg-rr83.6%
if -960 < y.re < 8.79999999999999946e28Initial program 41.8%
exp-diffN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
exp-diffN/A
Simplified76.3%
Taylor expanded in y.re around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6476.3%
Simplified76.3%
Taylor expanded in y.im around 0
Simplified78.8%
Taylor expanded in y.re around 0
rec-expN/A
mul-1-negN/A
exp-lowering-exp.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
atan2-lowering-atan2.f6478.6%
Simplified78.6%
if 9.9999999999999992e227 < y.re Initial program 23.8%
exp-diffN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
exp-diffN/A
Simplified33.3%
Taylor expanded in y.re around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6452.4%
Simplified52.4%
Taylor expanded in y.im around 0
Simplified66.7%
Taylor expanded in y.im around 0
pow-lowering-pow.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6481.0%
Simplified81.0%
Final simplification81.0%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (pow (hypot x.re x.im) y.re)))
(if (<= y.re -2400.0)
t_0
(if (<= y.re 3.9e-11) (exp (- 0.0 (* y.im (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_re, x_46_im), y_46_re);
double tmp;
if (y_46_re <= -2400.0) {
tmp = t_0;
} else if (y_46_re <= 3.9e-11) {
tmp = exp((0.0 - (y_46_im * atan2(x_46_im, x_46_re))));
} else {
tmp = 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_re, x_46_im), y_46_re);
double tmp;
if (y_46_re <= -2400.0) {
tmp = t_0;
} else if (y_46_re <= 3.9e-11) {
tmp = Math.exp((0.0 - (y_46_im * Math.atan2(x_46_im, x_46_re))));
} else {
tmp = 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_re, x_46_im), y_46_re) tmp = 0 if y_46_re <= -2400.0: tmp = t_0 elif y_46_re <= 3.9e-11: tmp = math.exp((0.0 - (y_46_im * math.atan2(x_46_im, x_46_re)))) else: tmp = t_0 return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = hypot(x_46_re, x_46_im) ^ y_46_re tmp = 0.0 if (y_46_re <= -2400.0) tmp = t_0; elseif (y_46_re <= 3.9e-11) tmp = exp(Float64(0.0 - Float64(y_46_im * atan(x_46_im, x_46_re)))); else tmp = 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_re, x_46_im) ^ y_46_re; tmp = 0.0; if (y_46_re <= -2400.0) tmp = t_0; elseif (y_46_re <= 3.9e-11) tmp = exp((0.0 - (y_46_im * atan2(x_46_im, x_46_re)))); else tmp = 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$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]}, If[LessEqual[y$46$re, -2400.0], t$95$0, If[LessEqual[y$46$re, 3.9e-11], N[Exp[N[(0.0 - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}\\
\mathbf{if}\;y.re \leq -2400:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y.re \leq 3.9 \cdot 10^{-11}:\\
\;\;\;\;e^{0 - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y.re < -2400 or 3.9000000000000001e-11 < y.re Initial program 35.7%
exp-diffN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
exp-diffN/A
Simplified57.3%
Taylor expanded in y.re around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6465.7%
Simplified65.7%
Taylor expanded in y.im around 0
Simplified65.0%
Taylor expanded in y.im around 0
pow-lowering-pow.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6476.4%
Simplified76.4%
if -2400 < y.re < 3.9000000000000001e-11Initial program 41.8%
exp-diffN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
exp-diffN/A
Simplified78.3%
Taylor expanded in y.re around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6478.3%
Simplified78.3%
Taylor expanded in y.im around 0
Simplified80.2%
Taylor expanded in y.re around 0
rec-expN/A
mul-1-negN/A
exp-lowering-exp.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-lowering-neg.f64N/A
atan2-lowering-atan2.f6480.2%
Simplified80.2%
Final simplification78.1%
(FPCore (x.re x.im y.re y.im) :precision binary64 (pow (hypot x.re x.im) y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return pow(hypot(x_46_re, x_46_im), 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_re, x_46_im), y_46_re);
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.pow(math.hypot(x_46_re, x_46_im), y_46_re)
function code(x_46_re, x_46_im, y_46_re, y_46_im) return hypot(x_46_re, x_46_im) ^ y_46_re end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = hypot(x_46_re, x_46_im) ^ y_46_re; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision]
\begin{array}{l}
\\
{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}
\end{array}
Initial program 38.4%
exp-diffN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
exp-diffN/A
Simplified66.6%
Taylor expanded in y.re around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6471.3%
Simplified71.3%
Taylor expanded in y.im around 0
Simplified71.7%
Taylor expanded in y.im around 0
pow-lowering-pow.f64N/A
+-commutativeN/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6462.5%
Simplified62.5%
(FPCore (x.re x.im y.re y.im)
:precision binary64
(if (<= y.re -3.4e+19)
(pow x.im y.re)
(if (<= y.re 3.7e-11)
(/ 1.0 (+ 1.0 (* y.im (atan2 x.im x.re))))
(pow x.im y.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -3.4e+19) {
tmp = pow(x_46_im, y_46_re);
} else if (y_46_re <= 3.7e-11) {
tmp = 1.0 / (1.0 + (y_46_im * atan2(x_46_im, x_46_re)));
} else {
tmp = pow(x_46_im, y_46_re);
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-3.4d+19)) then
tmp = x_46im ** y_46re
else if (y_46re <= 3.7d-11) then
tmp = 1.0d0 / (1.0d0 + (y_46im * atan2(x_46im, x_46re)))
else
tmp = x_46im ** y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -3.4e+19) {
tmp = Math.pow(x_46_im, y_46_re);
} else if (y_46_re <= 3.7e-11) {
tmp = 1.0 / (1.0 + (y_46_im * Math.atan2(x_46_im, x_46_re)));
} else {
tmp = Math.pow(x_46_im, y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -3.4e+19: tmp = math.pow(x_46_im, y_46_re) elif y_46_re <= 3.7e-11: tmp = 1.0 / (1.0 + (y_46_im * math.atan2(x_46_im, x_46_re))) else: tmp = math.pow(x_46_im, y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -3.4e+19) tmp = x_46_im ^ y_46_re; elseif (y_46_re <= 3.7e-11) tmp = Float64(1.0 / Float64(1.0 + Float64(y_46_im * atan(x_46_im, x_46_re)))); else tmp = x_46_im ^ y_46_re; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -3.4e+19) tmp = x_46_im ^ y_46_re; elseif (y_46_re <= 3.7e-11) tmp = 1.0 / (1.0 + (y_46_im * atan2(x_46_im, x_46_re))); else tmp = x_46_im ^ y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -3.4e+19], N[Power[x$46$im, y$46$re], $MachinePrecision], If[LessEqual[y$46$re, 3.7e-11], N[(1.0 / N[(1.0 + N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[x$46$im, y$46$re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -3.4 \cdot 10^{+19}:\\
\;\;\;\;{x.im}^{y.re}\\
\mathbf{elif}\;y.re \leq 3.7 \cdot 10^{-11}:\\
\;\;\;\;\frac{1}{1 + y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
\mathbf{else}:\\
\;\;\;\;{x.im}^{y.re}\\
\end{array}
\end{array}
if y.re < -3.4e19 or 3.7000000000000001e-11 < y.re Initial program 35.5%
Taylor expanded in y.im around 0
pow-lowering-pow.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6431.3%
Simplified31.3%
Taylor expanded in x.re around 0
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f64N/A
pow-lowering-pow.f6425.1%
Simplified25.1%
Taylor expanded in y.re around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f6428.6%
Simplified28.6%
Taylor expanded in y.im around 0
pow-lowering-pow.f6453.0%
Simplified53.0%
if -3.4e19 < y.re < 3.7000000000000001e-11Initial program 41.9%
exp-diffN/A
associate-*l/N/A
associate-/l*N/A
*-commutativeN/A
associate-/r/N/A
exp-diffN/A
Simplified77.8%
Taylor expanded in y.re around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6477.8%
Simplified77.8%
Taylor expanded in y.im around 0
Simplified79.6%
Taylor expanded in y.im around 0
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f6446.3%
Simplified46.3%
Taylor expanded in y.re around 0
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f6443.8%
Simplified43.8%
Final simplification48.9%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.re -3.4e+19) (pow x.im y.re) (if (<= y.re 3.9e-11) (- 1.0 (* y.im (atan2 x.im x.re))) (pow x.im y.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -3.4e+19) {
tmp = pow(x_46_im, y_46_re);
} else if (y_46_re <= 3.9e-11) {
tmp = 1.0 - (y_46_im * atan2(x_46_im, x_46_re));
} else {
tmp = pow(x_46_im, y_46_re);
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-3.4d+19)) then
tmp = x_46im ** y_46re
else if (y_46re <= 3.9d-11) then
tmp = 1.0d0 - (y_46im * atan2(x_46im, x_46re))
else
tmp = x_46im ** y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -3.4e+19) {
tmp = Math.pow(x_46_im, y_46_re);
} else if (y_46_re <= 3.9e-11) {
tmp = 1.0 - (y_46_im * Math.atan2(x_46_im, x_46_re));
} else {
tmp = Math.pow(x_46_im, y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -3.4e+19: tmp = math.pow(x_46_im, y_46_re) elif y_46_re <= 3.9e-11: tmp = 1.0 - (y_46_im * math.atan2(x_46_im, x_46_re)) else: tmp = math.pow(x_46_im, y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -3.4e+19) tmp = x_46_im ^ y_46_re; elseif (y_46_re <= 3.9e-11) tmp = Float64(1.0 - Float64(y_46_im * atan(x_46_im, x_46_re))); else tmp = x_46_im ^ y_46_re; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -3.4e+19) tmp = x_46_im ^ y_46_re; elseif (y_46_re <= 3.9e-11) tmp = 1.0 - (y_46_im * atan2(x_46_im, x_46_re)); else tmp = x_46_im ^ y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -3.4e+19], N[Power[x$46$im, y$46$re], $MachinePrecision], If[LessEqual[y$46$re, 3.9e-11], N[(1.0 - N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[x$46$im, y$46$re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -3.4 \cdot 10^{+19}:\\
\;\;\;\;{x.im}^{y.re}\\
\mathbf{elif}\;y.re \leq 3.9 \cdot 10^{-11}:\\
\;\;\;\;1 - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
\mathbf{else}:\\
\;\;\;\;{x.im}^{y.re}\\
\end{array}
\end{array}
if y.re < -3.4e19 or 3.9000000000000001e-11 < y.re Initial program 35.5%
Taylor expanded in y.im around 0
pow-lowering-pow.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6431.3%
Simplified31.3%
Taylor expanded in x.re around 0
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f64N/A
pow-lowering-pow.f6425.1%
Simplified25.1%
Taylor expanded in y.re around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f6428.6%
Simplified28.6%
Taylor expanded in y.im around 0
pow-lowering-pow.f6453.0%
Simplified53.0%
if -3.4e19 < y.re < 3.9000000000000001e-11Initial program 41.9%
Taylor expanded in y.re around 0
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f64N/A
exp-lowering-exp.f64N/A
distribute-rgt-neg-inN/A
mul-1-negN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f6477.0%
Simplified77.0%
Taylor expanded in y.im around 0
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f6443.6%
Simplified43.6%
(FPCore (x.re x.im y.re y.im) :precision binary64 (if (<= y.re -3.4e+19) (pow x.im y.re) (if (<= y.re 3.9e-11) 1.0 (pow x.im y.re))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -3.4e+19) {
tmp = pow(x_46_im, y_46_re);
} else if (y_46_re <= 3.9e-11) {
tmp = 1.0;
} else {
tmp = pow(x_46_im, y_46_re);
}
return tmp;
}
real(8) function code(x_46re, x_46im, y_46re, y_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
real(8), intent (in) :: y_46re
real(8), intent (in) :: y_46im
real(8) :: tmp
if (y_46re <= (-3.4d+19)) then
tmp = x_46im ** y_46re
else if (y_46re <= 3.9d-11) then
tmp = 1.0d0
else
tmp = x_46im ** y_46re
end if
code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double tmp;
if (y_46_re <= -3.4e+19) {
tmp = Math.pow(x_46_im, y_46_re);
} else if (y_46_re <= 3.9e-11) {
tmp = 1.0;
} else {
tmp = Math.pow(x_46_im, y_46_re);
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): tmp = 0 if y_46_re <= -3.4e+19: tmp = math.pow(x_46_im, y_46_re) elif y_46_re <= 3.9e-11: tmp = 1.0 else: tmp = math.pow(x_46_im, y_46_re) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0 if (y_46_re <= -3.4e+19) tmp = x_46_im ^ y_46_re; elseif (y_46_re <= 3.9e-11) tmp = 1.0; else tmp = x_46_im ^ y_46_re; end return tmp end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 0.0; if (y_46_re <= -3.4e+19) tmp = x_46_im ^ y_46_re; elseif (y_46_re <= 3.9e-11) tmp = 1.0; else tmp = x_46_im ^ y_46_re; end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -3.4e+19], N[Power[x$46$im, y$46$re], $MachinePrecision], If[LessEqual[y$46$re, 3.9e-11], 1.0, N[Power[x$46$im, y$46$re], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -3.4 \cdot 10^{+19}:\\
\;\;\;\;{x.im}^{y.re}\\
\mathbf{elif}\;y.re \leq 3.9 \cdot 10^{-11}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;{x.im}^{y.re}\\
\end{array}
\end{array}
if y.re < -3.4e19 or 3.9000000000000001e-11 < y.re Initial program 35.5%
Taylor expanded in y.im around 0
pow-lowering-pow.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6431.3%
Simplified31.3%
Taylor expanded in x.re around 0
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f64N/A
pow-lowering-pow.f6425.1%
Simplified25.1%
Taylor expanded in y.re around 0
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
log-lowering-log.f6428.6%
Simplified28.6%
Taylor expanded in y.im around 0
pow-lowering-pow.f6453.0%
Simplified53.0%
if -3.4e19 < y.re < 3.9000000000000001e-11Initial program 41.9%
Taylor expanded in y.im around 0
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f64N/A
pow-lowering-pow.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6446.0%
Simplified46.0%
Taylor expanded in y.re around 0
Simplified43.4%
(FPCore (x.re x.im y.re y.im) :precision binary64 1.0)
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return 1.0;
}
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 = 1.0d0
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return 1.0;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return 1.0
function code(x_46_re, x_46_im, y_46_re, y_46_im) return 1.0 end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = 1.0; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 38.4%
Taylor expanded in y.im around 0
*-lowering-*.f64N/A
cos-lowering-cos.f64N/A
*-lowering-*.f64N/A
atan2-lowering-atan2.f64N/A
pow-lowering-pow.f64N/A
unpow2N/A
unpow2N/A
hypot-defineN/A
hypot-lowering-hypot.f6458.6%
Simplified58.6%
Taylor expanded in y.re around 0
Simplified21.2%
herbie shell --seed 2024156
(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)))))