Average Error: 33.3 → 15.7
Time: 8.7s
Precision: binary64
\[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} \mathbf{if}\;x.re \le -3.2346515761756468 \cdot 10^{138}:\\ \;\;\;\;e^{\log \left(-1 \cdot x.re\right) \cdot y.re - e^{\log \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)}} \cdot 1\\ \mathbf{elif}\;x.re \le -2.46020083432847922 \cdot 10^{-169}:\\ \;\;\;\;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 \sqrt[3]{{\left(\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)\right)}^{3}}\\ \mathbf{elif}\;x.re \le 4.66175808030009 \cdot 10^{-311}:\\ \;\;\;\;e^{\log \left(-1 \cdot x.re\right) \cdot y.re - e^{\log \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)}} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.re \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\ \end{array}\]
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}
\mathbf{if}\;x.re \le -3.2346515761756468 \cdot 10^{138}:\\
\;\;\;\;e^{\log \left(-1 \cdot x.re\right) \cdot y.re - e^{\log \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)}} \cdot 1\\

\mathbf{elif}\;x.re \le -2.46020083432847922 \cdot 10^{-169}:\\
\;\;\;\;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 \sqrt[3]{{\left(\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)\right)}^{3}}\\

\mathbf{elif}\;x.re \le 4.66175808030009 \cdot 10^{-311}:\\
\;\;\;\;e^{\log \left(-1 \cdot x.re\right) \cdot y.re - e^{\log \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)}} \cdot 1\\

\mathbf{else}:\\
\;\;\;\;e^{\log x.re \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\

\end{array}
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return ((double) (((double) exp(((double) (((double) (((double) log(((double) sqrt(((double) (((double) (x_46_re * x_46_re)) + ((double) (x_46_im * x_46_im)))))))) * y_46_re)) - ((double) (((double) atan2(x_46_im, x_46_re)) * y_46_im)))))) * ((double) cos(((double) (((double) (((double) log(((double) sqrt(((double) (((double) (x_46_re * x_46_re)) + ((double) (x_46_im * x_46_im)))))))) * y_46_im)) + ((double) (((double) 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 VAR;
	if ((x_46_re <= -3.234651576175647e+138)) {
		VAR = ((double) (((double) exp(((double) (((double) (((double) log(((double) (-1.0 * x_46_re)))) * y_46_re)) - ((double) exp(((double) log(((double) (((double) atan2(x_46_im, x_46_re)) * y_46_im)))))))))) * 1.0));
	} else {
		double VAR_1;
		if ((x_46_re <= -2.4602008343284792e-169)) {
			VAR_1 = ((double) (((double) exp(((double) (((double) (((double) log(((double) sqrt(((double) (((double) (x_46_re * x_46_re)) + ((double) (x_46_im * x_46_im)))))))) * y_46_re)) - ((double) (((double) atan2(x_46_im, x_46_re)) * y_46_im)))))) * ((double) cbrt(((double) pow(((double) cos(((double) (((double) (((double) log(((double) sqrt(((double) (((double) (x_46_re * x_46_re)) + ((double) (x_46_im * x_46_im)))))))) * y_46_im)) + ((double) (((double) atan2(x_46_im, x_46_re)) * y_46_re)))))), 3.0))))));
		} else {
			double VAR_2;
			if ((x_46_re <= 4.6617580803001e-311)) {
				VAR_2 = ((double) (((double) exp(((double) (((double) (((double) log(((double) (-1.0 * x_46_re)))) * y_46_re)) - ((double) exp(((double) log(((double) (((double) atan2(x_46_im, x_46_re)) * y_46_im)))))))))) * 1.0));
			} else {
				VAR_2 = ((double) (((double) exp(((double) (((double) (((double) log(x_46_re)) * y_46_re)) - ((double) (((double) atan2(x_46_im, x_46_re)) * y_46_im)))))) * 1.0));
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if x.re < -3.2346515761756468e138 or -2.46020083432847922e-169 < x.re < 4.66175808030009e-311

    1. Initial program 46.8

      \[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 around 0 25.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}{1}\]
    3. Taylor expanded around -inf 5.3

      \[\leadsto e^{\log \color{blue}{\left(-1 \cdot x.re\right)} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]
    4. Using strategy rm
    5. Applied add-exp-log34.3

      \[\leadsto e^{\log \left(-1 \cdot x.re\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot \color{blue}{e^{\log y.im}}} \cdot 1\]
    6. Applied add-exp-log44.9

      \[\leadsto e^{\log \left(-1 \cdot x.re\right) \cdot y.re - \color{blue}{e^{\log \left(\tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot e^{\log y.im}} \cdot 1\]
    7. Applied prod-exp44.9

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

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

    if -3.2346515761756468e138 < x.re < -2.46020083432847922e-169

    1. Initial program 15.8

      \[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. Using strategy rm
    3. Applied add-cbrt-cube15.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}{\sqrt[3]{\left(\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) \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)\right) \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)}}\]
    4. Simplified15.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 \sqrt[3]{\color{blue}{{\left(\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)\right)}^{3}}}\]

    if 4.66175808030009e-311 < x.re

    1. Initial program 35.0

      \[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 around 0 22.0

      \[\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}\]
    3. Taylor expanded around inf 11.0

      \[\leadsto e^{\log \color{blue}{x.re} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]
  3. Recombined 3 regimes into one program.
  4. Final simplification15.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -3.2346515761756468 \cdot 10^{138}:\\ \;\;\;\;e^{\log \left(-1 \cdot x.re\right) \cdot y.re - e^{\log \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)}} \cdot 1\\ \mathbf{elif}\;x.re \le -2.46020083432847922 \cdot 10^{-169}:\\ \;\;\;\;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 \sqrt[3]{{\left(\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)\right)}^{3}}\\ \mathbf{elif}\;x.re \le 4.66175808030009 \cdot 10^{-311}:\\ \;\;\;\;e^{\log \left(-1 \cdot x.re\right) \cdot y.re - e^{\log \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im\right)}} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{\log x.re \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\\ \end{array}\]

Reproduce

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