Average Error: 32.9 → 7.5
Time: 36.5s
Precision: binary64
Cost: 71688
\[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 \sin \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 := e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ t_2 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ \mathbf{if}\;y.im \leq -1.1 \cdot 10^{+57}:\\ \;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot t_1\\ \mathbf{elif}\;y.im \leq 10^{+30}:\\ \;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{t_0} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, y.im \cdot t_2\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_0} \cdot \sin \left(\mathsf{fma}\left(t_2, y.im, t_1\right)\right)\\ \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)))
  (sin
   (+
    (* (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 (exp (* y.im (atan2 x.im x.re))))
        (t_1 (* (atan2 x.im x.re) y.re))
        (t_2 (log (hypot x.re x.im))))
   (if (<= y.im -1.1e+57)
     (* (exp (* y.im (- (atan2 x.im x.re)))) t_1)
     (if (<= y.im 1e+30)
       (*
        (/ (pow (hypot x.re x.im) y.re) t_0)
        (log1p (expm1 (sin (fma y.re (atan2 x.im x.re) (* y.im t_2))))))
       (* (/ 1.0 t_0) (sin (fma t_2 y.im t_1)))))))
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))) * sin(((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 = exp((y_46_im * atan2(x_46_im, x_46_re)));
	double t_1 = atan2(x_46_im, x_46_re) * y_46_re;
	double t_2 = log(hypot(x_46_re, x_46_im));
	double tmp;
	if (y_46_im <= -1.1e+57) {
		tmp = exp((y_46_im * -atan2(x_46_im, x_46_re))) * t_1;
	} else if (y_46_im <= 1e+30) {
		tmp = (pow(hypot(x_46_re, x_46_im), y_46_re) / t_0) * log1p(expm1(sin(fma(y_46_re, atan2(x_46_im, x_46_re), (y_46_im * t_2)))));
	} else {
		tmp = (1.0 / t_0) * sin(fma(t_2, y_46_im, t_1));
	}
	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))) * sin(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 = exp(Float64(y_46_im * atan(x_46_im, x_46_re)))
	t_1 = Float64(atan(x_46_im, x_46_re) * y_46_re)
	t_2 = log(hypot(x_46_re, x_46_im))
	tmp = 0.0
	if (y_46_im <= -1.1e+57)
		tmp = Float64(exp(Float64(y_46_im * Float64(-atan(x_46_im, x_46_re)))) * t_1);
	elseif (y_46_im <= 1e+30)
		tmp = Float64(Float64((hypot(x_46_re, x_46_im) ^ y_46_re) / t_0) * log1p(expm1(sin(fma(y_46_re, atan(x_46_im, x_46_re), Float64(y_46_im * t_2))))));
	else
		tmp = Float64(Float64(1.0 / t_0) * sin(fma(t_2, y_46_im, t_1)));
	end
	return 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[Sin[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[Exp[N[(y$46$im * N[ArcTan[x$46$im / x$46$re], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[ArcTan[x$46$im / x$46$re], $MachinePrecision] * y$46$re), $MachinePrecision]}, Block[{t$95$2 = N[Log[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y$46$im, -1.1e+57], N[(N[Exp[N[(y$46$im * (-N[ArcTan[x$46$im / x$46$re], $MachinePrecision])), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[y$46$im, 1e+30], N[(N[(N[Power[N[Sqrt[x$46$re ^ 2 + x$46$im ^ 2], $MachinePrecision], y$46$re], $MachinePrecision] / t$95$0), $MachinePrecision] * N[Log[1 + N[(Exp[N[Sin[N[(y$46$re * N[ArcTan[x$46$im / x$46$re], $MachinePrecision] + N[(y$46$im * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 / t$95$0), $MachinePrecision] * N[Sin[N[(t$95$2 * y$46$im + t$95$1), $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 \sin \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 := e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\
t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\
t_2 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\
\mathbf{if}\;y.im \leq -1.1 \cdot 10^{+57}:\\
\;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot t_1\\

\mathbf{elif}\;y.im \leq 10^{+30}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{t_0} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, y.im \cdot t_2\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{t_0} \cdot \sin \left(\mathsf{fma}\left(t_2, y.im, t_1\right)\right)\\


\end{array}

Error

Derivation

  1. Split input into 3 regimes
  2. if y.im < -1.1e57

    1. Initial program 34.2

      \[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 \sin \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 17.3

      \[\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}{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    3. Taylor expanded in x.re around inf 38.8

      \[\leadsto e^{\log \color{blue}{x.re} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \]
    4. Taylor expanded in y.re around 0 38.8

      \[\leadsto e^{\log x.re \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \color{blue}{\left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \]
    5. Taylor expanded in y.re around 0 15.2

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

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

    1. Initial program 31.9

      \[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 \sin \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. Simplified2.3

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \]
      Proof
      (*.f64 (/.f64 (pow.f64 (hypot.f64 x.re x.im) y.re) (pow.f64 (exp.f64 (atan2.f64 x.im x.re)) y.im)) (sin.f64 (fma.f64 (log.f64 (hypot.f64 x.re x.im)) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (pow.f64 (Rewrite<= hypot-def_binary64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (pow.f64 (exp.f64 (atan2.f64 x.im x.re)) y.im)) (sin.f64 (fma.f64 (log.f64 (hypot.f64 x.re x.im)) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 52 points increase in error, 5 points decrease in error
      (*.f64 (/.f64 (Rewrite<= exp-to-pow_binary64 (exp.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re))) (pow.f64 (exp.f64 (atan2.f64 x.im x.re)) y.im)) (sin.f64 (fma.f64 (log.f64 (hypot.f64 x.re x.im)) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 1 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (exp.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re)) (Rewrite<= exp-prod_binary64 (exp.f64 (*.f64 (atan2.f64 x.im x.re) y.im)))) (sin.f64 (fma.f64 (log.f64 (hypot.f64 x.re x.im)) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 0 points increase in error, 4 points decrease in error
      (*.f64 (Rewrite<= exp-diff_binary64 (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)))) (sin.f64 (fma.f64 (log.f64 (hypot.f64 x.re x.im)) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 0 points increase in error, 13 points decrease in error
      (*.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))) (sin.f64 (fma.f64 (log.f64 (Rewrite<= hypot-def_binary64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im))))) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 73 points increase in error, 0 points decrease in error
      (*.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))) (sin.f64 (fma.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im (Rewrite<= *-commutative_binary64 (*.f64 (atan2.f64 x.im x.re) y.re))))): 0 points increase in error, 0 points decrease in error
      (*.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))) (sin.f64 (Rewrite<= fma-def_binary64 (+.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 points increase in error, 1 points decrease in error
    3. Taylor expanded in x.im around 0 2.3

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \]
    4. Applied egg-rr2.3

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\right)\right)\right)} \]

    if 1e30 < y.im

    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 \sin \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. Simplified21.9

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{{\left(e^{\tan^{-1}_* \frac{x.im}{x.re}}\right)}^{y.im}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)} \]
      Proof
      (*.f64 (/.f64 (pow.f64 (hypot.f64 x.re x.im) y.re) (pow.f64 (exp.f64 (atan2.f64 x.im x.re)) y.im)) (sin.f64 (fma.f64 (log.f64 (hypot.f64 x.re x.im)) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 0 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (pow.f64 (Rewrite<= hypot-def_binary64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (pow.f64 (exp.f64 (atan2.f64 x.im x.re)) y.im)) (sin.f64 (fma.f64 (log.f64 (hypot.f64 x.re x.im)) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 52 points increase in error, 5 points decrease in error
      (*.f64 (/.f64 (Rewrite<= exp-to-pow_binary64 (exp.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re))) (pow.f64 (exp.f64 (atan2.f64 x.im x.re)) y.im)) (sin.f64 (fma.f64 (log.f64 (hypot.f64 x.re x.im)) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 1 points increase in error, 0 points decrease in error
      (*.f64 (/.f64 (exp.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re)) (Rewrite<= exp-prod_binary64 (exp.f64 (*.f64 (atan2.f64 x.im x.re) y.im)))) (sin.f64 (fma.f64 (log.f64 (hypot.f64 x.re x.im)) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 0 points increase in error, 4 points decrease in error
      (*.f64 (Rewrite<= exp-diff_binary64 (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)))) (sin.f64 (fma.f64 (log.f64 (hypot.f64 x.re x.im)) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 0 points increase in error, 13 points decrease in error
      (*.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))) (sin.f64 (fma.f64 (log.f64 (Rewrite<= hypot-def_binary64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im))))) y.im (*.f64 y.re (atan2.f64 x.im x.re))))): 73 points increase in error, 0 points decrease in error
      (*.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))) (sin.f64 (fma.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.im (Rewrite<= *-commutative_binary64 (*.f64 (atan2.f64 x.im x.re) y.re))))): 0 points increase in error, 0 points decrease in error
      (*.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))) (sin.f64 (Rewrite<= fma-def_binary64 (+.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 points increase in error, 1 points decrease in error
    3. Taylor expanded in x.im around 0 20.2

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{\color{blue}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \]
    4. Taylor expanded in y.re around 0 18.6

      \[\leadsto \color{blue}{\frac{1}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification7.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -1.1 \cdot 10^{+57}:\\ \;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ \mathbf{elif}\;y.im \leq 10^{+30}:\\ \;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, y.im \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\\ \end{array} \]

Alternatives

Alternative 1
Error7.5
Cost58888
\[\begin{array}{l} t_0 := e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ t_2 := \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t_1\right)\right)\\ \mathbf{if}\;y.im \leq -1.1 \cdot 10^{+57}:\\ \;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot t_1\\ \mathbf{elif}\;y.im \leq 10^{+30}:\\ \;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{t_0} \cdot t_2\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_0} \cdot t_2\\ \end{array} \]
Alternative 2
Error7.5
Cost58888
\[\begin{array}{l} t_0 := e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ t_1 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ t_2 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ \mathbf{if}\;y.im \leq -1.1 \cdot 10^{+57}:\\ \;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot t_2\\ \mathbf{elif}\;y.im \leq 10^{+30}:\\ \;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{t_0} \cdot \sin \left(\mathsf{fma}\left(y.re, \tan^{-1}_* \frac{x.im}{x.re}, y.im \cdot t_1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{t_0} \cdot \sin \left(\mathsf{fma}\left(t_1, y.im, t_2\right)\right)\\ \end{array} \]
Alternative 3
Error6.4
Cost45960
\[\begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ t_2 := e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_0}\\ \mathbf{if}\;y.re \leq -2.8 \cdot 10^{+17}:\\ \;\;\;\;t_1 \cdot t_2\\ \mathbf{elif}\;y.re \leq 1.9775624203545252 \cdot 10^{-26}:\\ \;\;\;\;\frac{1}{e^{t_0}} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t_1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_2 \cdot \left(\left(1 + \sin t_1\right) + -1\right)\\ \end{array} \]
Alternative 4
Error8.5
Cost45768
\[\begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ \mathbf{if}\;y.im \leq -155000:\\ \;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot t_0\\ \mathbf{elif}\;y.im \leq 2100000000000:\\ \;\;\;\;\sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t_0\right)\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log x.im - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ \end{array} \]
Alternative 5
Error18.2
Cost39884
\[\begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := e^{y.re \cdot \log x.im - t_0}\\ t_2 := \sin \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ t_3 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ \mathbf{if}\;x.im \leq -6.1 \cdot 10^{+42}:\\ \;\;\;\;t_2 \cdot e^{y.re \cdot \log \left(-x.im\right) - t_0}\\ \mathbf{elif}\;x.im \leq 4.3 \cdot 10^{-201}:\\ \;\;\;\;t_3 \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_0}\\ \mathbf{elif}\;x.im \leq 10^{-22}:\\ \;\;\;\;t_1 \cdot t_2\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \sin \left(t_3 + y.im \cdot \log x.im\right)\\ \end{array} \]
Alternative 6
Error18.2
Cost39884
\[\begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ t_1 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_2 := \sin \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ t_3 := e^{y.re \cdot \log x.im - t_1}\\ \mathbf{if}\;x.im \leq -6.1 \cdot 10^{+42}:\\ \;\;\;\;t_2 \cdot e^{y.re \cdot \log \left(-x.im\right) - t_1}\\ \mathbf{elif}\;x.im \leq 4.3 \cdot 10^{-201}:\\ \;\;\;\;e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_1} \cdot \sin t_0\\ \mathbf{elif}\;x.im \leq 10^{-22}:\\ \;\;\;\;t_3 \cdot t_2\\ \mathbf{else}:\\ \;\;\;\;t_3 \cdot \sin \left(t_0 + y.im \cdot \log x.im\right)\\ \end{array} \]
Alternative 7
Error22.2
Cost39628
\[\begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := e^{y.re \cdot \log x.im - t_0}\\ t_2 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ \mathbf{if}\;x.im \leq -3.3 \cdot 10^{-47}:\\ \;\;\;\;{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \sin \left(t_2 - y.im \cdot \log \left(\frac{-1}{x.im}\right)\right)\\ \mathbf{elif}\;x.im \leq 4.3 \cdot 10^{-201}:\\ \;\;\;\;t_2 \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_0}\\ \mathbf{elif}\;x.im \leq 10^{+71}:\\ \;\;\;\;t_1 \cdot \sin \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ \mathbf{elif}\;x.im \leq 10^{+265}:\\ \;\;\;\;\sin t_2 \cdot t_1\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \sin \left(y.im \cdot \log x.im\right)\\ \end{array} \]
Alternative 8
Error20.5
Cost39628
\[\begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := e^{y.re \cdot \log x.im - t_0}\\ t_2 := \sin \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ t_3 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ \mathbf{if}\;x.im \leq -6.1 \cdot 10^{+42}:\\ \;\;\;\;t_2 \cdot e^{y.re \cdot \log \left(-x.im\right) - t_0}\\ \mathbf{elif}\;x.im \leq 4.3 \cdot 10^{-201}:\\ \;\;\;\;t_3 \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_0}\\ \mathbf{elif}\;x.im \leq 10^{+71}:\\ \;\;\;\;t_1 \cdot t_2\\ \mathbf{elif}\;x.im \leq 10^{+265}:\\ \;\;\;\;\sin t_3 \cdot t_1\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \sin \left(y.im \cdot \log x.im\right)\\ \end{array} \]
Alternative 9
Error24.8
Cost33492
\[\begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ t_2 := \sin t_1\\ t_3 := {\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \sin \left(t_1 - y.im \cdot \log \left(\frac{-1}{x.im}\right)\right)\\ t_4 := e^{y.re \cdot \log x.im - t_0}\\ t_5 := t_2 \cdot t_4\\ \mathbf{if}\;x.im \leq -2.9 \cdot 10^{-154}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x.im \leq -5.2 \cdot 10^{-220}:\\ \;\;\;\;t_2 \cdot e^{y.re \cdot \log \left(-x.im\right) - t_0}\\ \mathbf{elif}\;x.im \leq 0:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x.im \leq 1000000000000:\\ \;\;\;\;t_5\\ \mathbf{elif}\;x.im \leq 10^{+71}:\\ \;\;\;\;t_4 \cdot \sin \left(y.im \cdot \log x.im\right)\\ \mathbf{else}:\\ \;\;\;\;t_5\\ \end{array} \]
Alternative 10
Error22.6
Cost33480
\[\begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := e^{y.re \cdot \log x.im - t_0}\\ t_2 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ \mathbf{if}\;x.im \leq -3.3 \cdot 10^{-47}:\\ \;\;\;\;{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \sin \left(t_2 - y.im \cdot \log \left(\frac{-1}{x.im}\right)\right)\\ \mathbf{elif}\;x.im \leq 38000000000000:\\ \;\;\;\;t_2 \cdot e^{y.re \cdot \log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) - t_0}\\ \mathbf{elif}\;x.im \leq 10^{+71}:\\ \;\;\;\;t_1 \cdot \sin \left(y.im \cdot \log x.im\right)\\ \mathbf{else}:\\ \;\;\;\;\sin t_2 \cdot t_1\\ \end{array} \]
Alternative 11
Error24.1
Cost33228
\[\begin{array}{l} t_0 := y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ t_2 := e^{y.re \cdot \log x.im - t_0}\\ t_3 := t_1 \cdot t_2\\ \mathbf{if}\;x.im \leq 0:\\ \;\;\;\;t_1 \cdot e^{y.re \cdot \log \left(-x.im\right) - t_0}\\ \mathbf{elif}\;x.im \leq 1000000000000:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x.im \leq 10^{+71}:\\ \;\;\;\;t_2 \cdot \sin \left(y.im \cdot \log x.im\right)\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 12
Error26.5
Cost33032
\[\begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ t_1 := t_0 \cdot e^{\log \left({x.re}^{y.re}\right) - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{if}\;y.re \leq -5.7 \cdot 10^{+47}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.re \leq 2 \cdot 10^{+20}:\\ \;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 13
Error28.9
Cost26564
\[\begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ \mathbf{if}\;x.re \leq 2.8 \cdot 10^{-307}:\\ \;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot e^{y.re \cdot \log x.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \end{array} \]
Alternative 14
Error32.1
Cost19972
\[\begin{array}{l} t_0 := \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\\ \mathbf{if}\;x.re \leq 0.002:\\ \;\;\;\;e^{y.im \cdot \left(-\tan^{-1}_* \frac{x.im}{x.re}\right)} \cdot t_0\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot e^{y.re \cdot \log x.re}\\ \end{array} \]
Alternative 15
Error50.6
Cost19712
\[\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) \cdot e^{y.re \cdot \log x.re} \]

Error

Reproduce

herbie shell --seed 2022300 
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, imaginary part"
  :precision binary64
  (* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (sin (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))