(FPCore (x.re x.im y.re y.im)
: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)))))(FPCore (x.re x.im y.re y.im)
:precision binary64
(let* ((t_0 (* y.re (atan2 x.im x.re)))
(t_1 (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
(t_2 (* (atan2 x.im x.re) y.im))
(t_3 (* (exp (- (* t_1 y.re) t_2)) (cos (+ (* t_1 y.im) t_0))))
(t_4 (* y.im (log (hypot x.re x.im)))))
(if (<= t_3 0.0)
t_3
(*
(/ (pow (hypot x.re x.im) y.re) (exp t_2))
(- (* (cos t_4) (cos t_0)) (* (sin t_4) (sin t_0)))))))double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re)));
}
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
double t_0 = y_46_re * atan2(x_46_im, x_46_re);
double t_1 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_2 = atan2(x_46_im, x_46_re) * y_46_im;
double t_3 = exp(((t_1 * y_46_re) - t_2)) * cos(((t_1 * y_46_im) + t_0));
double t_4 = y_46_im * log(hypot(x_46_re, x_46_im));
double tmp;
if (t_3 <= 0.0) {
tmp = t_3;
} else {
tmp = (pow(hypot(x_46_re, x_46_im), y_46_re) / exp(t_2)) * ((cos(t_4) * cos(t_0)) - (sin(t_4) * sin(t_0)));
}
return tmp;
}
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
return Math.exp(((Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * Math.cos(((Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_im) + (Math.atan2(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) {
double t_0 = y_46_re * Math.atan2(x_46_im, x_46_re);
double t_1 = Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))));
double t_2 = Math.atan2(x_46_im, x_46_re) * y_46_im;
double t_3 = Math.exp(((t_1 * y_46_re) - t_2)) * Math.cos(((t_1 * y_46_im) + t_0));
double t_4 = y_46_im * Math.log(Math.hypot(x_46_re, x_46_im));
double tmp;
if (t_3 <= 0.0) {
tmp = t_3;
} else {
tmp = (Math.pow(Math.hypot(x_46_re, x_46_im), y_46_re) / Math.exp(t_2)) * ((Math.cos(t_4) * Math.cos(t_0)) - (Math.sin(t_4) * Math.sin(t_0)));
}
return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im): return math.exp(((math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * math.cos(((math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * 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 = y_46_re * math.atan2(x_46_im, x_46_re) t_1 = math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) t_2 = math.atan2(x_46_im, x_46_re) * y_46_im t_3 = math.exp(((t_1 * y_46_re) - t_2)) * math.cos(((t_1 * y_46_im) + t_0)) t_4 = y_46_im * math.log(math.hypot(x_46_re, x_46_im)) tmp = 0 if t_3 <= 0.0: tmp = t_3 else: tmp = (math.pow(math.hypot(x_46_re, x_46_im), y_46_re) / math.exp(t_2)) * ((math.cos(t_4) * math.cos(t_0)) - (math.sin(t_4) * math.sin(t_0))) return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im) return Float64(exp(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_re) - Float64(atan(x_46_im, x_46_re) * y_46_im))) * cos(Float64(Float64(log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) * y_46_im) + Float64(atan(x_46_im, x_46_re) * y_46_re)))) end
function code(x_46_re, x_46_im, y_46_re, y_46_im) t_0 = Float64(y_46_re * atan(x_46_im, x_46_re)) t_1 = log(sqrt(Float64(Float64(x_46_re * x_46_re) + Float64(x_46_im * x_46_im)))) t_2 = Float64(atan(x_46_im, x_46_re) * y_46_im) t_3 = Float64(exp(Float64(Float64(t_1 * y_46_re) - t_2)) * cos(Float64(Float64(t_1 * y_46_im) + t_0))) t_4 = Float64(y_46_im * log(hypot(x_46_re, x_46_im))) tmp = 0.0 if (t_3 <= 0.0) tmp = t_3; else tmp = Float64(Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / exp(t_2)) * Float64(Float64(cos(t_4) * cos(t_0)) - Float64(sin(t_4) * sin(t_0)))); end return tmp end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im) tmp = exp(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_re) - (atan2(x_46_im, x_46_re) * y_46_im))) * cos(((log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))) * y_46_im) + (atan2(x_46_im, x_46_re) * y_46_re))); 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 = log(sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im)))); t_2 = atan2(x_46_im, x_46_re) * y_46_im; t_3 = exp(((t_1 * y_46_re) - t_2)) * cos(((t_1 * y_46_im) + t_0)); t_4 = y_46_im * log(hypot(x_46_re, x_46_im)); tmp = 0.0; if (t_3 <= 0.0) tmp = t_3; else tmp = ((hypot(x_46_re, x_46_im) ^ y_46_re) / exp(t_2)) * ((cos(t_4) * cos(t_0)) - (sin(t_4) * sin(t_0))); end tmp_2 = tmp; end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[Exp[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * y$46$im), $MachinePrecision] + N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Log[N[Sqrt[N[(N[(x$46$re * x$46$re), $MachinePrecision] + N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$im), $MachinePrecision]}, Block[{t$95$3 = N[(N[Exp[N[(N[(t$95$1 * y$46$re), $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(t$95$1 * y$46$im), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(y$46$im * N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, 0.0], t$95$3, N[(N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / N[Exp[t$95$2], $MachinePrecision]), $MachinePrecision] * N[(N[(N[Cos[t$95$4], $MachinePrecision] * N[Cos[t$95$0], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[t$95$4], $MachinePrecision] * N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)
\begin{array}{l}
t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\
t_1 := \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)\\
t_2 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\
t_3 := e^{t_1 \cdot y.re - t_2} \cdot \cos \left(t_1 \cdot y.im + t_0\right)\\
t_4 := y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
\mathbf{if}\;t_3 \leq 0:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{t_2}} \cdot \left(\cos t_4 \cdot \cos t_0 - \sin t_4 \cdot \sin t_0\right)\\
\end{array}



Bits error versus x.re



Bits error versus x.im



Bits error versus y.re



Bits error versus y.im
Results
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)))) < 0.0Initial program 2.7
if 0.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 46.2
Simplified7.4
Applied fma-udef_binary647.4
Applied cos-sum_binary647.4
Final simplification6.0
herbie shell --seed 2022137
(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)))))