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

\mathbf{elif}\;y.re \leq 1.58:\\
\;\;\;\;\sin \left(\mathsf{fma}\left(t_2, y.im, t_1\right)\right) \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{t_0}}\\

\mathbf{else}:\\
\;\;\;\;t_3\\


\end{array}

Error

Derivation

  1. Split input into 2 regimes
  2. if y.re < -1.5e52 or 1.5800000000000001 < y.re

    1. Initial program 30.6

      \[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. Simplified0.2

      \[\leadsto \color{blue}{e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \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)} \]
      Proof
      (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (hypot.f64 x.re 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, 0 points decrease in error
      (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (Rewrite<= hypot-def_binary64 (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))))): 63 points increase in error, 1 points decrease in error
      (*.f64 (exp.f64 (-.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 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, 0 points decrease in error
      (*.f64 (exp.f64 (Rewrite=> fma-neg_binary64 (fma.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) (neg.f64 (neg.f64 y.re)) (neg.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, 0 points decrease in error
      (*.f64 (exp.f64 (fma.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) (Rewrite=> remove-double-neg_binary64 y.re) (neg.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, 0 points decrease in error
      (*.f64 (exp.f64 (Rewrite=> fma-udef_binary64 (+.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re) (neg.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, 0 points decrease in error
      (*.f64 (exp.f64 (+.f64 (Rewrite<= remove-double-neg_binary64 (neg.f64 (neg.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re)))) (neg.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, 0 points decrease in error
      (*.f64 (exp.f64 (Rewrite<= distribute-neg-in_binary64 (neg.f64 (+.f64 (neg.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, 0 points decrease in error
      (*.f64 (exp.f64 (neg.f64 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 (atan2.f64 x.im x.re) y.im) (neg.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re)))))) (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 (exp.f64 (neg.f64 (Rewrite<= sub-neg_binary64 (-.f64 (*.f64 (atan2.f64 x.im x.re) y.im) (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re))))) (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 (exp.f64 (Rewrite=> neg-mul-1_binary64 (*.f64 -1 (-.f64 (*.f64 (atan2.f64 x.im x.re) y.im) (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re))))) (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 (exp.f64 (Rewrite<= neg-mul-1_binary64 (neg.f64 (-.f64 (*.f64 (atan2.f64 x.im x.re) y.im) (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re))))) (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 (exp.f64 (neg.f64 (Rewrite=> sub-neg_binary64 (+.f64 (*.f64 (atan2.f64 x.im x.re) y.im) (neg.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re)))))) (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 (exp.f64 (neg.f64 (Rewrite=> +-commutative_binary64 (+.f64 (neg.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, 0 points decrease in error
      (*.f64 (exp.f64 (Rewrite=> distribute-neg-in_binary64 (+.f64 (neg.f64 (neg.f64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re))) (neg.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, 0 points decrease in error
      (*.f64 (exp.f64 (+.f64 (Rewrite=> remove-double-neg_binary64 (*.f64 (log.f64 (sqrt.f64 (+.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)))) y.re)) (neg.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, 0 points decrease in error
      (*.f64 (exp.f64 (Rewrite<= sub-neg_binary64 (-.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, 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 (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))))): 77 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))))): 1 points increase in error, 0 points decrease in error
    3. Taylor expanded in y.im around 0 0.1

      \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\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)} \]

    if -1.5e52 < y.re < 1.5800000000000001

    1. Initial program 33.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. Simplified5.6

      \[\leadsto \color{blue}{\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 \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) (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, 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) (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))))): 61 points increase in error, 1 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))) (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))))): 1 points increase in error, 0 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, 16 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))))): 77 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))))): 1 points increase in error, 0 points decrease in error
  3. Recombined 2 regimes into one program.
  4. Final simplification3.7

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

Alternatives

Alternative 1
Error3.4
Cost58688
\[\begin{array}{l} t_0 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ e^{t_0 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin \left(\mathsf{fma}\left(t_0, y.im, y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right) \end{array} \]
Alternative 2
Error4.2
Cost45768
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ t_2 := e^{t_1 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin t_0\\ \mathbf{if}\;y.im \leq -4 \cdot 10^{+14}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y.im \leq 9600:\\ \;\;\;\;\sin \left(\mathsf{fma}\left(t_1, y.im, t_0\right)\right) \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Error12.9
Cost40088
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\\ t_2 := e^{t_1 \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sin t_0\\ t_3 := \sqrt[3]{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(y.re \cdot 3\right)}} \cdot \sin \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ \mathbf{if}\;y.im \leq -4 \cdot 10^{+14}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y.im \leq -2.6 \cdot 10^{-80}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y.im \leq -2.9 \cdot 10^{-175}:\\ \;\;\;\;\sin \left(\mathsf{fma}\left(t_1, y.im, t_0\right)\right)\\ \mathbf{elif}\;y.im \leq -4 \cdot 10^{-244}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y.im \leq 4 \cdot 10^{-279}:\\ \;\;\;\;t_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \mathbf{elif}\;y.im \leq 3600:\\ \;\;\;\;t_3\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error18.4
Cost39832
\[\begin{array}{l} t_0 := \sqrt[3]{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{\left(y.re \cdot 3\right)}} \cdot \sin \left(y.im \cdot \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right)\right)\\ t_1 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_2 := \sin t_1\\ t_3 := t_2 \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ t_4 := {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \mathbf{if}\;y.im \leq -3.1 \cdot 10^{+227}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;y.im \leq -2.7 \cdot 10^{-80}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.im \leq -2.8 \cdot 10^{-175}:\\ \;\;\;\;\sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t_1\right)\right)\\ \mathbf{elif}\;y.im \leq -2.7 \cdot 10^{-244}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.im \leq 2.8 \cdot 10^{-279}:\\ \;\;\;\;t_1 \cdot t_4\\ \mathbf{elif}\;y.im \leq 2900:\\ \;\;\;\;t_0\\ \mathbf{elif}\;y.im \leq 1.18 \cdot 10^{+92}:\\ \;\;\;\;\left(1 + t_2 \cdot t_4\right) + -1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 5
Error16.7
Cost32712
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \sin t_0\\ \mathbf{if}\;y.re \leq -3.8 \cdot 10^{-8}:\\ \;\;\;\;t_1 \cdot {\left(\frac{-0.5}{x.re} \cdot \left(x.im \cdot x.im\right) - x.re\right)}^{y.re}\\ \mathbf{elif}\;y.re \leq 6.6 \cdot 10^{-16}:\\ \;\;\;\;\sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, t_0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot {x.re}^{y.re}\\ \end{array} \]
Alternative 6
Error23.7
Cost26764
\[\begin{array}{l} t_0 := \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ t_1 := t_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ t_2 := t_0 \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{if}\;y.im \leq -1.35 \cdot 10^{+227}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y.im \leq 3.8 \cdot 10^{-9}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.im \leq 10^{+91}:\\ \;\;\;\;\left(1 + t_1\right) + -1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Error20.8
Cost26504
\[\begin{array}{l} t_0 := \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\\ \mathbf{if}\;y.re \leq -1.1 \cdot 10^{-17}:\\ \;\;\;\;t_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \mathbf{elif}\;y.re \leq 1.72 \cdot 10^{-13}:\\ \;\;\;\;t_0 \cdot e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(-y.im\right)}\\ \mathbf{else}:\\ \;\;\;\;t_0 \cdot {x.re}^{y.re}\\ \end{array} \]
Alternative 8
Error27.8
Cost26244
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \sin t_0\\ \mathbf{if}\;y.re \leq -3.2 \cdot 10^{-119}:\\ \;\;\;\;t_1 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \mathbf{elif}\;y.re \leq 5.4 \cdot 10^{-225}:\\ \;\;\;\;\sqrt[3]{{t_0}^{3}}\\ \mathbf{elif}\;y.re \leq 7.6 \cdot 10^{-19}:\\ \;\;\;\;\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(y.re + \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot \left(y.re \cdot y.re\right)\right)\\ \mathbf{elif}\;y.re \leq 2.6 \cdot 10^{-14}:\\ \;\;\;\;e^{\mathsf{log1p}\left(t_0\right)} + -1\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot {x.re}^{y.re}\\ \end{array} \]
Alternative 9
Error35.4
Cost20308
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \sin t_0\\ t_2 := t_1 \cdot {x.im}^{y.re}\\ t_3 := t_1 \cdot {x.re}^{y.re}\\ \mathbf{if}\;x.re \leq -1.5 \cdot 10^{-12}:\\ \;\;\;\;t_1 \cdot {\left(-x.re\right)}^{y.re}\\ \mathbf{elif}\;x.re \leq 1.28 \cdot 10^{-141}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x.re \leq 4.3 \cdot 10^{-48}:\\ \;\;\;\;t_3\\ \mathbf{elif}\;x.re \leq 2.1:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x.re \leq 5.8 \cdot 10^{+104}:\\ \;\;\;\;e^{\mathsf{log1p}\left(t_0\right)} + -1\\ \mathbf{else}:\\ \;\;\;\;t_3\\ \end{array} \]
Alternative 10
Error27.9
Cost20300
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ \mathbf{if}\;y.re \leq -1.6 \cdot 10^{-120}:\\ \;\;\;\;t_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \mathbf{elif}\;y.re \leq 2.05 \cdot 10^{-225}:\\ \;\;\;\;\sqrt[3]{{t_0}^{3}}\\ \mathbf{elif}\;y.re \leq 7.6 \cdot 10^{-19}:\\ \;\;\;\;\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(y.re + \log \left(\mathsf{hypot}\left(x.im, x.re\right)\right) \cdot \left(y.re \cdot y.re\right)\right)\\ \mathbf{elif}\;y.re \leq 3.7 \cdot 10^{-14}:\\ \;\;\;\;e^{\mathsf{log1p}\left(t_0\right)} + -1\\ \mathbf{else}:\\ \;\;\;\;\sin t_0 \cdot {x.re}^{y.re}\\ \end{array} \]
Alternative 11
Error34.9
Cost20176
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \sin t_0 \cdot {x.im}^{y.re}\\ t_2 := \mathsf{log1p}\left(t_0\right)\\ \mathbf{if}\;y.re \leq -5.5 \cdot 10^{+19}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.re \leq 5.1 \cdot 10^{-225}:\\ \;\;\;\;\sqrt[3]{{t_0}^{3}}\\ \mathbf{elif}\;y.re \leq 4.8 \cdot 10^{-19}:\\ \;\;\;\;\mathsf{expm1}\left(t_2\right)\\ \mathbf{elif}\;y.re \leq 10^{-14}:\\ \;\;\;\;e^{t_2} + -1\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error34.2
Cost20176
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \sin t_0 \cdot {x.re}^{y.re}\\ t_2 := \mathsf{log1p}\left(t_0\right)\\ \mathbf{if}\;y.re \leq -7.8 \cdot 10^{+22}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.re \leq 2.9 \cdot 10^{-225}:\\ \;\;\;\;\sqrt[3]{{t_0}^{3}}\\ \mathbf{elif}\;y.re \leq 7.6 \cdot 10^{-19}:\\ \;\;\;\;\mathsf{expm1}\left(t_2\right)\\ \mathbf{elif}\;y.re \leq 6.9 \cdot 10^{-15}:\\ \;\;\;\;e^{t_2} + -1\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 13
Error28.0
Cost20176
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := t_0 \cdot {\left(\mathsf{hypot}\left(x.im, x.re\right)\right)}^{y.re}\\ \mathbf{if}\;y.re \leq -1.75 \cdot 10^{-115}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.re \leq 6.6 \cdot 10^{-226}:\\ \;\;\;\;\sqrt[3]{{t_0}^{3}}\\ \mathbf{elif}\;y.re \leq 2.5 \cdot 10^{-17}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.re \leq 1.15 \cdot 10^{-13}:\\ \;\;\;\;e^{\mathsf{log1p}\left(t_0\right)} + -1\\ \mathbf{else}:\\ \;\;\;\;\sin t_0 \cdot {x.re}^{y.re}\\ \end{array} \]
Alternative 14
Error41.2
Cost19848
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := e^{\mathsf{log1p}\left(t_0\right)} + -1\\ \mathbf{if}\;y.im \leq -1.25 \cdot 10^{-68}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.im \leq 3100000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 15
Error44.4
Cost19784
\[\begin{array}{l} t_0 := y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\\ t_1 := \sqrt[3]{{t_0}^{3}}\\ \mathbf{if}\;y.im \leq -3.1 \cdot 10^{-68}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y.im \leq 3500000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 16
Error51.3
Cost6656
\[y.re \cdot \tan^{-1}_* \frac{x.im}{x.re} \]

Error

Reproduce

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