Average Error: 33.2 → 6.6
Time: 33.9s
Precision: binary64
Cost: 39748
\[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 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{if}\;y.re \leq -1.2795022142120869 \cdot 10^{-8}:\\ \;\;\;\;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 t_0\\ \mathbf{elif}\;y.re \leq 1.4110851014167927 \cdot 10^{-26}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \end{array} \]
(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 (cos (* y.re (atan2 x.im x.re)))))
   (if (<= y.re -1.2795022142120869e-8)
     (*
      (exp
       (-
        (* y.re (log (sqrt (+ (* x.re x.re) (* x.im x.im)))))
        (* (atan2 x.im x.re) y.im)))
      t_0)
     (if (<= y.re 1.4110851014167927e-26)
       (exp (* (atan2 x.im x.re) (- y.im)))
       (* t_0 (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 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 = cos((y_46_re * atan2(x_46_im, x_46_re)));
	double tmp;
	if (y_46_re <= -1.2795022142120869e-8) {
		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))) * t_0;
	} else if (y_46_re <= 1.4110851014167927e-26) {
		tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
	} else {
		tmp = t_0 * pow(hypot(x_46_im, x_46_re), 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) {
	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 = Math.cos((y_46_re * Math.atan2(x_46_im, x_46_re)));
	double tmp;
	if (y_46_re <= -1.2795022142120869e-8) {
		tmp = Math.exp(((y_46_re * Math.log(Math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (Math.atan2(x_46_im, x_46_re) * y_46_im))) * t_0;
	} else if (y_46_re <= 1.4110851014167927e-26) {
		tmp = Math.exp((Math.atan2(x_46_im, x_46_re) * -y_46_im));
	} else {
		tmp = t_0 * Math.pow(Math.hypot(x_46_im, x_46_re), y_46_re);
	}
	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 = math.cos((y_46_re * math.atan2(x_46_im, x_46_re)))
	tmp = 0
	if y_46_re <= -1.2795022142120869e-8:
		tmp = math.exp(((y_46_re * math.log(math.sqrt(((x_46_re * x_46_re) + (x_46_im * x_46_im))))) - (math.atan2(x_46_im, x_46_re) * y_46_im))) * t_0
	elif y_46_re <= 1.4110851014167927e-26:
		tmp = math.exp((math.atan2(x_46_im, x_46_re) * -y_46_im))
	else:
		tmp = t_0 * math.pow(math.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)
	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 = cos(Float64(y_46_re * atan(x_46_im, x_46_re)))
	tmp = 0.0
	if (y_46_re <= -1.2795022142120869e-8)
		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))) * t_0);
	elseif (y_46_re <= 1.4110851014167927e-26)
		tmp = exp(Float64(atan(x_46_im, x_46_re) * Float64(-y_46_im)));
	else
		tmp = Float64(t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re));
	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 = cos((y_46_re * atan2(x_46_im, x_46_re)));
	tmp = 0.0;
	if (y_46_re <= -1.2795022142120869e-8)
		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))) * t_0;
	elseif (y_46_re <= 1.4110851014167927e-26)
		tmp = exp((atan2(x_46_im, x_46_re) * -y_46_im));
	else
		tmp = t_0 * (hypot(x_46_im, x_46_re) ^ y_46_re);
	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[Cos[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$re, -1.2795022142120869e-8], 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] * t$95$0), $MachinePrecision], If[LessEqual[y$46$re, 1.4110851014167927e-26], N[Exp[N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * (-y$46$im)), $MachinePrecision]], $MachinePrecision], N[(t$95$0 * N[Power[N[Sqrt[x$46$im ^ 2 + x$46$re ^ 2], $MachinePrecision], y$46$re], $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 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\
\mathbf{if}\;y.re \leq -1.2795022142120869 \cdot 10^{-8}:\\
\;\;\;\;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 t_0\\

\mathbf{elif}\;y.re \leq 1.4110851014167927 \cdot 10^{-26}:\\
\;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\

\mathbf{else}:\\
\;\;\;\;t_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if y.re < -1.2795022142120869e-8

    1. Initial program 36.4

      \[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) \]
    2. Taylor expanded in y.im around 0 1.2

      \[\leadsto 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 \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]

    if -1.2795022142120869e-8 < y.re < 1.4110851014167927e-26

    1. Initial program 34.5

      \[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) \]
    2. Taylor expanded in y.im around 0 30.5

      \[\leadsto 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 \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Taylor expanded in y.re around 0 30.5

      \[\leadsto 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 \color{blue}{1} \]
    4. Taylor expanded in y.re around 0 6.7

      \[\leadsto e^{\color{blue}{-1 \cdot \left(y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot 1 \]
    5. Simplified6.7

      \[\leadsto e^{\color{blue}{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot 1 \]
      Proof
      (*.f64 y.im (neg.f64 (atan2.f64 x.im x.re))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= distribute-rgt-neg-in_binary64 (neg.f64 (*.f64 y.im (atan2.f64 x.im x.re)))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (*.f64 y.im (atan2.f64 x.im x.re)))): 0 points increase in error, 0 points decrease in error

    if 1.4110851014167927e-26 < y.re

    1. Initial program 21.7

      \[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) \]
    2. Taylor expanded in y.im around 0 33.2

      \[\leadsto 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 \color{blue}{\left(-0.5 \cdot \left({y.im}^{2} \cdot \left({\log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{2} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right) + \left(-1 \cdot \left(\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot \left(y.im \cdot \log \left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)\right)\right) + \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)} \]
    3. Simplified25.8

      \[\leadsto 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 \color{blue}{\left(\left(\left(\left(-0.5 \cdot y.im\right) \cdot y.im\right) \cdot {\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{2} + 1\right) \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - y.im \cdot \left(\log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)} \]
      Proof
      (-.f64 (*.f64 (+.f64 (*.f64 (*.f64 (*.f64 -1/2 y.im) y.im) (pow.f64 (log.f64 (hypot.f64 x.im x.re)) 2)) 1) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re)))) (*.f64 y.im (*.f64 (log.f64 (hypot.f64 x.im x.re)) (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (*.f64 (+.f64 (*.f64 (Rewrite<= associate-*r*_binary64 (*.f64 -1/2 (*.f64 y.im y.im))) (pow.f64 (log.f64 (hypot.f64 x.im x.re)) 2)) 1) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re)))) (*.f64 y.im (*.f64 (log.f64 (hypot.f64 x.im x.re)) (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (*.f64 (+.f64 (*.f64 (*.f64 -1/2 (Rewrite<= unpow2_binary64 (pow.f64 y.im 2))) (pow.f64 (log.f64 (hypot.f64 x.im x.re)) 2)) 1) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re)))) (*.f64 y.im (*.f64 (log.f64 (hypot.f64 x.im x.re)) (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (*.f64 (+.f64 (*.f64 (*.f64 -1/2 (pow.f64 y.im 2)) (pow.f64 (log.f64 (Rewrite<= hypot-def_binary64 (sqrt.f64 (+.f64 (*.f64 x.im x.im) (*.f64 x.re x.re))))) 2)) 1) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re)))) (*.f64 y.im (*.f64 (log.f64 (hypot.f64 x.im x.re)) (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))): 111 points increase in error, 0 points decrease in error
      (-.f64 (*.f64 (+.f64 (*.f64 (*.f64 -1/2 (pow.f64 y.im 2)) (pow.f64 (log.f64 (sqrt.f64 (+.f64 (Rewrite<= unpow2_binary64 (pow.f64 x.im 2)) (*.f64 x.re x.re)))) 2)) 1) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re)))) (*.f64 y.im (*.f64 (log.f64 (hypot.f64 x.im x.re)) (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (*.f64 (+.f64 (*.f64 (*.f64 -1/2 (pow.f64 y.im 2)) (pow.f64 (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (Rewrite<= unpow2_binary64 (pow.f64 x.re 2))))) 2)) 1) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re)))) (*.f64 y.im (*.f64 (log.f64 (hypot.f64 x.im x.re)) (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (Rewrite<= distribute-rgt1-in_binary64 (+.f64 (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (*.f64 (*.f64 (*.f64 -1/2 (pow.f64 y.im 2)) (pow.f64 (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))) 2)) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))) (*.f64 y.im (*.f64 (log.f64 (hypot.f64 x.im x.re)) (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (Rewrite<= associate-*r*_binary64 (*.f64 (*.f64 -1/2 (pow.f64 y.im 2)) (*.f64 (pow.f64 (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))) 2) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))))))) (*.f64 y.im (*.f64 (log.f64 (hypot.f64 x.im x.re)) (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))): 0 points increase in error, 3 points decrease in error
      (-.f64 (+.f64 (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (Rewrite<= associate-*r*_binary64 (*.f64 -1/2 (*.f64 (pow.f64 y.im 2) (*.f64 (pow.f64 (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))) 2) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))))) (*.f64 y.im (*.f64 (log.f64 (hypot.f64 x.im x.re)) (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (*.f64 -1/2 (*.f64 (pow.f64 y.im 2) (*.f64 (pow.f64 (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))) 2) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))))))) (*.f64 y.im (*.f64 (log.f64 (Rewrite<= hypot-def_binary64 (sqrt.f64 (+.f64 (*.f64 x.im x.im) (*.f64 x.re x.re))))) (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (*.f64 -1/2 (*.f64 (pow.f64 y.im 2) (*.f64 (pow.f64 (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))) 2) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))))))) (*.f64 y.im (*.f64 (log.f64 (sqrt.f64 (+.f64 (Rewrite<= unpow2_binary64 (pow.f64 x.im 2)) (*.f64 x.re x.re)))) (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (*.f64 -1/2 (*.f64 (pow.f64 y.im 2) (*.f64 (pow.f64 (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))) 2) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))))))) (*.f64 y.im (*.f64 (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (Rewrite<= unpow2_binary64 (pow.f64 x.re 2))))) (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (*.f64 -1/2 (*.f64 (pow.f64 y.im 2) (*.f64 (pow.f64 (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))) 2) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))))))) (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 y.im (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2))))) (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))): 0 points increase in error, 0 points decrease in error
      (-.f64 (+.f64 (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (*.f64 -1/2 (*.f64 (pow.f64 y.im 2) (*.f64 (pow.f64 (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))) 2) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))))))) (Rewrite<= *-commutative_binary64 (*.f64 (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (*.f64 y.im (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-+r-_binary64 (+.f64 (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (-.f64 (*.f64 -1/2 (*.f64 (pow.f64 y.im 2) (*.f64 (pow.f64 (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))) 2) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))) (*.f64 (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (*.f64 y.im (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2))))))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (Rewrite<= unsub-neg_binary64 (+.f64 (*.f64 -1/2 (*.f64 (pow.f64 y.im 2) (*.f64 (pow.f64 (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))) 2) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))) (neg.f64 (*.f64 (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (*.f64 y.im (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))))))))): 0 points increase in error, 0 points decrease in error
      (+.f64 (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (+.f64 (*.f64 -1/2 (*.f64 (pow.f64 y.im 2) (*.f64 (pow.f64 (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))) 2) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))) (Rewrite<= mul-1-neg_binary64 (*.f64 -1 (*.f64 (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (*.f64 y.im (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))))))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= +-commutative_binary64 (+.f64 (+.f64 (*.f64 -1/2 (*.f64 (pow.f64 y.im 2) (*.f64 (pow.f64 (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))) 2) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))) (*.f64 -1 (*.f64 (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (*.f64 y.im (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))))))) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))))): 0 points increase in error, 0 points decrease in error
      (Rewrite<= associate-+r+_binary64 (+.f64 (*.f64 -1/2 (*.f64 (pow.f64 y.im 2) (*.f64 (pow.f64 (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2)))) 2) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))) (+.f64 (*.f64 -1 (*.f64 (sin.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (*.f64 y.im (log.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2))))))) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re)))))): 1 points increase in error, 1 points decrease in error
    4. Taylor expanded in y.im around 0 20.4

      \[\leadsto \color{blue}{{\left(\sqrt{{x.im}^{2} + {x.re}^{2}}\right)}^{y.re} \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    5. Simplified17.1

      \[\leadsto \color{blue}{\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}} \]
      Proof
      (*.f64 (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (pow.f64 (hypot.f64 x.im x.re) y.re)): 0 points increase in error, 0 points decrease in error
      (*.f64 (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (pow.f64 (Rewrite<= hypot-def_binary64 (sqrt.f64 (+.f64 (*.f64 x.im x.im) (*.f64 x.re x.re)))) y.re)): 81 points increase in error, 12 points decrease in error
      (*.f64 (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (pow.f64 (sqrt.f64 (+.f64 (Rewrite<= unpow2_binary64 (pow.f64 x.im 2)) (*.f64 x.re x.re))) y.re)): 0 points increase in error, 0 points decrease in error
      (*.f64 (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))) (pow.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (Rewrite<= unpow2_binary64 (pow.f64 x.re 2)))) y.re)): 0 points increase in error, 0 points decrease in error
      (Rewrite<= *-commutative_binary64 (*.f64 (pow.f64 (sqrt.f64 (+.f64 (pow.f64 x.im 2) (pow.f64 x.re 2))) y.re) (cos.f64 (*.f64 y.re (atan2.f64 x.im x.re))))): 0 points increase in error, 0 points decrease in error
  3. Recombined 3 regimes into one program.
  4. Final simplification6.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.re \leq -1.2795022142120869 \cdot 10^{-8}:\\ \;\;\;\;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 \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{elif}\;y.re \leq 1.4110851014167927 \cdot 10^{-26}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \end{array} \]

Alternatives

Alternative 1
Error6.7
Cost26628
\[\begin{array}{l} \mathbf{if}\;y.re \leq -1.2795022142120869 \cdot 10^{-8}:\\ \;\;\;\;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{elif}\;y.re \leq 1.4110851014167927 \cdot 10^{-26}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \end{array} \]
Alternative 2
Error7.4
Cost26376
\[\begin{array}{l} t_0 := \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \mathbf{if}\;y.re \leq -59.732234042562474:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.re \leq 1.4110851014167927 \cdot 10^{-26}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error9.0
Cost19908
\[\begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\\ \mathbf{if}\;x.re \leq 0:\\ \;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - t_0}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log x.re - t_0}\\ \end{array} \]
Alternative 4
Error15.5
Cost19844
\[\begin{array}{l} \mathbf{if}\;x.im \leq 7 \cdot 10^{-309}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log x.im - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \end{array} \]
Alternative 5
Error14.7
Cost19844
\[\begin{array}{l} \mathbf{if}\;x.re \leq 10^{-290}:\\ \;\;\;\;e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log x.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \end{array} \]
Alternative 6
Error21.3
Cost13120
\[e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)} \]
Alternative 7
Error39.1
Cost64
\[1 \]

Error

Reproduce

herbie shell --seed 2022291 
(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)))))